blob: 6994b958cf8c2323c4fcc4e5a3880814c3836561 [file] [log] [blame]
Christian Hewitt8888d832020-04-24 03:09:12 +00001.. SPDX-License-Identifier: GPL-2.0+
2
Christian Hewitt1fd9a522023-03-20 11:45:52 +00003U-Boot for ODROID-C4 (S905X3)
4=============================
Christian Hewitt8888d832020-04-24 03:09:12 +00005
Christian Hewitt1fd9a522023-03-20 11:45:52 +00006ODROID-C4 is a Single Board Computer manufactured by Hardkernel with the following
7specifications:
Christian Hewitt8888d832020-04-24 03:09:12 +00008
9 - Amlogic S905X3 Arm Cortex-A55 quad-core SoC
10 - 4GB DDR4 SDRAM
11 - Gigabit Ethernet
12 - HDMI 2.1 display
13 - 40-pin GPIO header
14 - 4x USB 3.0 Host
15 - 1x USB 2.0 Host/OTG (micro)
16 - eMMC, microSD
17 - UART serial
18 - Infrared receiver
19
Christian Hewitt8888d832020-04-24 03:09:12 +000020Schematics are available on the manufacturer website.
21
Christian Hewitt1fd9a522023-03-20 11:45:52 +000022U-Boot Compilation
Christian Hewitt8888d832020-04-24 03:09:12 +000023------------------
24
25.. code-block:: bash
26
27 $ export CROSS_COMPILE=aarch64-none-elf-
28 $ make odroid-c4_defconfig
29 $ make
30
Christian Hewitt1fd9a522023-03-20 11:45:52 +000031U-Boot Signing with Pre-Built FIP repo
32--------------------------------------
Christian Hewitt8888d832020-04-24 03:09:12 +000033
Christian Hewitt1fd9a522023-03-20 11:45:52 +000034.. code-block:: bash
Neil Armstrong4c605122022-03-02 10:42:22 +010035
Christian Hewitt1fd9a522023-03-20 11:45:52 +000036 $ 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 odroid-c4 /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:
Christian Hewitt8888d832020-04-24 03:09:12 +000046
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
55 $ DIR=odroid-c4
56 $ git clone --depth 1 \
57 https://github.com/hardkernel/u-boot.git -b odroidg12-v2015.01 \
58 $DIR
59
60 $ cd odroid-c4
61 $ make odroidc4_defconfig
62 $ make
63 $ export UBOOTDIR=$PWD
64
Christian Hewitt1fd9a522023-03-20 11:45:52 +000065Go back to the mainline U-Boot source tree then:
Christian Hewitt8888d832020-04-24 03:09:12 +000066
67.. code-block:: bash
68
69 $ mkdir fip
70
71 $ wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
72 $ cp $UBOOTDIR/build/scp_task/bl301.bin fip/
73 $ cp $UBOOTDIR/build/board/hardkernel/odroidc4/firmware/acs.bin fip/
74 $ cp $UBOOTDIR/fip/g12a/bl2.bin fip/
75 $ cp $UBOOTDIR/fip/g12a/bl30.bin fip/
76 $ cp $UBOOTDIR/fip/g12a/bl31.img fip/
77 $ cp $UBOOTDIR/fip/g12a/ddr3_1d.fw fip/
78 $ cp $UBOOTDIR/fip/g12a/ddr4_1d.fw fip/
79 $ cp $UBOOTDIR/fip/g12a/ddr4_2d.fw fip/
80 $ cp $UBOOTDIR/fip/g12a/diag_lpddr4.fw fip/
81 $ cp $UBOOTDIR/fip/g12a/lpddr3_1d.fw fip/
82 $ cp $UBOOTDIR/fip/g12a/lpddr4_1d.fw fip/
83 $ cp $UBOOTDIR/fip/g12a/lpddr4_2d.fw fip/
84 $ cp $UBOOTDIR/fip/g12a/piei.fw fip/
85 $ cp $UBOOTDIR/fip/g12a/aml_ddr.fw fip/
86 $ cp u-boot.bin fip/bl33.bin
87
88 $ sh fip/blx_fix.sh \
Christian Hewitt1fd9a522023-03-20 11:45:52 +000089 fip/bl30.bin \
90 fip/zero_tmp \
91 fip/bl30_zero.bin \
92 fip/bl301.bin \
93 fip/bl301_zero.bin \
94 fip/bl30_new.bin \
95 bl30
Christian Hewitt8888d832020-04-24 03:09:12 +000096
97 $ sh fip/blx_fix.sh \
Christian Hewitt1fd9a522023-03-20 11:45:52 +000098 fip/bl2.bin \
99 fip/zero_tmp \
100 fip/bl2_zero.bin \
101 fip/acs.bin \
102 fip/bl21_zero.bin \
103 fip/bl2_new.bin \
104 bl2
Christian Hewitt8888d832020-04-24 03:09:12 +0000105
106 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
Christian Hewitt1fd9a522023-03-20 11:45:52 +0000107 --output fip/bl30_new.bin.g12a.enc \
108 --level v3
Christian Hewitt8888d832020-04-24 03:09:12 +0000109 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc \
Christian Hewitt1fd9a522023-03-20 11:45:52 +0000110 --output fip/bl30_new.bin.enc \
111 --level v3 --type bl30
Christian Hewitt8888d832020-04-24 03:09:12 +0000112 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
Christian Hewitt1fd9a522023-03-20 11:45:52 +0000113 --output fip/bl31.img.enc \
114 --level v3 --type bl31
Christian Hewitt8888d832020-04-24 03:09:12 +0000115 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress lz4 \
Christian Hewitt1fd9a522023-03-20 11:45:52 +0000116 --output fip/bl33.bin.enc \
117 --level v3 --type bl33 --compress lz4
Christian Hewitt8888d832020-04-24 03:09:12 +0000118 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
Christian Hewitt1fd9a522023-03-20 11:45:52 +0000119 --output fip/bl2.n.bin.sig
Christian Hewitt8888d832020-04-24 03:09:12 +0000120 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bootmk \
Christian Hewitt1fd9a522023-03-20 11:45:52 +0000121 --output fip/u-boot.bin \
122 --bl2 fip/bl2.n.bin.sig \
123 --bl30 fip/bl30_new.bin.enc \
124 --bl31 fip/bl31.img.enc \
125 --bl33 fip/bl33.bin.enc \
126 --ddrfw1 fip/ddr4_1d.fw \
127 --ddrfw2 fip/ddr4_2d.fw \
128 --ddrfw3 fip/ddr3_1d.fw \
129 --ddrfw4 fip/piei.fw \
130 --ddrfw5 fip/lpddr4_1d.fw \
131 --ddrfw6 fip/lpddr4_2d.fw \
132 --ddrfw7 fip/diag_lpddr4.fw \
133 --ddrfw8 fip/aml_ddr.fw \
134 --ddrfw9 fip/lpddr3_1d.fw \
135 --level v3
Christian Hewitt8888d832020-04-24 03:09:12 +0000136
Christian Hewitt1fd9a522023-03-20 11:45:52 +0000137Then write the image to SD or eMMC with:
Christian Hewitt8888d832020-04-24 03:09:12 +0000138
139.. code-block:: bash
140
Christian Hewitt1fd9a522023-03-20 11:45:52 +0000141 $ DEV=/dev/boot_device
Christian Hewitt8888d832020-04-24 03:09:12 +0000142 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
Christian Hewitt1fd9a522023-03-20 11:45:52 +0000143 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440