1.. SPDX-License-Identifier: GPL-2.0+
2
3U-Boot for Radxa Zero2 (A311D)
4==============================
5
6Radxa Zero2 is a small form factor SBC based on the Amlogic A311D chipset with the
7following specification:
8
9- Amlogic A311D (Quad A73 + Dual A53) CPU
10- 4GB LPDDR4 RAM
11- 32/64/128GB eMMC
12- Mali G52-MP4 GPU
13- HDMI 2.1 output (micro)
14- BCM4345 WiFi (2.4/5GHz a/b/g/n/ac) and BT 5.0
15- 1x USB 2.0 port - Type C (OTG)
16- 1x USB 3.0 port - Type C (Host)
17- 1x micro SD Card slot
18- 40 Pin GPIO header
19
20Schematics are available on request from Radxa.
21
22U-Boot Compilation
23------------------
24
25.. code-block:: bash
26
27    $ export CROSS_COMPILE=aarch64-none-elf-
28    $ make radxa-zero2_defconfig
29    $ make
30
31U-Boot Signing with Pre-Built FIP repo
32--------------------------------------
33
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 radxa-zero2 /path/to/u-boot/u-boot.bin my-output-dir
40
41U-Boot Manual Signing
42---------------------
43
44Amlogic does not provide sources for the firmware and tools needed to create a bootloader
45image so it is necessary to obtain binaries from sources published by the board vendor:
46
47.. code-block:: bash
48
49    $ git clone -b radxa-zero-v2021.07 https://github.com/radxa/u-boot.git
50    $ git clone https://github.com/radxa/fip.git
51
52    $ sudo apt-get install -y gcc-aarch64-linux-gnu device-tree-compiler libncurses5 libncurses5-dev
53    $ sudo apt-get install -y bc python dosfstools flex build-essential libssl-dev mtools
54
55    $ wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
56    $ sudo tar xvf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz -C /opt
57
58    $ export CROSS_COMPILE=/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-
59    $ export ARCH=arm
60    $ cd u-boot
61    $ make radxa-zero2_defconfig
62    $ make
63
64    $ cp u-boot.bin ../fip/radxa-zero2/bl33.bin
65    $ cd ../fip/radxa-zero2
66    $ make
67
68This will generate the signed U-Boot binaries:
69
70.. code-block:: bash
71
72    $ u-boot.bin u-boot.bin.sd.bin u-boot.bin.usb.bl2 u-boot.bin.usb.tpl
73
74Then write U-Boot to SD or eMMC with:
75
76.. code-block:: bash
77
78    $ DEV=/dev/boot_device
79    $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
80    $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
81