Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 3 | U-Boot for LibreTech-AC 'LaFrite' (S805X) |
| 4 | ========================================= |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 5 | |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 6 | LibreTech-AC aka 'LaFrite' is a Single Board Computer manufactured by Libre Computer |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 7 | with the following specifications: |
| 8 | |
| 9 | - Amlogic S805X ARM Cortex-A53 quad-core SoC @ 1.2GHz |
| 10 | - ARM Mali 450 GPU |
| 11 | - 512MiB DDR4 SDRAM |
| 12 | - 10/100 Ethernet |
| 13 | - HDMI 2.0 4K/60Hz display |
| 14 | - 40-pin GPIO header |
| 15 | - 4 x USB 2.0 Host |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 16 | - SPI NOR Flash |
| 17 | - Removable eMMC module |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 18 | - Infrared receiver |
| 19 | |
| 20 | Schematics are available on the manufacturer website. |
| 21 | |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 22 | U-Boot Compilation |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 23 | ------------------ |
| 24 | |
| 25 | .. code-block:: bash |
| 26 | |
| 27 | $ export CROSS_COMPILE=aarch64-none-elf- |
| 28 | $ make libretech-ac_defconfig |
| 29 | $ make |
| 30 | |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 31 | U-Boot Signing with Pre-Built FIP repo |
| 32 | -------------------------------------- |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 33 | |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 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 lafrite /path/to/u-boot/u-boot.bin my-output-dir |
| 40 | |
| 41 | U-Boot Manual Signing |
| 42 | --------------------- |
Neil Armstrong | 2ea9868 | 2022-03-02 10:42:22 +0100 | [diff] [blame] | 43 | |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +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: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [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 | $ git clone https://github.com/BayLibre/u-boot.git -b libretech-ac amlogic-u-boot |
| 55 | $ cd amlogic-u-boot |
| 56 | $ wget https://raw.githubusercontent.com/BayLibre/u-boot/libretech-cc/fip/blx_fix.sh |
| 57 | $ make libretech_ac_defconfig |
| 58 | $ make |
| 59 | $ export UBOOTDIR=$PWD |
| 60 | |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 61 | Download the latest Amlogic buildroot package and extract it: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 62 | |
| 63 | .. code-block:: bash |
| 64 | |
| 65 | $ wget http://openlinux2.amlogic.com:8000/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_fbdev_20180418.tar.gz |
| 66 | $ tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180418.tar.gz buildroot_openlinux_kernel_4.9_fbdev_20180418/bootloader |
| 67 | $ export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180418 |
| 68 | |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 69 | Go back to the mainline U-Boot source tree then: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 70 | |
| 71 | .. code-block:: bash |
| 72 | |
| 73 | $ mkdir fip |
| 74 | |
| 75 | $ cp $UBOOTDIR/build/scp_task/bl301.bin fip/ |
| 76 | $ cp $UBOOTDIR/build/board/amlogic/libretech_ac/firmware/bl21.bin fip/ |
| 77 | $ cp $UBOOTDIR/build/board/amlogic/libretech_ac/firmware/acs.bin fip/ |
| 78 | $ cp $BRDIR/bootloader/uboot-repo/bl2/bin/gxl/bl2.bin fip/ |
| 79 | $ cp $BRDIR/bootloader/uboot-repo/bl30/bin/gxl/bl30.bin fip/ |
| 80 | $ cp $BRDIR/bootloader/uboot-repo/bl31/bin/gxl/bl31.img fip/ |
| 81 | $ cp u-boot.bin fip/bl33.bin |
| 82 | |
| 83 | $ sh $UBOOTDIR/blx_fix.sh \ |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 84 | fip/bl30.bin \ |
| 85 | fip/zero_tmp \ |
| 86 | fip/bl30_zero.bin \ |
| 87 | fip/bl301.bin \ |
| 88 | fip/bl301_zero.bin \ |
| 89 | fip/bl30_new.bin \ |
| 90 | bl30 |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 91 | |
| 92 | $ $BRDIR/bootloader/uboot-repo/fip/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0 |
| 93 | |
| 94 | $ sh $UBOOTDIR/blx_fix.sh \ |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 95 | fip/bl2_acs.bin \ |
| 96 | fip/zero_tmp \ |
| 97 | fip/bl2_zero.bin \ |
| 98 | fip/bl21.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 | $ $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin |
| 104 | $ $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img |
| 105 | $ $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin |
| 106 | $ $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output fip/bl2.n.bin.sig |
| 107 | $ $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bootmk \ |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 108 | --output fip/u-boot.bin \ |
| 109 | --bl2 fip/bl2.n.bin.sig \ |
| 110 | --bl30 fip/bl30_new.bin.enc \ |
| 111 | --bl31 fip/bl31.img.enc \ |
| 112 | --bl33 fip/bl33.bin.enc |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 113 | |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 114 | Then write U-Boot to USB or SPI-NOR with: |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 115 | |
| 116 | .. code-block:: bash |
| 117 | |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 118 | $ DEV=/dev/boot_device |
Neil Armstrong | 84e5e8e | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 119 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 |
Christian Hewitt | df70eb2 | 2023-03-20 11:45:48 +0000 | [diff] [blame] | 120 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440 |