Christian Hewitt | 8d5d623 | 2023-03-20 11:46:09 +0000 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
| 3 | U-Boot for ODROID-HC4 (S905X3) |
| 4 | ============================== |
| 5 | |
| 6 | ODROID-HC4 is a variant of the ODROID-C4 single board computer manufactured by Hardkernel |
| 7 | with the following specification: |
| 8 | |
| 9 | - Amlogic S905X3 Arm Cortex-A55 quad-core SoC |
| 10 | - 4GB DDR4 SDRAM |
| 11 | - 16MB XT25F128B SPI-NOR flash |
| 12 | - Gigabit Ethernet |
| 13 | - HDMI 2.1 display |
| 14 | - 7-pin GPIO header for OLED display and RTC |
| 15 | - 1x USB 2.0 host (micro) |
| 16 | - 2x SATA ports via ASM1061 PCIe to SATA controller |
| 17 | - microSD |
| 18 | - UART serial |
| 19 | - Infrared receiver |
| 20 | |
| 21 | Schematics are available on the manufacturer website. |
| 22 | |
| 23 | U-Boot Compilation |
| 24 | ------------------ |
| 25 | |
| 26 | .. code-block:: bash |
| 27 | |
| 28 | $ export CROSS_COMPILE=aarch64-none-elf- |
| 29 | $ make odroid-hc4_defconfig |
| 30 | $ make |
| 31 | |
| 32 | U-Boot Signing with Pre-Built FIP repo |
| 33 | -------------------------------------- |
| 34 | |
| 35 | .. code-block:: bash |
| 36 | |
| 37 | $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1 |
| 38 | $ cd amlogic-boot-fip |
| 39 | $ mkdir my-output-dir |
| 40 | $ ./build-fip.sh odroid-hc4 /path/to/u-boot/u-boot.bin my-output-dir |
| 41 | |
| 42 | U-Boot Manual Signing |
| 43 | --------------------- |
| 44 | |
| 45 | Amlogic does not provide sources for the firmware and tools needed to create a bootloader |
| 46 | image so it is necessary to obtain binaries from sources published by the board vendor: |
| 47 | |
| 48 | .. code-block:: bash |
| 49 | |
| 50 | $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz |
| 51 | $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz |
| 52 | $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz |
| 53 | $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz |
| 54 | $ export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH |
| 55 | |
| 56 | $ DIR=odroid-hc4 |
| 57 | $ git clone --depth 1 https://github.com/hardkernel/u-boot.git -b odroidg12-v2015.01 $DIR |
| 58 | |
| 59 | $ cd odroid-hc4 |
| 60 | $ make odroidc4_defconfig |
| 61 | $ make |
| 62 | $ export UBOOTDIR=$PWD |
| 63 | |
| 64 | Go back to mainline U-Boot source tree then: |
| 65 | |
| 66 | .. code-block:: bash |
| 67 | |
| 68 | $ mkdir fip |
| 69 | |
| 70 | $ wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh |
| 71 | $ cp $UBOOTDIR/build/scp_task/bl301.bin fip/ |
| 72 | $ cp $UBOOTDIR/build/board/hardkernel/odroidc4/firmware/acs.bin fip/ |
| 73 | $ cp $UBOOTDIR/fip/g12a/bl2.bin fip/ |
| 74 | $ cp $UBOOTDIR/fip/g12a/bl30.bin fip/ |
| 75 | $ cp $UBOOTDIR/fip/g12a/bl31.img fip/ |
| 76 | $ cp $UBOOTDIR/fip/g12a/ddr3_1d.fw fip/ |
| 77 | $ cp $UBOOTDIR/fip/g12a/ddr4_1d.fw fip/ |
| 78 | $ cp $UBOOTDIR/fip/g12a/ddr4_2d.fw fip/ |
| 79 | $ cp $UBOOTDIR/fip/g12a/diag_lpddr4.fw fip/ |
| 80 | $ cp $UBOOTDIR/fip/g12a/lpddr3_1d.fw fip/ |
| 81 | $ cp $UBOOTDIR/fip/g12a/lpddr4_1d.fw fip/ |
| 82 | $ cp $UBOOTDIR/fip/g12a/lpddr4_2d.fw fip/ |
| 83 | $ cp $UBOOTDIR/fip/g12a/piei.fw fip/ |
| 84 | $ cp $UBOOTDIR/fip/g12a/aml_ddr.fw fip/ |
| 85 | $ cp u-boot.bin fip/bl33.bin |
| 86 | |
| 87 | $ sh fip/blx_fix.sh \ |
| 88 | fip/bl30.bin \ |
| 89 | fip/zero_tmp \ |
| 90 | fip/bl30_zero.bin \ |
| 91 | fip/bl301.bin \ |
| 92 | fip/bl301_zero.bin \ |
| 93 | fip/bl30_new.bin \ |
| 94 | bl30 |
| 95 | |
| 96 | $ sh fip/blx_fix.sh \ |
| 97 | fip/bl2.bin \ |
| 98 | fip/zero_tmp \ |
| 99 | fip/bl2_zero.bin \ |
| 100 | fip/acs.bin \ |
| 101 | fip/bl21_zero.bin \ |
| 102 | fip/bl2_new.bin \ |
| 103 | bl2 |
| 104 | |
| 105 | $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \ |
| 106 | --output fip/bl30_new.bin.g12a.enc \ |
| 107 | --level v3 |
| 108 | $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc \ |
| 109 | --output fip/bl30_new.bin.enc \ |
| 110 | --level v3 --type bl30 |
| 111 | $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \ |
| 112 | --output fip/bl31.img.enc \ |
| 113 | --level v3 --type bl31 |
| 114 | $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress lz4 \ |
| 115 | --output fip/bl33.bin.enc \ |
| 116 | --level v3 --type bl33 --compress lz4 |
| 117 | $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \ |
| 118 | --output fip/bl2.n.bin.sig |
| 119 | $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bootmk \ |
| 120 | --output fip/u-boot.bin \ |
| 121 | --bl2 fip/bl2.n.bin.sig \ |
| 122 | --bl30 fip/bl30_new.bin.enc \ |
| 123 | --bl31 fip/bl31.img.enc \ |
| 124 | --bl33 fip/bl33.bin.enc \ |
| 125 | --ddrfw1 fip/ddr4_1d.fw \ |
| 126 | --ddrfw2 fip/ddr4_2d.fw \ |
| 127 | --ddrfw3 fip/ddr3_1d.fw \ |
| 128 | --ddrfw4 fip/piei.fw \ |
| 129 | --ddrfw5 fip/lpddr4_1d.fw \ |
| 130 | --ddrfw6 fip/lpddr4_2d.fw \ |
| 131 | --ddrfw7 fip/diag_lpddr4.fw \ |
| 132 | --ddrfw8 fip/aml_ddr.fw \ |
| 133 | --ddrfw9 fip/lpddr3_1d.fw \ |
| 134 | --level v3 |
| 135 | |
| 136 | Then write U-Boot to SD or SPI-NOR with: |
| 137 | |
| 138 | .. code-block:: bash |
| 139 | |
| 140 | $ DEV=/dev/boot_device |
| 141 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 |
| 142 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440 |