blob: 883720f8fbf6ff658eaa15c001add74597d12125 [file] [log] [blame]
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02001.. SPDX-License-Identifier: GPL-2.0+
2
Christian Hewittcf6dadc2023-03-20 11:45:54 +00003U-Boot for ODROID-N2/N2+ (S922X)
4================================
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02005
Christian Hewittcf6dadc2023-03-20 11:45:54 +00006ODROID-N2 and ODROID-N2+ are a Single Board Computers manufactured by Hardkernel with the
7following specifications:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02008
9 - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
10 - 4GB DDR4 SDRAM
11 - Gigabit Ethernet
12 - HDMI 2.1 4K/60Hz display
13 - 40-pin GPIO header
14 - 4 x USB 3.0 Host, 1 x USB OTG
15 - eMMC, microSD
16 - Infrared receiver
17
Christian Hewittcf6dadc2023-03-20 11:45:54 +000018ODROID-N2+ uses Rev-C silicon allowing higher CPU opp-points. U-Boot contains logic to
19read the model detail from SARADC and select the correct device-tree file if FDTDIR is
20used instead of an FDT reference to a specfic device-tree.
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020021
Christian Hewittcf6dadc2023-03-20 11:45:54 +000022Schematics are available on the manufacturer website: https://wiki.odroid.com
23
24U-Boot Compilation
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020025------------------
26
27.. code-block:: bash
28
29 $ export CROSS_COMPILE=aarch64-none-elf-
30 $ make odroid-n2_defconfig
31 $ make
32
Christian Hewittcf6dadc2023-03-20 11:45:54 +000033U-Boot Signing with Pre-Built FIP repo
34--------------------------------------
35
36.. code-block:: bash
37
38 $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
39 $ cd amlogic-boot-fip
40 $ mkdir my-output-dir
41 $ ./build-fip.sh odroid-n2 /path/to/u-boot/u-boot.bin my-output-dir
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020042
Christian Hewittcf6dadc2023-03-20 11:45:54 +000043U-Boot Manual Signing
44---------------------
Neil Armstrong2ea98682022-03-02 10:42:22 +010045
Christian Hewittcf6dadc2023-03-20 11:45:54 +000046Amlogic does not provide sources for the firmware and tools needed to create a bootloader
47image so it is necessary to obtain binaries from sources published by the board vendor:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020048
49.. code-block:: bash
50
51 $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
52 $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
53 $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
54 $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
55 $ 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
56
57 $ DIR=odroid-n2
Christian Hewittcf6dadc2023-03-20 11:45:54 +000058 $ git clone --depth 1 https://github.com/hardkernel/u-boot.git -b odroidn2-v2015.01 $DIR
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020059
60 $ cd odroid-n2
61 $ make odroidn2_defconfig
62 $ make
63 $ export UBOOTDIR=$PWD
64
Christian Hewittcf6dadc2023-03-20 11:45:54 +000065Go back to the mainline U-Boot source tree then:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020066
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/odroidn2/firmware/acs.bin fip/
74 $ cp $UBOOTDIR/fip/g12b/bl2.bin fip/
75 $ cp $UBOOTDIR/fip/g12b/bl30.bin fip/
76 $ cp $UBOOTDIR/fip/g12b/bl31.img fip/
77 $ cp $UBOOTDIR/fip/g12b/ddr3_1d.fw fip/
78 $ cp $UBOOTDIR/fip/g12b/ddr4_1d.fw fip/
79 $ cp $UBOOTDIR/fip/g12b/ddr4_2d.fw fip/
80 $ cp $UBOOTDIR/fip/g12b/diag_lpddr4.fw fip/
81 $ cp $UBOOTDIR/fip/g12b/lpddr4_1d.fw fip/
82 $ cp $UBOOTDIR/fip/g12b/lpddr4_2d.fw fip/
83 $ cp $UBOOTDIR/fip/g12b/piei.fw fip/
84 $ cp $UBOOTDIR/fip/g12b/aml_ddr.fw fip/
85 $ cp u-boot.bin fip/bl33.bin
86
87 $ sh fip/blx_fix.sh \
Christian Hewittcf6dadc2023-03-20 11:45:54 +000088 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
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020095
96 $ sh fip/blx_fix.sh \
Christian Hewittcf6dadc2023-03-20 11:45:54 +000097 fip/bl2.bin \
98 fip/zero_tmp \
99 fip/bl2_zero.bin \
100 fip/acs.bin \
101 fip/bl21_zero.bin \
102 fip/bl2_new.bin \
103 bl2
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200104
105 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000106 --output fip/bl30_new.bin.g12a.enc \
107 --level v3
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200108 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000109 --output fip/bl30_new.bin.enc \
110 --level v3 --type bl30
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200111 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000112 --output fip/bl31.img.enc \
113 --level v3 --type bl31
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200114 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000115 --output fip/bl33.bin.enc \
116 --level v3 --type bl33 --compress lz4
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200117 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000118 --output fip/bl2.n.bin.sig
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200119 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bootmk \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000120 --output fip/u-boot.bin \
121 --bl2 fip/bl2.n.bin.sig \
122 --bl30 fip/bl30_new.bin.enc \
123 --bl31 fip/bl31.img.enc \
124 --bl33 fip/bl33.bin.enc \
125 --ddrfw1 fip/ddr4_1d.fw \
126 --ddrfw2 fip/ddr4_2d.fw \
127 --ddrfw3 fip/ddr3_1d.fw \
128 --ddrfw4 fip/piei.fw \
129 --ddrfw5 fip/lpddr4_1d.fw \
130 --ddrfw6 fip/lpddr4_2d.fw \
131 --ddrfw7 fip/diag_lpddr4.fw \
132 --ddrfw8 fip/aml_ddr.fw \
133 --level v3
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200134
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000135Then write U-Boot to SD or eMMC with:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200136
137.. code-block:: bash
138
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000139 $ DEV=/dev/boot_device
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200140 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000141 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440