Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 3 | U-Boot for Amlogic SEI510 (S905X2) |
| 4 | ================================== |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 5 | |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 6 | SEI510 is a customer board manufactured by SEI Robotics with the following specification: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 7 | |
| 8 | - Amlogic S905X2 ARM Cortex-A53 quad-core SoC |
| 9 | - 2GB DDR4 SDRAM |
| 10 | - 10/100 Ethernet (Internal PHY) |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 11 | - 1x USB 3.0 Host |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 12 | - eMMC |
| 13 | - SDcard |
| 14 | - Infrared receiver |
| 15 | - SDIO WiFi Module |
| 16 | |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 17 | U-Boot Compilation |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 18 | ------------------ |
| 19 | |
| 20 | .. code-block:: bash |
| 21 | |
| 22 | $ export CROSS_COMPILE=aarch64-none-elf- |
| 23 | $ make sei510_defconfig |
| 24 | $ make |
| 25 | |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 26 | U-Boot Signing with Pre-Built FIP repo |
| 27 | -------------------------------------- |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 28 | |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 29 | .. code-block:: bash |
| 30 | |
| 31 | $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1 |
| 32 | $ cd amlogic-boot-fip |
| 33 | $ mkdir my-output-dir |
| 34 | $ ./build-fip.sh sei510 /path/to/u-boot/u-boot.bin my-output-dir |
| 35 | |
| 36 | U-Boot Manual Signing |
| 37 | --------------------- |
Neil Armstrong | 2ea9868 | 2022-03-02 10:42:22 +0100 | [diff] [blame] | 38 | |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 39 | Amlogic does not provide sources for the firmware and tools needed to create a bootloader |
| 40 | 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] | 41 | |
| 42 | .. code-block:: bash |
| 43 | |
| 44 | $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz |
| 45 | $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz |
| 46 | $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz |
| 47 | $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz |
| 48 | $ 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 |
| 49 | $ git clone https://github.com/BayLibre/u-boot.git -b buildroot-openlinux-20180418 amlogic-u-boot |
| 50 | $ cd amlogic-u-boot |
| 51 | $ make g12a_u200_v1_defconfig |
| 52 | $ make |
| 53 | $ export UBOOTDIR=$PWD |
| 54 | |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 55 | Download the latest Amlogic Buildroot package and extract it: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 56 | |
| 57 | .. code-block:: bash |
| 58 | |
| 59 | $ wget http://openlinux2.amlogic.com:8000/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz |
| 60 | $ tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz buildroot_openlinux_kernel_4.9_fbdev_20180706/bootloader |
| 61 | $ export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706 |
| 62 | $ export FIPDIR=$BRDIR/bootloader/uboot-repo/fip |
| 63 | |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +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/amlogic/g12a_u200_v1/firmware/acs.bin fip/ |
| 73 | $ cp $BRDIR/bootloader/uboot-repo/bl2/bin/g12a/bl2.bin fip/ |
| 74 | $ cp $BRDIR/bootloader/uboot-repo/bl30/bin/g12a/bl30.bin fip/ |
| 75 | $ cp $BRDIR/bootloader/uboot-repo/bl31_1.3/bin/g12a/bl31.img fip/ |
| 76 | $ cp $FIPDIR/g12a/ddr3_1d.fw fip/ |
| 77 | $ cp $FIPDIR/g12a/ddr4_1d.fw fip/ |
| 78 | $ cp $FIPDIR/g12a/ddr4_2d.fw fip/ |
| 79 | $ cp $FIPDIR/g12a/diag_lpddr4.fw fip/ |
| 80 | $ cp $FIPDIR/g12a/lpddr4_1d.fw fip/ |
| 81 | $ cp $FIPDIR/g12a/lpddr4_2d.fw fip/ |
| 82 | $ cp $FIPDIR/g12a/piei.fw fip/ |
| 83 | $ cp u-boot.bin fip/bl33.bin |
| 84 | |
| 85 | $ sh fip/blx_fix.sh \ |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 86 | fip/bl30.bin \ |
| 87 | fip/zero_tmp \ |
| 88 | fip/bl30_zero.bin \ |
| 89 | fip/bl301.bin \ |
| 90 | fip/bl301_zero.bin \ |
| 91 | fip/bl30_new.bin \ |
| 92 | bl30 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 93 | |
| 94 | $ sh fip/blx_fix.sh \ |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 95 | fip/bl2.bin \ |
| 96 | fip/zero_tmp \ |
| 97 | fip/bl2_zero.bin \ |
| 98 | fip/acs.bin \ |
| 99 | fip/bl21_zero.bin \ |
| 100 | fip/bl2_new.bin \ |
| 101 | bl2 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 102 | |
| 103 | $ $FIPDIR/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \ |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 104 | --output fip/bl30_new.bin.g12a.enc \ |
| 105 | --level v3 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 106 | $ $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc \ |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 107 | --output fip/bl30_new.bin.enc \ |
| 108 | --level v3 --type bl30 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 109 | $ $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \ |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 110 | --output fip/bl31.img.enc \ |
| 111 | --level v3 --type bl31 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 112 | $ $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress lz4 \ |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 113 | --output fip/bl33.bin.enc \ |
| 114 | --level v3 --type bl33 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 115 | $ $FIPDIR/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \ |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 116 | --output fip/bl2.n.bin.sig |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 117 | $ $FIPDIR/g12a/aml_encrypt_g12a --bootmk \ |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 118 | --output fip/u-boot.bin \ |
| 119 | --bl2 fip/bl2.n.bin.sig \ |
| 120 | --bl30 fip/bl30_new.bin.enc \ |
| 121 | --bl31 fip/bl31.img.enc \ |
| 122 | --bl33 fip/bl33.bin.enc \ |
| 123 | --ddrfw1 fip/ddr4_1d.fw \ |
| 124 | --ddrfw2 fip/ddr4_2d.fw \ |
| 125 | --ddrfw3 fip/ddr3_1d.fw \ |
| 126 | --ddrfw4 fip/piei.fw \ |
| 127 | --ddrfw5 fip/lpddr4_1d.fw \ |
| 128 | --ddrfw6 fip/lpddr4_2d.fw \ |
| 129 | --ddrfw7 fip/diag_lpddr4.fw \ |
| 130 | --level v3 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 131 | |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 132 | Then write U-Boot to SD or eMMC with: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 133 | |
| 134 | .. code-block:: bash |
| 135 | |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 136 | $ DEV=/dev/boot_device |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 137 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 |
Christian Hewitt | 076361e | 2023-03-20 11:46:01 +0000 | [diff] [blame] | 138 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440 |