blob: b512c6a3d83d0ef0ddbcd30c9761eeee5b5ca680 [file] [log] [blame]
Christian Hewitt91772f02020-04-24 03:09:12 +00001.. SPDX-License-Identifier: GPL-2.0+
2
3U-Boot for ODROID-C4
4====================
5
6ODROID-C4 is a single board computer manufactured by Hardkernel
7Co. Ltd with the following specifications:
8
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
Neil Armstrongae9466a2021-09-17 09:37:07 +020020The ODROID-HC4 is a variant with a PCIe-SATA controller, the same commands
21applies for HC4.
22
Christian Hewitt91772f02020-04-24 03:09:12 +000023Schematics are available on the manufacturer website.
24
25U-Boot compilation
26------------------
27
28.. code-block:: bash
29
30 $ export CROSS_COMPILE=aarch64-none-elf-
31 $ make odroid-c4_defconfig
32 $ make
33
34Image creation
35--------------
36
Neil Armstrong2ea98682022-03-02 10:42:22 +010037For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename `odroid-c4` or `odroid-hc4`
38
Christian Hewitt91772f02020-04-24 03:09:12 +000039Amlogic doesn't provide sources for the firmware and for tools needed
40to create the bootloader image, so it is necessary to obtain them from
41the git tree published by the board vendor:
42
43.. code-block:: bash
44
45 $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
46 $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
47 $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
48 $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
49 $ 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
50
51 $ DIR=odroid-c4
52 $ git clone --depth 1 \
53 https://github.com/hardkernel/u-boot.git -b odroidg12-v2015.01 \
54 $DIR
55
56 $ cd odroid-c4
57 $ make odroidc4_defconfig
58 $ make
59 $ export UBOOTDIR=$PWD
60
61Go back to mainline U-Boot source tree then :
62
63.. code-block:: bash
64
65 $ mkdir fip
66
67 $ wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
68 $ cp $UBOOTDIR/build/scp_task/bl301.bin fip/
69 $ cp $UBOOTDIR/build/board/hardkernel/odroidc4/firmware/acs.bin fip/
70 $ cp $UBOOTDIR/fip/g12a/bl2.bin fip/
71 $ cp $UBOOTDIR/fip/g12a/bl30.bin fip/
72 $ cp $UBOOTDIR/fip/g12a/bl31.img fip/
73 $ cp $UBOOTDIR/fip/g12a/ddr3_1d.fw fip/
74 $ cp $UBOOTDIR/fip/g12a/ddr4_1d.fw fip/
75 $ cp $UBOOTDIR/fip/g12a/ddr4_2d.fw fip/
76 $ cp $UBOOTDIR/fip/g12a/diag_lpddr4.fw fip/
77 $ cp $UBOOTDIR/fip/g12a/lpddr3_1d.fw fip/
78 $ cp $UBOOTDIR/fip/g12a/lpddr4_1d.fw fip/
79 $ cp $UBOOTDIR/fip/g12a/lpddr4_2d.fw fip/
80 $ cp $UBOOTDIR/fip/g12a/piei.fw fip/
81 $ cp $UBOOTDIR/fip/g12a/aml_ddr.fw fip/
82 $ cp u-boot.bin fip/bl33.bin
83
84 $ sh fip/blx_fix.sh \
85 fip/bl30.bin \
86 fip/zero_tmp \
87 fip/bl30_zero.bin \
88 fip/bl301.bin \
89 fip/bl301_zero.bin \
90 fip/bl30_new.bin \
91 bl30
92
93 $ sh fip/blx_fix.sh \
94 fip/bl2.bin \
95 fip/zero_tmp \
96 fip/bl2_zero.bin \
97 fip/acs.bin \
98 fip/bl21_zero.bin \
99 fip/bl2_new.bin \
100 bl2
101
102 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
103 --output fip/bl30_new.bin.g12a.enc \
104 --level v3
105 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc \
106 --output fip/bl30_new.bin.enc \
107 --level v3 --type bl30
108 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
109 --output fip/bl31.img.enc \
110 --level v3 --type bl31
111 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress lz4 \
112 --output fip/bl33.bin.enc \
113 --level v3 --type bl33 --compress lz4
114 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
115 --output fip/bl2.n.bin.sig
116 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bootmk \
117 --output fip/u-boot.bin \
118 --bl2 fip/bl2.n.bin.sig \
119 --bl30 fip/bl30_new.bin.enc \
120 --bl31 fip/bl31.img.enc \
121 --bl33 fip/bl33.bin.enc \
122 --ddrfw1 fip/ddr4_1d.fw \
123 --ddrfw2 fip/ddr4_2d.fw \
124 --ddrfw3 fip/ddr3_1d.fw \
125 --ddrfw4 fip/piei.fw \
126 --ddrfw5 fip/lpddr4_1d.fw \
127 --ddrfw6 fip/lpddr4_2d.fw \
128 --ddrfw7 fip/diag_lpddr4.fw \
129 --ddrfw8 fip/aml_ddr.fw \
130 --ddrfw9 fip/lpddr3_1d.fw \
131 --level v3
132
133and then write the image to SD with:
134
135.. code-block:: bash
136
137 $ DEV=/dev/your_sd_device
138 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
139 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444