blob: 28aae98d990f606220bb336655079c477daab62a [file] [log] [blame]
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02001.. SPDX-License-Identifier: GPL-2.0+
2
Christian Hewitt1ad259b2023-03-20 11:45:57 +00003U-Boot for Amlogic P201 (S905)
4==============================
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02005
Christian Hewitt1ad259b2023-03-20 11:45:57 +00006P201 is a reference board manufactured by Amlogic with the following specifications:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02007
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 Hewitt1ad259b2023-03-20 11:45:57 +000013 - 2x USB 2.0 Host
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020014 - eMMC, microSD
15 - Infrared receiver
16 - SDIO WiFi Module
Christian Hewitt1ad259b2023-03-20 11:45:57 +000017 - CVBS + Stereo Audio Jack
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020018
19Schematics are available from Amlogic on demand.
20
Christian Hewitt1ad259b2023-03-20 11:45:57 +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 p201_defconfig
28 $ make
29
Christian Hewitt1ad259b2023-03-20 11:45:57 +000030U-Boot Signing with Pre-Built FIP repo
31--------------------------------------
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020032
Christian Hewitt1ad259b2023-03-20 11:45:57 +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 p201 /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 Hewitt1ad259b2023-03-20 11:45:57 +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 gxb_p201_v1_defconfig
56 $ make
57 $ export FIPDIR=$PWD/fip
58
59Go back to mainline U-boot source tree then :
60
61.. code-block:: bash
62
63 $ mkdir fip
64
Neil Armstrong6784f4f2022-03-02 10:42:21 +010065 $ 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 Armstrong84e5e8e2020-06-11 10:53:49 +020071 $ cp u-boot.bin fip/bl33.bin
Christian Hewitt1ad259b2023-03-20 11:45:57 +000072 $ 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 Armstrong84e5e8e2020-06-11 10:53:49 +020076
77 $ $FIPDIR/blx_fix.sh \
Christian Hewitt1ad259b2023-03-20 11:45:57 +000078 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 Armstrong84e5e8e2020-06-11 10:53:49 +020085
Neil Armstrong6784f4f2022-03-02 10:42:21 +010086 $ python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020087
88 $ $FIPDIR/blx_fix.sh \
Christian Hewitt1ad259b2023-03-20 11:45:57 +000089 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 Armstrong6784f4f2022-03-02 10:42:21 +010096
Christian Hewitt1ad259b2023-03-20 11:45:57 +000097 $ $FIPDIR/fip_create --bl30 fip/bl30_new.bin \
98 --bl31 fip/bl31.img \
99 --bl33 fip/bl33.bin \
100 fip/fip.bin
Neil Armstrong6784f4f2022-03-02 10:42:21 +0100101
102 $ cat fip/bl2_new.bin fip/fip.bin >fip/boot_new.bin
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200103
Christian Hewitt1ad259b2023-03-20 11:45:57 +0000104 $ $FIPDIR/gxb/aml_encrypt_gxb --bootsig \
105 --input fip/boot_new.bin \
106 --output fip/u-boot.bin
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200107
Christian Hewitt1ad259b2023-03-20 11:45:57 +0000108Then write U-Boot to SD or eMMC with:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200109
110.. code-block:: bash
111
Christian Hewitt1ad259b2023-03-20 11:45:57 +0000112 $ 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