Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 3 | U-Boot for Amlogic P201 (S905) |
| 4 | ============================== |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 5 | |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 6 | P201 is a reference board manufactured by Amlogic with the following specifications: |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 7 | |
| 8 | - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 1.5GHz |
| 9 | - ARM Mali 450 GPU |
| 10 | - 2GB DDR3 SDRAM |
| 11 | - 10/100 Ethernet |
| 12 | - HDMI 2.0 4K/60Hz display |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 13 | - 2x USB 2.0 Host |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 14 | - eMMC, microSD |
| 15 | - Infrared receiver |
| 16 | - SDIO WiFi Module |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 17 | - CVBS + Stereo Audio Jack |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 18 | |
| 19 | Schematics are available from Amlogic on demand. |
| 20 | |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 21 | U-Boot Compilation |
Neil Armstrong | 0ce3639 | 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 p201_defconfig |
| 28 | $ make |
| 29 | |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 30 | U-Boot Signing with Pre-Built FIP repo |
| 31 | -------------------------------------- |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 32 | |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 33 | .. code-block:: bash |
Neil Armstrong | 4c60512 | 2022-03-02 10:42:22 +0100 | [diff] [blame] | 34 | |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 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 p201 /path/to/u-boot/u-boot.bin my-output-dir |
| 39 | |
| 40 | U-Boot Manual Signing |
| 41 | --------------------- |
| 42 | |
| 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 | 0ce3639 | 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 gxb_p201_v1_defconfig |
| 56 | $ make |
| 57 | $ export FIPDIR=$PWD/fip |
| 58 | |
Michal Simek | 1be82af | 2023-05-17 09:17:16 +0200 | [diff] [blame] | 59 | Go back to mainline U-Boot source tree then : |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 60 | |
| 61 | .. code-block:: bash |
| 62 | |
| 63 | $ mkdir fip |
| 64 | |
Neil Armstrong | 23f20ef | 2022-03-02 10:42:21 +0100 | [diff] [blame] | 65 | $ cp $FIPDIR/gxb/bl2.bin fip/ |
| 66 | $ cp $FIPDIR/gxb/acs.bin fip/ |
| 67 | $ cp $FIPDIR/gxb/bl21.bin fip/ |
| 68 | $ cp $FIPDIR/gxb/bl30.bin fip/ |
| 69 | $ cp $FIPDIR/gxb/bl301.bin fip/ |
| 70 | $ cp $FIPDIR/gxb/bl31.img fip/ |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 71 | $ cp u-boot.bin fip/bl33.bin |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 72 | $ wget https://github.com/LibreELEC/amlogic-boot-fip/raw/master/nanopi-k2/bl1.bin.hardkernel fip/bl1.bin.hardkernel |
| 73 | $ chmod +x fip/bl1.bin.hardkernel |
| 74 | $ wget https://github.com/LibreELEC/amlogic-boot-fip/raw/master/nanopi-k2/aml_chksum fip/aml_chksum |
| 75 | $ chmod +x fip/aml_chksum |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 76 | |
| 77 | $ $FIPDIR/blx_fix.sh \ |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 78 | fip/bl30.bin \ |
| 79 | fip/zero_tmp \ |
| 80 | fip/bl30_zero.bin \ |
| 81 | fip/bl301.bin \ |
| 82 | fip/bl301_zero.bin \ |
| 83 | fip/bl30_new.bin \ |
| 84 | bl30 |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 85 | |
Neil Armstrong | 23f20ef | 2022-03-02 10:42:21 +0100 | [diff] [blame] | 86 | $ python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0 |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 87 | |
| 88 | $ $FIPDIR/blx_fix.sh \ |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 89 | fip/bl2_acs.bin \ |
| 90 | fip/zero_tmp \ |
| 91 | fip/bl2_zero.bin \ |
| 92 | fip/bl21.bin \ |
| 93 | fip/bl21_zero.bin \ |
| 94 | fip/bl2_new.bin \ |
| 95 | bl2 |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 96 | |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 97 | $ $FIPDIR/fip_create --bl30 fip/bl30_new.bin \ |
| 98 | --bl31 fip/bl31.img \ |
| 99 | --bl33 fip/bl33.bin \ |
| 100 | fip/fip.bin |
Neil Armstrong | 23f20ef | 2022-03-02 10:42:21 +0100 | [diff] [blame] | 101 | |
| 102 | $ cat fip/bl2_new.bin fip/fip.bin >fip/boot_new.bin |
| 103 | |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 104 | $ $FIPDIR/gxb/aml_encrypt_gxb --bootsig \ |
| 105 | --input fip/boot_new.bin \ |
| 106 | --output fip/u-boot.bin |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 107 | |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 108 | Then write U-Boot to SD or eMMC with: |
Neil Armstrong | 0ce3639 | 2020-06-11 10:53:49 +0200 | [diff] [blame] | 109 | |
| 110 | .. code-block:: bash |
| 111 | |
Christian Hewitt | 80d83f6 | 2023-03-20 11:45:57 +0000 | [diff] [blame] | 112 | $ DEV=/dev/boot_device |
| 113 | $ dd if=fip/u-boot.bin of=fip/u-boot.bin.gxbb bs=512 conv=fsync |
| 114 | $ dd if=fip/u-boot.bin of=fip/u-boot.bin.gxbb bs=512 seek=9 skip=8 count=87 conv=fsync,notrunc |
| 115 | $ dd if=/dev/zero of=fip/u-boot.bin.gxbb bs=512 seek=8 count=1 conv=fsync,notrunc |
| 116 | $ dd if=bl1.bin.hardkernel of=fip/u-boot.bin.gxbb bs=512 seek=2 skip=2 count=1 conv=fsync,notrunc |
| 117 | $ ./aml_chksum fip/u-boot.bin.gxbb |
| 118 | $ dd if=fip/u-boot.gxbb of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 |
| 119 | $ dd if=fip/u-boot.gxbb of=$DEV conv=fsync,notrunc bs=1 count=440 |