Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 3 | U-Boot for ODROID-N2/N2+ (S922X) |
| 4 | ================================ |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 5 | |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 6 | ODROID-N2 and ODROID-N2+ are a Single Board Computers manufactured by Hardkernel with the |
| 7 | following specifications: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 8 | |
| 9 | - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC |
| 10 | - 4GB DDR4 SDRAM |
| 11 | - Gigabit Ethernet |
| 12 | - HDMI 2.1 4K/60Hz display |
| 13 | - 40-pin GPIO header |
| 14 | - 4 x USB 3.0 Host, 1 x USB OTG |
| 15 | - eMMC, microSD |
| 16 | - Infrared receiver |
| 17 | |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 18 | ODROID-N2+ uses Rev-C silicon allowing higher CPU opp-points. U-Boot contains logic to |
| 19 | read the model detail from SARADC and select the correct device-tree file if FDTDIR is |
| 20 | used instead of an FDT reference to a specfic device-tree. |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 21 | |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 22 | Schematics are available on the manufacturer website: https://wiki.odroid.com |
| 23 | |
| 24 | U-Boot Compilation |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 25 | ------------------ |
| 26 | |
| 27 | .. code-block:: bash |
| 28 | |
| 29 | $ export CROSS_COMPILE=aarch64-none-elf- |
| 30 | $ make odroid-n2_defconfig |
| 31 | $ make |
| 32 | |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 33 | U-Boot Signing with Pre-Built FIP repo |
| 34 | -------------------------------------- |
| 35 | |
| 36 | .. code-block:: bash |
| 37 | |
| 38 | $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1 |
| 39 | $ cd amlogic-boot-fip |
| 40 | $ mkdir my-output-dir |
| 41 | $ ./build-fip.sh odroid-n2 /path/to/u-boot/u-boot.bin my-output-dir |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 42 | |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 43 | U-Boot Manual Signing |
| 44 | --------------------- |
Neil Armstrong | 2ea9868 | 2022-03-02 10:42:22 +0100 | [diff] [blame] | 45 | |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 46 | Amlogic does not provide sources for the firmware and tools needed to create a bootloader |
| 47 | image so it is necessary to obtain binaries from sources published by the board vendor: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 48 | |
| 49 | .. code-block:: bash |
| 50 | |
| 51 | $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz |
| 52 | $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz |
| 53 | $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz |
| 54 | $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz |
| 55 | $ 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 |
| 56 | |
Baltazár Radics | b93c2b4 | 2025-01-10 12:11:24 +0100 | [diff] [blame^] | 57 | $ git clone --depth 1 https://github.com/hardkernel/u-boot.git -b odroidg12-v2015.01 odroidg12 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 58 | |
Baltazár Radics | b93c2b4 | 2025-01-10 12:11:24 +0100 | [diff] [blame^] | 59 | $ cd odroidg12 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 60 | $ make odroidn2_defconfig |
| 61 | $ make |
| 62 | $ export UBOOTDIR=$PWD |
| 63 | |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 64 | Go back to the mainline U-Boot source tree then: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 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/odroidn2/firmware/acs.bin fip/ |
| 73 | $ cp $UBOOTDIR/fip/g12b/bl2.bin fip/ |
| 74 | $ cp $UBOOTDIR/fip/g12b/bl30.bin fip/ |
| 75 | $ cp $UBOOTDIR/fip/g12b/bl31.img fip/ |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 76 | $ cp $UBOOTDIR/fip/g12b/ddr4_1d.fw fip/ |
| 77 | $ cp $UBOOTDIR/fip/g12b/ddr4_2d.fw fip/ |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 78 | $ cp $UBOOTDIR/fip/g12b/piei.fw fip/ |
| 79 | $ cp $UBOOTDIR/fip/g12b/aml_ddr.fw fip/ |
| 80 | $ cp u-boot.bin fip/bl33.bin |
| 81 | |
| 82 | $ sh fip/blx_fix.sh \ |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 83 | fip/bl30.bin \ |
| 84 | fip/zero_tmp \ |
| 85 | fip/bl30_zero.bin \ |
| 86 | fip/bl301.bin \ |
| 87 | fip/bl301_zero.bin \ |
| 88 | fip/bl30_new.bin \ |
| 89 | bl30 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 90 | |
| 91 | $ sh fip/blx_fix.sh \ |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 92 | fip/bl2.bin \ |
| 93 | fip/zero_tmp \ |
| 94 | fip/bl2_zero.bin \ |
| 95 | fip/acs.bin \ |
| 96 | fip/bl21_zero.bin \ |
| 97 | fip/bl2_new.bin \ |
| 98 | bl2 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 99 | |
| 100 | $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \ |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 101 | --output fip/bl30_new.bin.g12a.enc \ |
| 102 | --level v3 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 103 | $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \ |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 104 | --output fip/bl30_new.bin.enc \ |
| 105 | --level v3 --type bl30 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 106 | $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \ |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 107 | --output fip/bl31.img.enc \ |
| 108 | --level v3 --type bl31 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 109 | $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \ |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 110 | --output fip/bl33.bin.enc \ |
Baltazár Radics | b93c2b4 | 2025-01-10 12:11:24 +0100 | [diff] [blame^] | 111 | --level v3 --type bl33 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 112 | $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \ |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 113 | --output fip/bl2.n.bin.sig |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 114 | $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bootmk \ |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 115 | --output fip/u-boot.bin \ |
| 116 | --bl2 fip/bl2.n.bin.sig \ |
| 117 | --bl30 fip/bl30_new.bin.enc \ |
| 118 | --bl31 fip/bl31.img.enc \ |
| 119 | --bl33 fip/bl33.bin.enc \ |
| 120 | --ddrfw1 fip/ddr4_1d.fw \ |
| 121 | --ddrfw2 fip/ddr4_2d.fw \ |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 122 | --ddrfw4 fip/piei.fw \ |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 123 | --ddrfw8 fip/aml_ddr.fw \ |
| 124 | --level v3 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 125 | |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 126 | Then write U-Boot to SD or eMMC with: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 127 | |
| 128 | .. code-block:: bash |
| 129 | |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 130 | $ DEV=/dev/boot_device |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 131 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 |
Christian Hewitt | cf6dadc | 2023-03-20 11:45:54 +0000 | [diff] [blame] | 132 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440 |