blob: d2a8107b58c75d9b474acf50aecdc1f253d8c339 [file] [log] [blame]
Neil Armstrong0ce36392020-06-11 10:53:49 +02001.. SPDX-License-Identifier: GPL-2.0+
2
Christian Hewittfeacbb12023-03-20 11:46:04 +00003U-Boot for Amlogic W400 (S922X)
4===============================
Neil Armstrong0ce36392020-06-11 10:53:49 +02005
Christian Hewittfeacbb12023-03-20 11:46:04 +00006W400 is a reference board manufactured by Amlogic with the following specification:
Neil Armstrong0ce36392020-06-11 10:53:49 +02007
8 - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
9 - 2GB DDR4 SDRAM
10 - 10/100 Ethernet (Internal PHY)
Christian Hewittfeacbb12023-03-20 11:46:04 +000011 - 1x USB 3.0 Host
Neil Armstrong0ce36392020-06-11 10:53:49 +020012 - eMMC
13 - SDcard
14 - Infrared receiver
15 - SDIO WiFi Module
16 - MIPI DSI Connector
17 - Audio HAT Connector
18 - PCI-E M.2 Connector
19
20Schematics are available from Amlogic on demand.
21
Christian Hewittfeacbb12023-03-20 11:46:04 +000022U-Boot Compilation
Neil Armstrong0ce36392020-06-11 10:53:49 +020023------------------
24
25.. code-block:: bash
26
27 $ export CROSS_COMPILE=aarch64-none-elf-
28 $ make w400_defconfig
29 $ make
30
Christian Hewittfeacbb12023-03-20 11:46:04 +000031U-Boot Signing with Pre-Built FIP repo
32--------------------------------------
Neil Armstrong0ce36392020-06-11 10:53:49 +020033
Christian Hewittfeacbb12023-03-20 11:46:04 +000034.. 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 jethub-j100 /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:
Neil Armstrong0ce36392020-06-11 10:53:49 +020046
47.. code-block:: bash
48
49 $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
50 $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
51 $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
52 $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
53 $ 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
54 $ git clone https://github.com/BayLibre/u-boot.git -b buildroot-openlinux-20180418 amlogic-u-boot
55 $ cd amlogic-u-boot
56 $ make g12b_w400_v1_defconfig
57 $ make
58 $ export UBOOTDIR=$PWD
59
Christian Hewittfeacbb12023-03-20 11:46:04 +000060Download the latest Amlogic buildroot package and extract it:
Neil Armstrong0ce36392020-06-11 10:53:49 +020061
62.. code-block:: bash
63
64 $ wget http://openlinux2.amlogic.com:8000/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz
65 $ tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz buildroot_openlinux_kernel_4.9_fbdev_20180706/bootloader
66 $ export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706
67 $ export FIPDIR=$BRDIR/bootloader/uboot-repo/fip
68
Christian Hewittfeacbb12023-03-20 11:46:04 +000069Go back to the mainline U-Boot source tree then:
Neil Armstrong0ce36392020-06-11 10:53:49 +020070
71.. code-block:: bash
72
73 $ mkdir fip
74
75 $ wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
76 $ cp $UBOOTDIR/build/scp_task/bl301.bin fip/
77 $ cp $UBOOTDIR/build/board/amlogic/g12b_w400_v1/firmware/acs.bin fip/
78 $ cp $BRDIR/bootloader/uboot-repo/bl2/bin/g12b/bl2.bin fip/
79 $ cp $BRDIR/bootloader/uboot-repo/bl30/bin/g12b/bl30.bin fip/
80 $ cp $BRDIR/bootloader/uboot-repo/bl31_1.3/bin/g12b/bl31.img fip/
81 $ cp $FIPDIR/g12b/ddr3_1d.fw fip/
82 $ cp $FIPDIR/g12b/ddr4_1d.fw fip/
83 $ cp $FIPDIR/g12b/ddr4_2d.fw fip/
84 $ cp $FIPDIR/g12b/diag_lpddr4.fw fip/
85 $ cp $FIPDIR/g12b/lpddr4_1d.fw fip/
86 $ cp $FIPDIR/g12b/lpddr4_2d.fw fip/
87 $ cp $FIPDIR/g12b/piei.fw fip/
88 $ cp $FIPDIR/g12b/aml_ddr.fw fip/
89 $ cp u-boot.bin fip/bl33.bin
90
91 $ sh fip/blx_fix.sh \
Christian Hewittfeacbb12023-03-20 11:46:04 +000092 fip/bl30.bin \
93 fip/zero_tmp \
94 fip/bl30_zero.bin \
95 fip/bl301.bin \
96 fip/bl301_zero.bin \
97 fip/bl30_new.bin \
98 bl30
Neil Armstrong0ce36392020-06-11 10:53:49 +020099
100 $ sh fip/blx_fix.sh \
Christian Hewittfeacbb12023-03-20 11:46:04 +0000101 fip/bl2.bin \
102 fip/zero_tmp \
103 fip/bl2_zero.bin \
104 fip/acs.bin \
105 fip/bl21_zero.bin \
106 fip/bl2_new.bin \
107 bl2
Neil Armstrong0ce36392020-06-11 10:53:49 +0200108
109 $ $FIPDIR/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
Christian Hewittfeacbb12023-03-20 11:46:04 +0000110 --output fip/bl30_new.bin.g12a.enc \
111 --level v3
Neil Armstrong0ce36392020-06-11 10:53:49 +0200112 $ $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
Christian Hewittfeacbb12023-03-20 11:46:04 +0000113 --output fip/bl30_new.bin.enc \
114 --level v3 --type bl30
Neil Armstrong0ce36392020-06-11 10:53:49 +0200115 $ $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
Christian Hewittfeacbb12023-03-20 11:46:04 +0000116 --output fip/bl31.img.enc \
117 --level v3 --type bl31
Neil Armstrong0ce36392020-06-11 10:53:49 +0200118 $ $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
Christian Hewittfeacbb12023-03-20 11:46:04 +0000119 --output fip/bl33.bin.enc \
120 --level v3 --type bl33
Neil Armstrong0ce36392020-06-11 10:53:49 +0200121 $ $FIPDIR/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
Christian Hewittfeacbb12023-03-20 11:46:04 +0000122 --output fip/bl2.n.bin.sig
Neil Armstrong0ce36392020-06-11 10:53:49 +0200123 $ $FIPDIR/g12b/aml_encrypt_g12b --bootmk \
Christian Hewittfeacbb12023-03-20 11:46:04 +0000124 --output fip/u-boot.bin \
125 --bl2 fip/bl2.n.bin.sig \
126 --bl30 fip/bl30_new.bin.enc \
127 --bl31 fip/bl31.img.enc \
128 --bl33 fip/bl33.bin.enc \
129 --ddrfw1 fip/ddr4_1d.fw \
130 --ddrfw2 fip/ddr4_2d.fw \
131 --ddrfw3 fip/ddr3_1d.fw \
132 --ddrfw4 fip/piei.fw \
133 --ddrfw5 fip/lpddr4_1d.fw \
134 --ddrfw6 fip/lpddr4_2d.fw \
135 --ddrfw7 fip/diag_lpddr4.fw \
136 --ddrfw8 fip/aml_ddr.fw \
137 --level v3
Neil Armstrong0ce36392020-06-11 10:53:49 +0200138
Christian Hewittfeacbb12023-03-20 11:46:04 +0000139Then write U-Boot to SD or eMMC with:
Neil Armstrong0ce36392020-06-11 10:53:49 +0200140
141.. code-block:: bash
142
Christian Hewittfeacbb12023-03-20 11:46:04 +0000143 $ DEV=/dev/boot_device
Neil Armstrong0ce36392020-06-11 10:53:49 +0200144 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
Christian Hewittfeacbb12023-03-20 11:46:04 +0000145 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440