Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 3 | U-Boot for Amlogic S400 (A113X) |
| 4 | =============================== |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 5 | |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 6 | S400 is a reference board manufactured by Amlogic with the following specifications: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 7 | |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 8 | - Amlogic A113X ARM Cortex-A53 quad-core SoC @ 1.2GHz |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 9 | - 1GB DDR4 SDRAM |
| 10 | - 10/100 Ethernet |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 11 | - 2x USB 2.0 Host |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 12 | - eMMC |
| 13 | - Infrared receiver |
| 14 | - SDIO WiFi Module |
| 15 | - MIPI DSI Connector |
| 16 | - Audio HAT Connector |
| 17 | - PCI-E M.2 Connectors |
| 18 | |
| 19 | Schematics are available from Amlogic on demand. |
| 20 | |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 21 | U-Boot Compilation |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 22 | ------------------ |
| 23 | |
| 24 | .. code-block:: bash |
| 25 | |
| 26 | $ export CROSS_COMPILE=aarch64-none-elf- |
| 27 | $ make s400_defconfig |
| 28 | $ make |
| 29 | |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 30 | U-Boot Signing with Pre-Built FIP repo |
| 31 | -------------------------------------- |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 32 | |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 33 | .. code-block:: bash |
| 34 | |
| 35 | $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1 |
| 36 | $ cd amlogic-boot-fip |
| 37 | $ mkdir my-output-dir |
| 38 | $ ./build-fip.sh s400 /path/to/u-boot/u-boot.bin my-output-dir |
| 39 | |
| 40 | U-Boot Manual Signing |
| 41 | --------------------- |
Neil Armstrong | 2ea9868 | 2022-03-02 10:42:22 +0100 | [diff] [blame] | 42 | |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 43 | Amlogic does not provide sources for the firmware and tools needed to create a bootloader |
| 44 | image but sources have been shared by Linux development contractor, Baylibre: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 45 | |
| 46 | .. code-block:: bash |
| 47 | |
| 48 | $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz |
| 49 | $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz |
| 50 | $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz |
| 51 | $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz |
| 52 | $ 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 |
| 53 | $ git clone https://github.com/BayLibre/u-boot.git -b n-amlogic-openlinux-20170606 amlogic-u-boot |
| 54 | $ cd amlogic-u-boot |
| 55 | $ make axg_s400_v1_defconfig |
| 56 | $ make |
| 57 | $ export FIPDIR=$PWD/fip |
| 58 | |
Michal Simek | 50fa118 | 2023-05-17 09:17:16 +0200 | [diff] [blame] | 59 | Go back to mainline U-Boot source tree then : |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 60 | |
| 61 | .. code-block:: bash |
| 62 | |
| 63 | $ mkdir fip |
| 64 | |
| 65 | $ cp $FIPDIR/axg/bl2.bin fip/ |
| 66 | $ cp $FIPDIR/axg/acs.bin fip/ |
| 67 | $ cp $FIPDIR/axg/bl21.bin fip/ |
| 68 | $ cp $FIPDIR/axg/bl30.bin fip/ |
| 69 | $ cp $FIPDIR/axg/bl301.bin fip/ |
| 70 | $ cp $FIPDIR/axg/bl31.img fip/ |
| 71 | $ cp u-boot.bin fip/bl33.bin |
| 72 | |
| 73 | $ $FIPDIR/blx_fix.sh \ |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 74 | fip/bl30.bin \ |
| 75 | fip/zero_tmp \ |
| 76 | fip/bl30_zero.bin \ |
| 77 | fip/bl301.bin \ |
| 78 | fip/bl301_zero.bin \ |
| 79 | fip/bl30_new.bin \ |
| 80 | bl30 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 81 | |
| 82 | $ $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0 |
| 83 | |
| 84 | $ $FIPDIR/blx_fix.sh \ |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 85 | fip/bl2_acs.bin \ |
| 86 | fip/zero_tmp \ |
| 87 | fip/bl2_zero.bin \ |
| 88 | fip/bl21.bin \ |
| 89 | fip/bl21_zero.bin \ |
| 90 | fip/bl2_new.bin \ |
| 91 | bl2 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 92 | |
| 93 | $ $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl30_new.bin \ |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 94 | --output fip/bl30_new.bin.enc \ |
| 95 | --level v3 --type bl30 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 96 | $ $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl31.img \ |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 97 | --output fip/bl31.img.enc \ |
| 98 | --level v3 --type bl31 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 99 | $ $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl33.bin --compress lz4 \ |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 100 | --output fip/bl33.bin.enc \ |
| 101 | --level v3 --type bl33 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 102 | $ $FIPDIR/axg/aml_encrypt_axg --bl2sig --input fip/bl2_new.bin \ |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 103 | --output fip/bl2.n.bin.sig |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 104 | $ $FIPDIR/axg/aml_encrypt_axg --bootmk \ |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 105 | --output fip/u-boot.bin \ |
| 106 | --bl2 fip/bl2.n.bin.sig \ |
| 107 | --bl30 fip/bl30_new.bin.enc \ |
| 108 | --bl31 fip/bl31.img.enc \ |
| 109 | --bl33 fip/bl33.bin.enc --level v3 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 110 | |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 111 | Then write U-Boot to SD or eMMC with: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 112 | |
| 113 | .. code-block:: bash |
| 114 | |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 115 | $ DEV=/dev/boot_device |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 116 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 |
Christian Hewitt | 83fffca | 2023-03-20 11:46:00 +0000 | [diff] [blame] | 117 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440 |