blob: 5222a21c8084d98f675018f0b9a60f5a38968a6f [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
Baltazár Radicsb93c2b42025-01-10 12:11:24 +010057 $ git clone --depth 1 https://github.com/hardkernel/u-boot.git -b odroidg12-v2015.01 odroidg12
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020058
Baltazár Radicsb93c2b42025-01-10 12:11:24 +010059 $ cd odroidg12
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020060 $ make odroidn2_defconfig
61 $ make
62 $ export UBOOTDIR=$PWD
63
Christian Hewittcf6dadc2023-03-20 11:45:54 +000064Go back to the mainline U-Boot source tree then:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020065
66.. code-block:: bash
67
68 $ mkdir fip
69
70 $ wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
71 $ cp $UBOOTDIR/build/scp_task/bl301.bin fip/
72 $ cp $UBOOTDIR/build/board/hardkernel/odroidn2/firmware/acs.bin fip/
73 $ cp $UBOOTDIR/fip/g12b/bl2.bin fip/
74 $ cp $UBOOTDIR/fip/g12b/bl30.bin fip/
75 $ cp $UBOOTDIR/fip/g12b/bl31.img fip/
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020076 $ cp $UBOOTDIR/fip/g12b/ddr4_1d.fw fip/
77 $ cp $UBOOTDIR/fip/g12b/ddr4_2d.fw fip/
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020078 $ cp $UBOOTDIR/fip/g12b/piei.fw fip/
79 $ cp $UBOOTDIR/fip/g12b/aml_ddr.fw fip/
80 $ cp u-boot.bin fip/bl33.bin
81
82 $ sh fip/blx_fix.sh \
Christian Hewittcf6dadc2023-03-20 11:45:54 +000083 fip/bl30.bin \
84 fip/zero_tmp \
85 fip/bl30_zero.bin \
86 fip/bl301.bin \
87 fip/bl301_zero.bin \
88 fip/bl30_new.bin \
89 bl30
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020090
91 $ sh fip/blx_fix.sh \
Christian Hewittcf6dadc2023-03-20 11:45:54 +000092 fip/bl2.bin \
93 fip/zero_tmp \
94 fip/bl2_zero.bin \
95 fip/acs.bin \
96 fip/bl21_zero.bin \
97 fip/bl2_new.bin \
98 bl2
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020099
100 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000101 --output fip/bl30_new.bin.g12a.enc \
102 --level v3
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200103 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000104 --output fip/bl30_new.bin.enc \
105 --level v3 --type bl30
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200106 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000107 --output fip/bl31.img.enc \
108 --level v3 --type bl31
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200109 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000110 --output fip/bl33.bin.enc \
Baltazár Radicsb93c2b42025-01-10 12:11:24 +0100111 --level v3 --type bl33
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200112 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000113 --output fip/bl2.n.bin.sig
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200114 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bootmk \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000115 --output fip/u-boot.bin \
116 --bl2 fip/bl2.n.bin.sig \
117 --bl30 fip/bl30_new.bin.enc \
118 --bl31 fip/bl31.img.enc \
119 --bl33 fip/bl33.bin.enc \
120 --ddrfw1 fip/ddr4_1d.fw \
121 --ddrfw2 fip/ddr4_2d.fw \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000122 --ddrfw4 fip/piei.fw \
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000123 --ddrfw8 fip/aml_ddr.fw \
124 --level v3
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200125
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000126Then write U-Boot to SD or eMMC with:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200127
128.. code-block:: bash
129
Christian Hewittcf6dadc2023-03-20 11:45:54 +0000130 $ DEV=/dev/boot_device
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200131 $ 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 +0000132 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440