1*4882a593SmuzhiyunIntroduction 2*4882a593Smuzhiyun============ 3*4882a593Smuzhiyun 4*4882a593SmuzhiyunRK3399 key features we might use in U-Boot: 5*4882a593Smuzhiyun* CPU: ARMv8 64bit Big-Little architecture, 6*4882a593Smuzhiyun* Big: dual-core Cortex-A72 7*4882a593Smuzhiyun* Little: quad-core Cortex-A53 8*4882a593Smuzhiyun* IRAM: 200KB 9*4882a593Smuzhiyun* DRAM: 4GB-128MB dual-channel 10*4882a593Smuzhiyun* eMMC: support eMMC 5.0/5.1, suport HS400, HS200, DDR50 11*4882a593Smuzhiyun* SD/MMC: support SD 3.0, MMC 4.51 12*4882a593Smuzhiyun* USB: USB3.0 typc-C port *2 with dwc3 controller 13*4882a593Smuzhiyun* USB2.0 EHCI host port *2 14*4882a593Smuzhiyun* Display: RGB/HDMI/DP/MIPI/EDP 15*4882a593Smuzhiyun 16*4882a593Smuzhiyunevb key features: 17*4882a593Smuzhiyun* regulator: pwm regulator for CPU B/L 18*4882a593Smuzhiyun* PMIC: rk808 19*4882a593Smuzhiyun* debug console: UART2 20*4882a593Smuzhiyun 21*4882a593SmuzhiyunIn order to support Arm Trust Firmware(ATF), we can use either SPL or 22*4882a593Smuzhiyunminiloader from rockchip to do: 23*4882a593Smuzhiyun* do DRAM init 24*4882a593Smuzhiyun* load and verify ATF image 25*4882a593Smuzhiyun* load and verify U-Boot image 26*4882a593Smuzhiyun 27*4882a593SmuzhiyunHere is the step-by-step to boot to U-Boot on rk3399. 28*4882a593Smuzhiyun 29*4882a593SmuzhiyunGet the Source and prebuild binary 30*4882a593Smuzhiyun================================== 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun > mkdir ~/evb_rk3399 33*4882a593Smuzhiyun > cd ~/evb_rk3399 34*4882a593Smuzhiyun > git clone https://github.com/ARM-software/arm-trusted-firmware.git 35*4882a593Smuzhiyun > git clone https://github.com/rockchip-linux/rkbin.git 36*4882a593Smuzhiyun > git clone https://github.com/rockchip-linux/rkdeveloptool.git 37*4882a593Smuzhiyun 38*4882a593SmuzhiyunCompile the ATF 39*4882a593Smuzhiyun=============== 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun > cd arm-trusted-firmware 42*4882a593Smuzhiyun > make realclean 43*4882a593Smuzhiyun > make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 bl31 44*4882a593Smuzhiyun Get bl31.elf in this step, copy it to U-Boot root dir: 45*4882a593Smuzhiyun > cp bl31.elf ../u-boot/ 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunCompile the U-Boot 48*4882a593Smuzhiyun================== 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun > cd ../u-boot 51*4882a593Smuzhiyun > export ARCH=arm64 52*4882a593Smuzhiyun > export CROSS_COMPILE=aarch64-linux-gnu- 53*4882a593Smuzhiyun > make evb-rk3399_defconfig 54*4882a593Smuzhiyun for firefly-rk3399, use below instead: 55*4882a593Smuzhiyun > make evb-firefly_defconfig 56*4882a593Smuzhiyun > make 57*4882a593Smuzhiyun > make u-boot.itb 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun Get spl/u-boot-spl.bin and u-boot.itb in this step. 60*4882a593Smuzhiyun 61*4882a593SmuzhiyunCompile the rkdeveloptool 62*4882a593Smuzhiyun======================= 63*4882a593Smuzhiyun Follow instructions in latest README 64*4882a593Smuzhiyun > cd ../rkdeveloptool 65*4882a593Smuzhiyun > autoreconf -i 66*4882a593Smuzhiyun > ./configure 67*4882a593Smuzhiyun > make 68*4882a593Smuzhiyun > sudo make install 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun Get rkdeveloptool in you Host in this step. 71*4882a593Smuzhiyun 72*4882a593SmuzhiyunBoth origin binaries and Tool are ready now, choose either option 1 or 73*4882a593Smuzhiyunoption 2 to deploy U-Boot. 74*4882a593Smuzhiyun 75*4882a593SmuzhiyunPackage the image 76*4882a593Smuzhiyun================= 77*4882a593Smuzhiyun 78*4882a593SmuzhiyunPackage the image for U-Boot SPL(option 1) 79*4882a593Smuzhiyun-------------------------------- 80*4882a593Smuzhiyun > cd .. 81*4882a593Smuzhiyun > tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl.bin idbspl.img 82*4882a593Smuzhiyun 83*4882a593Smuzhiyun Get idbspl.img in this step. 84*4882a593Smuzhiyun 85*4882a593SmuzhiyunPackage the image for Rockchip miniloader(option 2) 86*4882a593Smuzhiyun------------------------------------------ 87*4882a593Smuzhiyun > cd .. 88*4882a593Smuzhiyun > cp arm-trusted-firmware/build/rk3399/release/bl31.elf rkbin/rk33 89*4882a593Smuzhiyun > ./rkbin/tools/trust_merger rkbin/tools/RK3399TRUST.ini 90*4882a593Smuzhiyun > ./rkbin/tools/loaderimage --pack --uboot u-boot/u-boot-dtb.bin uboot.img 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun Get trust.img and uboot.img in this step. 93*4882a593Smuzhiyun 94*4882a593SmuzhiyunFlash the image to eMMC 95*4882a593Smuzhiyun======================= 96*4882a593Smuzhiyun 97*4882a593SmuzhiyunFlash the image with U-Boot SPL(option 1) 98*4882a593Smuzhiyun------------------------------- 99*4882a593SmuzhiyunPower on(or reset with RESET KEY) with MASKROM KEY preesed, and then: 100*4882a593Smuzhiyun > rkdeveloptool db rkbin/rk33/rk3399_loader_v1.08.106.bin 101*4882a593Smuzhiyun > rkdeveloptool wl 64 u-boot/idbspl.img 102*4882a593Smuzhiyun > rkdeveloptool wl 0x4000 u-boot/u-boot.itb 103*4882a593Smuzhiyun > rkdeveloptool rd 104*4882a593Smuzhiyun 105*4882a593SmuzhiyunFlash the image with Rockchip miniloader(option 2) 106*4882a593Smuzhiyun---------------------------------------- 107*4882a593SmuzhiyunPower on(or reset with RESET KEY) with MASKROM KEY preesed, and then: 108*4882a593Smuzhiyun > rkdeveloptool db rkbin/rk33/rk3399_loader_v1.08.106.bin 109*4882a593Smuzhiyun > rkdeveloptool ul rkbin/rk33/rk3399_loader_v1.08.106.bin 110*4882a593Smuzhiyun > rkdeveloptool wl 0x4000 u-boot/uboot.img 111*4882a593Smuzhiyun > rkdeveloptool wl 0x6000 u-boot/trust.img 112*4882a593Smuzhiyun > rkdeveloptool rd 113*4882a593Smuzhiyun 114*4882a593SmuzhiyunYou should be able to get U-Boot log message in console/UART2 now. 115*4882a593SmuzhiyunFor more detail, please reference to: 116*4882a593Smuzhiyunhttp://opensource.rock-chips.com/wiki_Boot_option 117