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 21157c74b6SKever YangIn order to support Arm Trust Firmware(ATF), we can use either SPL or 22157c74b6SKever 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 35157c74b6SKever Yang > git clone https://github.com/rockchip-linux/rkbin.git 36157c74b6SKever Yang > git clone https://github.com/rockchip-linux/rkdeveloptool.git 37d26f375aSKever Yang 38*60853a9bSSimon GlassGet some prerequisites 39*60853a9bSSimon Glass====================== 40*60853a9bSSimon Glass 41*60853a9bSSimon GlassYou need the Python elftools.elf.elffile library for make_fit_atf.py to work: 42*60853a9bSSimon Glass 43*60853a9bSSimon Glass > sudo apt-get install python-pyelftools 44*60853a9bSSimon Glass 45*60853a9bSSimon GlassCompile ATF 46*60853a9bSSimon Glass=========== 47d26f375aSKever Yang 48d26f375aSKever Yang > cd arm-trusted-firmware 49d26f375aSKever Yang > make realclean 50d26f375aSKever Yang > make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 bl31 51d26f375aSKever Yang 52157c74b6SKever Yang Get bl31.elf in this step, copy it to U-Boot root dir: 53*60853a9bSSimon Glass > cp build/rk3399/release/bl31/bl31.elf ../u-boot/ 54157c74b6SKever Yang 55*60853a9bSSimon Glass Or you can get the bl31.elf directly from Rockchip: 56*60853a9bSSimon Glass > cp rkbin/rk33/rk3399_bl31_v1.00.elf ../u-boot/bl31.elf 57*60853a9bSSimon Glass 58*60853a9bSSimon Glass 59*60853a9bSSimon GlassCompile U-Boot 60*60853a9bSSimon Glass============== 61d26f375aSKever Yang 62d26f375aSKever Yang > cd ../u-boot 63157c74b6SKever Yang > export ARCH=arm64 64157c74b6SKever Yang > export CROSS_COMPILE=aarch64-linux-gnu- 65157c74b6SKever Yang > make evb-rk3399_defconfig 66157c74b6SKever Yang for firefly-rk3399, use below instead: 67157c74b6SKever Yang > make firefly-rk3399_defconfig 68d26f375aSKever Yang > make 69157c74b6SKever Yang > make u-boot.itb 70d26f375aSKever Yang 71157c74b6SKever Yang Get spl/u-boot-spl.bin and u-boot.itb in this step. 72157c74b6SKever Yang 73*60853a9bSSimon GlassCompile rkdeveloptool 74*60853a9bSSimon Glass===================== 75*60853a9bSSimon Glass 76*60853a9bSSimon GlassGet rkdeveloptool installed on your Host in this step. 77*60853a9bSSimon Glass 78*60853a9bSSimon GlassFollow instructions in latest README, example: 7919ee1faeSHeinrich Schuchardt > cd ../rkdeveloptool 80157c74b6SKever Yang > autoreconf -i 81157c74b6SKever Yang > ./configure 82157c74b6SKever Yang > make 83157c74b6SKever Yang > sudo make install 84157c74b6SKever Yang 85157c74b6SKever YangBoth origin binaries and Tool are ready now, choose either option 1 or 86157c74b6SKever Yangoption 2 to deploy U-Boot. 87157c74b6SKever Yang 88157c74b6SKever YangPackage the image 89157c74b6SKever Yang================= 90157c74b6SKever Yang 91157c74b6SKever YangPackage the image for U-Boot SPL(option 1) 92157c74b6SKever Yang-------------------------------- 93d26f375aSKever Yang > cd .. 94157c74b6SKever Yang > tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl.bin idbspl.img 95157c74b6SKever Yang 96157c74b6SKever Yang Get idbspl.img in this step. 97157c74b6SKever Yang 98157c74b6SKever YangPackage the image for Rockchip miniloader(option 2) 99157c74b6SKever Yang------------------------------------------ 100157c74b6SKever Yang > cd .. 101157c74b6SKever Yang > cp arm-trusted-firmware/build/rk3399/release/bl31.elf rkbin/rk33 102d26f375aSKever Yang > ./rkbin/tools/trust_merger rkbin/tools/RK3399TRUST.ini 103d26f375aSKever Yang > ./rkbin/tools/loaderimage --pack --uboot u-boot/u-boot-dtb.bin uboot.img 104d26f375aSKever Yang 105157c74b6SKever Yang Get trust.img and uboot.img in this step. 106157c74b6SKever Yang 107157c74b6SKever YangFlash the image to eMMC 108157c74b6SKever Yang======================= 109157c74b6SKever Yang 110157c74b6SKever YangFlash the image with U-Boot SPL(option 1) 111157c74b6SKever Yang------------------------------- 112d26f375aSKever YangPower on(or reset with RESET KEY) with MASKROM KEY preesed, and then: 113157c74b6SKever Yang > rkdeveloptool db rkbin/rk33/rk3399_loader_v1.08.106.bin 114157c74b6SKever Yang > rkdeveloptool wl 64 u-boot/idbspl.img 115157c74b6SKever Yang > rkdeveloptool wl 0x4000 u-boot/u-boot.itb 116157c74b6SKever Yang > rkdeveloptool rd 117d26f375aSKever Yang 118157c74b6SKever YangFlash the image with Rockchip miniloader(option 2) 119157c74b6SKever Yang---------------------------------------- 120157c74b6SKever YangPower on(or reset with RESET KEY) with MASKROM KEY preesed, and then: 121157c74b6SKever Yang > rkdeveloptool db rkbin/rk33/rk3399_loader_v1.08.106.bin 122157c74b6SKever Yang > rkdeveloptool ul rkbin/rk33/rk3399_loader_v1.08.106.bin 123157c74b6SKever Yang > rkdeveloptool wl 0x4000 u-boot/uboot.img 124157c74b6SKever Yang > rkdeveloptool wl 0x6000 u-boot/trust.img 125157c74b6SKever Yang > rkdeveloptool rd 126d26f375aSKever Yang 127157c74b6SKever YangYou should be able to get U-Boot log in console/UART2(baurdrate 1500000) 128157c74b6SKever YangFor more detail, please reference to: 129157c74b6SKever Yanghttp://opensource.rock-chips.com/wiki_Boot_option 130