blob: f2e26cabf9083c451ffc825996a7345391a74ebe [file] [log] [blame]
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02001.. SPDX-License-Identifier: GPL-2.0+
2
3U-Boot for LibreTech CC
4=======================
5
6LibreTech CC is a single board computer manufactured by Libre Technology
7with the following specifications:
8
9 - Amlogic S905X ARM Cortex-A53 quad-core SoC @ 1.5GHz
10 - ARM Mali 450 GPU
11 - 2GB DDR3 SDRAM
12 - 10/100 Ethernet
13 - HDMI 2.0 4K/60Hz display
14 - 40-pin GPIO header
15 - 4 x USB 2.0 Host
16 - eMMC, microSD
17 - Infrared receiver
18
19Schematics are available on the manufacturer website.
20
21U-Boot compilation
22------------------
23
24.. code-block:: bash
25
26 $ export CROSS_COMPILE=aarch64-none-elf-
27 $ make libretech-cc_defconfig
28 $ make
29
30Image creation
31--------------
32
33To boot the system, u-boot must be combined with several earlier stage
34bootloaders:
35
36* bl2.bin: vendor-provided binary blob
37* bl21.bin: built from vendor u-boot source
38* bl30.bin: vendor-provided binary blob
39* bl301.bin: built from vendor u-boot source
40* bl31.bin: vendor-provided binary blob
41* acs.bin: built from vendor u-boot source
42
43These binaries and the tools required below have been collected and prebuilt
44for convenience at <https://github.com/BayLibre/u-boot/releases/>
45
46Download and extract the libretech-cc release from there, and set FIPDIR to
47point to the `fip` subdirectory.
48
49.. code-block:: bash
50
51 $ export FIPDIR=/path/to/extracted/fip
52
53Alternatively, you can obtain the original vendor u-boot tree which
54contains the required blobs and sources, and build yourself.
55Note that old compilers are required for this to build. The compilers here
56are suggested by Amlogic, and they are 32-bit x86 binaries.
57
58.. code-block:: bash
59
60 $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
61 $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
62 $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
63 $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
64 $ 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
65 $ git clone https://github.com/BayLibre/u-boot.git -b libretech-cc amlogic-u-boot
66 $ cd amlogic-u-boot
67 $ make libretech_cc_defconfig
68 $ make
69 $ export FIPDIR=$PWD/fip
70
71Once you have the binaries available (either through the prebuilt download,
72or having built the vendor u-boot yourself), you can then proceed to glue
73everything together. Go back to mainline U-Boot source tree then :
74
75.. code-block:: bash
76
77 $ mkdir fip
78
79 $ cp $FIPDIR/gxl/bl2.bin fip/
80 $ cp $FIPDIR/gxl/acs.bin fip/
81 $ cp $FIPDIR/gxl/bl21.bin fip/
82 $ cp $FIPDIR/gxl/bl30.bin fip/
83 $ cp $FIPDIR/gxl/bl301.bin fip/
84 $ cp $FIPDIR/gxl/bl31.img fip/
85 $ cp u-boot.bin fip/bl33.bin
86
87 $ $FIPDIR/blx_fix.sh \
88 fip/bl30.bin \
89 fip/zero_tmp \
90 fip/bl30_zero.bin \
91 fip/bl301.bin \
92 fip/bl301_zero.bin \
93 fip/bl30_new.bin \
94 bl30
95
96 $ $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
97
98 $ $FIPDIR/blx_fix.sh \
99 fip/bl2_acs.bin \
100 fip/zero_tmp \
101 fip/bl2_zero.bin \
102 fip/bl21.bin \
103 fip/bl21_zero.bin \
104 fip/bl2_new.bin \
105 bl2
106
107 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin
108 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img
109 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin
110 $ $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output fip/bl2.n.bin.sig
111 $ $FIPDIR/gxl/aml_encrypt_gxl --bootmk \
112 --output fip/u-boot.bin \
113 --bl2 fip/bl2.n.bin.sig \
114 --bl30 fip/bl30_new.bin.enc \
115 --bl31 fip/bl31.img.enc \
116 --bl33 fip/bl33.bin.enc
117
118and then write the image to SD with:
119
120.. code-block:: bash
121
122 $ DEV=/dev/your_sd_device
123 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
124 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
125
126Note that Amlogic provides aml_encrypt_gxl as a 32-bit x86 binary with no
127source code. Should you prefer to avoid that, there are open source reverse
128engineered versions available:
129
1301. gxlimg <https://github.com/repk/gxlimg>, which comes with a handy
131 Makefile that automates the whole process.
1322. meson-tools <https://github.com/afaerber/meson-tools>
133
134However, these community-developed alternatives are not endorsed by or
135supported by Amlogic.