blob: 205e7c38fa31163127a9ece17cdc663653458591 [file] [log] [blame]
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02001.. SPDX-License-Identifier: GPL-2.0+
2
Christian Hewitt83fffca2023-03-20 11:46:00 +00003U-Boot for Amlogic S400 (A113X)
4===============================
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02005
Christian Hewitt83fffca2023-03-20 11:46:00 +00006S400 is a reference board manufactured by Amlogic with the following specifications:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02007
Christian Hewitt83fffca2023-03-20 11:46:00 +00008 - Amlogic A113X ARM Cortex-A53 quad-core SoC @ 1.2GHz
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02009 - 1GB DDR4 SDRAM
10 - 10/100 Ethernet
Christian Hewitt83fffca2023-03-20 11:46:00 +000011 - 2x USB 2.0 Host
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020012 - eMMC
13 - Infrared receiver
14 - SDIO WiFi Module
15 - MIPI DSI Connector
16 - Audio HAT Connector
17 - PCI-E M.2 Connectors
18
19Schematics are available from Amlogic on demand.
20
Christian Hewitt83fffca2023-03-20 11:46:00 +000021U-Boot Compilation
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020022------------------
23
24.. code-block:: bash
25
26 $ export CROSS_COMPILE=aarch64-none-elf-
27 $ make s400_defconfig
28 $ make
29
Christian Hewitt83fffca2023-03-20 11:46:00 +000030U-Boot Signing with Pre-Built FIP repo
31--------------------------------------
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020032
Christian Hewitt83fffca2023-03-20 11:46:00 +000033.. 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
40U-Boot Manual Signing
41---------------------
Neil Armstrong2ea98682022-03-02 10:42:22 +010042
Christian Hewitt83fffca2023-03-20 11:46:00 +000043Amlogic does not provide sources for the firmware and tools needed to create a bootloader
44image but sources have been shared by Linux development contractor, Baylibre:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020045
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 Simek50fa1182023-05-17 09:17:16 +020059Go back to mainline U-Boot source tree then :
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020060
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 Hewitt83fffca2023-03-20 11:46:00 +000074 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 Armstrong84e5e8e2020-06-11 10:53:49 +020081
82 $ $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
83
84 $ $FIPDIR/blx_fix.sh \
Christian Hewitt83fffca2023-03-20 11:46:00 +000085 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 Armstrong84e5e8e2020-06-11 10:53:49 +020092
93 $ $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl30_new.bin \
Christian Hewitt83fffca2023-03-20 11:46:00 +000094 --output fip/bl30_new.bin.enc \
95 --level v3 --type bl30
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020096 $ $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl31.img \
Christian Hewitt83fffca2023-03-20 11:46:00 +000097 --output fip/bl31.img.enc \
98 --level v3 --type bl31
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020099 $ $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl33.bin --compress lz4 \
Christian Hewitt83fffca2023-03-20 11:46:00 +0000100 --output fip/bl33.bin.enc \
101 --level v3 --type bl33
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200102 $ $FIPDIR/axg/aml_encrypt_axg --bl2sig --input fip/bl2_new.bin \
Christian Hewitt83fffca2023-03-20 11:46:00 +0000103 --output fip/bl2.n.bin.sig
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200104 $ $FIPDIR/axg/aml_encrypt_axg --bootmk \
Christian Hewitt83fffca2023-03-20 11:46:00 +0000105 --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 Armstrong84e5e8e2020-06-11 10:53:49 +0200110
Christian Hewitt83fffca2023-03-20 11:46:00 +0000111Then write U-Boot to SD or eMMC with:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200112
113.. code-block:: bash
114
Christian Hewitt83fffca2023-03-20 11:46:00 +0000115 $ DEV=/dev/boot_device
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200116 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
Christian Hewitt83fffca2023-03-20 11:46:00 +0000117 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440