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