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