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