1*1bad5e14SManivannan SadhasivamContents 2*1bad5e14SManivannan Sadhasivam======== 3*1bad5e14SManivannan Sadhasivam 4*1bad5e14SManivannan Sadhasivam1. Introduction 5*1bad5e14SManivannan Sadhasivam2. Get the Source and prebuild binary 6*1bad5e14SManivannan Sadhasivam3. Compile the U-Boot 7*1bad5e14SManivannan Sadhasivam4. Compile the rkdeveloptool 8*1bad5e14SManivannan Sadhasivam5. Package the image 9*1bad5e14SManivannan Sadhasivam 5.1. Package the image for U-Boot SPL(option 1) 10*1bad5e14SManivannan Sadhasivam 5.2. Package the image for Rockchip miniloader(option 2) 11*1bad5e14SManivannan Sadhasivam6. Bootloader storage options 12*1bad5e14SManivannan Sadhasivam7. Flash the image to eMMC 13*1bad5e14SManivannan Sadhasivam 7.1. Flash the image with U-Boot SPL(option 1) 14*1bad5e14SManivannan Sadhasivam 7.2. Flash the image with Rockchip miniloader(option 2) 15*1bad5e14SManivannan Sadhasivam8. Create a bootable SD/MMC 16*1bad5e14SManivannan Sadhasivam9. And that is it 17*1bad5e14SManivannan Sadhasivam 18*1bad5e14SManivannan SadhasivamIntroduction 19*1bad5e14SManivannan Sadhasivam============ 20*1bad5e14SManivannan Sadhasivam 21*1bad5e14SManivannan SadhasivamRock960 board family consists of Rock960 (Consumer Edition) and 22*1bad5e14SManivannan SadhasivamFicus (Enterprise Edition) 96Boards featuring Rockchip RK3399 SoC. 23*1bad5e14SManivannan Sadhasivam 24*1bad5e14SManivannan SadhasivamCommon features implemented on both boards: 25*1bad5e14SManivannan Sadhasivam * CPU: ARMv8 64bit Big-Little architecture, 26*1bad5e14SManivannan Sadhasivam * Big: dual-core Cortex-A72 27*1bad5e14SManivannan Sadhasivam * Little: quad-core Cortex-A53 28*1bad5e14SManivannan Sadhasivam * IRAM: 200KB 29*1bad5e14SManivannan Sadhasivam * eMMC: 16/32GB eMMC 5.1 30*1bad5e14SManivannan Sadhasivam * PMU: RK808 31*1bad5e14SManivannan Sadhasivam * SD/MMC 32*1bad5e14SManivannan Sadhasivam * Display: HDMI/DP/MIPI 33*1bad5e14SManivannan Sadhasivam * Low Speed Expansion Connector 34*1bad5e14SManivannan Sadhasivam * High Speed Expansion Connector 35*1bad5e14SManivannan Sadhasivam 36*1bad5e14SManivannan SadhasivamAdditional features of Rock960: 37*1bad5e14SManivannan Sadhasivam * DRAM: 2GB/4GB LPDDR3 @ 1866MHz 38*1bad5e14SManivannan Sadhasivam * 1x USB 3.0 type A, 1x USB 2.0 type A (host mode only), 39*1bad5e14SManivannan Sadhasivam 1x USB 3.0 type C OTG 40*1bad5e14SManivannan Sadhasivam 41*1bad5e14SManivannan SadhasivamAdditional features of Ficus: 42*1bad5e14SManivannan Sadhasivam * DRAM: 2GB/4GB DDR3 @ 1600MHz 43*1bad5e14SManivannan Sadhasivam * Ethernet 44*1bad5e14SManivannan Sadhasivam * 2x USB 3.0 type A, 2x USB 2.0 type A (host mode only), 45*1bad5e14SManivannan Sadhasivam 1x USB 3.0 type C OTG 46*1bad5e14SManivannan Sadhasivam 47*1bad5e14SManivannan SadhasivamHere is the step-by-step to boot to U-Boot on Rock960 boards. 48*1bad5e14SManivannan Sadhasivam 49*1bad5e14SManivannan SadhasivamGet the Source and prebuild binary 50*1bad5e14SManivannan Sadhasivam================================== 51*1bad5e14SManivannan Sadhasivam 52*1bad5e14SManivannan Sadhasivam > git clone https://github.com/96rocks/rkbin.git 53*1bad5e14SManivannan Sadhasivam > git clone https://github.com/rockchip-linux/rkdeveloptool.git 54*1bad5e14SManivannan Sadhasivam 55*1bad5e14SManivannan SadhasivamCompile the U-Boot 56*1bad5e14SManivannan Sadhasivam================== 57*1bad5e14SManivannan Sadhasivam 58*1bad5e14SManivannan Sadhasivam > cd ../u-boot 59*1bad5e14SManivannan Sadhasivam > cp ../rkbin/rk33/rk3399_bl31_v1.00.elf ./bl31.elf 60*1bad5e14SManivannan Sadhasivam > export ARCH=arm64 61*1bad5e14SManivannan Sadhasivam > export CROSS_COMPILE=aarch64-linux-gnu- 62*1bad5e14SManivannan Sadhasivam > make rock960-rk3399_defconfig 63*1bad5e14SManivannan Sadhasivam > make 64*1bad5e14SManivannan Sadhasivam > make u-boot.itb 65*1bad5e14SManivannan Sadhasivam 66*1bad5e14SManivannan SadhasivamCompile the rkdeveloptool 67*1bad5e14SManivannan Sadhasivam========================= 68*1bad5e14SManivannan Sadhasivam 69*1bad5e14SManivannan SadhasivamFollow instructions in latest README 70*1bad5e14SManivannan Sadhasivam > cd ../rkdeveloptool 71*1bad5e14SManivannan Sadhasivam > autoreconf -i 72*1bad5e14SManivannan Sadhasivam > ./configure 73*1bad5e14SManivannan Sadhasivam > make 74*1bad5e14SManivannan Sadhasivam > sudo make install 75*1bad5e14SManivannan Sadhasivam 76*1bad5e14SManivannan SadhasivamPackage the image 77*1bad5e14SManivannan Sadhasivam================= 78*1bad5e14SManivannan Sadhasivam 79*1bad5e14SManivannan SadhasivamPackage the image for U-Boot SPL(option 1) 80*1bad5e14SManivannan Sadhasivam-------------------------------- 81*1bad5e14SManivannan Sadhasivam > cd .. 82*1bad5e14SManivannan Sadhasivam > tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl.bin idbspl.img 83*1bad5e14SManivannan Sadhasivam 84*1bad5e14SManivannan Sadhasivam Get idbspl.img in this step. 85*1bad5e14SManivannan Sadhasivam 86*1bad5e14SManivannan SadhasivamPackage the image for Rockchip miniloader(option 2) 87*1bad5e14SManivannan Sadhasivam------------------------------------------ 88*1bad5e14SManivannan Sadhasivam > cd ../rkbin 89*1bad5e14SManivannan Sadhasivam > ./tools/loaderimage --pack --uboot u-boot/u-boot-dtb.bin uboot.img 0x200000 90*1bad5e14SManivannan Sadhasivam 91*1bad5e14SManivannan Sadhasivam > ../u-boot/tools/mkimage -n rk3399 -T rksd -d rk3399_ddr_933MHz_v1.08.bin idbloader.img 92*1bad5e14SManivannan Sadhasivam > cat ./rk33/rk3399_miniloader_v1.06.bin >> idbloader.img 93*1bad5e14SManivannan Sadhasivam 94*1bad5e14SManivannan Sadhasivam Get uboot.img and idbloader.img in this step. 95*1bad5e14SManivannan Sadhasivam 96*1bad5e14SManivannan SadhasivamBootloader storage options 97*1bad5e14SManivannan Sadhasivam========================== 98*1bad5e14SManivannan Sadhasivam 99*1bad5e14SManivannan SadhasivamThere are a few different storage options for the bootloader. 100*1bad5e14SManivannan SadhasivamThis document explores two of these: eMMC and removable SD/MMC. 101*1bad5e14SManivannan Sadhasivam 102*1bad5e14SManivannan SadhasivamFlash the image to eMMC 103*1bad5e14SManivannan Sadhasivam======================= 104*1bad5e14SManivannan Sadhasivam 105*1bad5e14SManivannan SadhasivamFlash the image with U-Boot SPL(option 1) 106*1bad5e14SManivannan Sadhasivam------------------------------- 107*1bad5e14SManivannan SadhasivamPower on(or reset with RESET KEY) with MASKROM KEY preesed, and then: 108*1bad5e14SManivannan Sadhasivam > rkdeveloptool db rkbin/rk33/rk3399_loader_v1.08.106.bin 109*1bad5e14SManivannan Sadhasivam > rkdeveloptool wl 64 u-boot/idbspl.img 110*1bad5e14SManivannan Sadhasivam > rkdeveloptool wl 0x4000 u-boot/u-boot.itb 111*1bad5e14SManivannan Sadhasivam > rkdeveloptool rd 112*1bad5e14SManivannan Sadhasivam 113*1bad5e14SManivannan SadhasivamFlash the image with Rockchip miniloader(option 2) 114*1bad5e14SManivannan Sadhasivam---------------------------------------- 115*1bad5e14SManivannan SadhasivamPower on(or reset with RESET KEY) with MASKROM KEY preesed, and then: 116*1bad5e14SManivannan Sadhasivam > rkdeveloptool db rkbin/rk33/rk3399_loader_v1.08.106.bin 117*1bad5e14SManivannan Sadhasivam > rkdeveloptool wl 0x40 idbloader.img 118*1bad5e14SManivannan Sadhasivam > rkdeveloptool wl 0x4000 uboot.img 119*1bad5e14SManivannan Sadhasivam > rkdeveloptool wl 0x6000 ./img/rk3399/trust.img 120*1bad5e14SManivannan Sadhasivam > rkdeveloptool rd 121*1bad5e14SManivannan Sadhasivam 122*1bad5e14SManivannan SadhasivamCreate a bootable SD/MMC 123*1bad5e14SManivannan Sadhasivam======================== 124*1bad5e14SManivannan Sadhasivam 125*1bad5e14SManivannan SadhasivamThe idbspl.img contains the first stage, and the u-boot.img the second stage. 126*1bad5e14SManivannan SadhasivamAs explained in the Rockchip partition table reference [1], the first stage 127*1bad5e14SManivannan Sadhasivam(aka loader1) start sector is 64, and the second stage start sector is 16384. 128*1bad5e14SManivannan Sadhasivam 129*1bad5e14SManivannan SadhasivamEach sector is 512 bytes, which means the first stage offset is 32 KiB, 130*1bad5e14SManivannan Sadhasivamand the second stage offset is 8 MiB. 131*1bad5e14SManivannan Sadhasivam 132*1bad5e14SManivannan SadhasivamNote: the second stage location is actually not as per the spec, 133*1bad5e14SManivannan Sadhasivambut defined by the SPL. Mainline SPL defines an 8 MiB offset for the second 134*1bad5e14SManivannan Sadhasivamstage. 135*1bad5e14SManivannan Sadhasivam 136*1bad5e14SManivannan SadhasivamAssuming the SD card is exposed by device /dev/mmcblk0, the commands 137*1bad5e14SManivannan Sadhasivamto write the two stages are: 138*1bad5e14SManivannan Sadhasivam 139*1bad5e14SManivannan Sadhasivam > dd if=idbspl.img of=/dev/mmcblk0 bs=1k seek=32 140*1bad5e14SManivannan Sadhasivam > dd if=u-boot.itb of=/dev/mmcblk0 bs=1k seek=8192 141*1bad5e14SManivannan Sadhasivam 142*1bad5e14SManivannan SadhasivamSetting up the kernel and rootfs is beyond the scope of this document. 143*1bad5e14SManivannan Sadhasivam 144*1bad5e14SManivannan SadhasivamAnd that is it 145*1bad5e14SManivannan Sadhasivam============== 146*1bad5e14SManivannan Sadhasivam 147*1bad5e14SManivannan SadhasivamYou should be able to get U-Boot log in console/UART2(baurdrate 1500000) 148*1bad5e14SManivannan Sadhasivam 149*1bad5e14SManivannan SadhasivamFor more detail, please reference [2]. 150*1bad5e14SManivannan Sadhasivam 151*1bad5e14SManivannan Sadhasivam[1] http://opensource.rock-chips.com/wiki_Partitions 152*1bad5e14SManivannan Sadhasivam[2] http://opensource.rock-chips.com/wiki_Boot_option 153