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