Merge branch '2022-03-25-assorted-updates' into next
[platform/kernel/u-boot.git] / doc / board / amlogic / odroid-n2.rst
1 .. SPDX-License-Identifier: GPL-2.0+
2
3 U-Boot for ODROID-N2
4 ====================
5
6 ODROID-N2 is a single board computer manufactured by Hardkernel
7 Co. Ltd with the following specifications:
8
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
18 Schematics are available on the manufacturer website.
19
20 U-Boot compilation
21 ------------------
22
23 .. code-block:: bash
24
25     $ export CROSS_COMPILE=aarch64-none-elf-
26     $ make odroid-n2_defconfig
27     $ make
28
29 Image creation
30 --------------
31
32 Amlogic doesn't provide sources for the firmware and for tools needed
33 to create the bootloader image, so it is necessary to obtain them from
34 the git tree published by the board vendor:
35
36 .. code-block:: bash
37
38     $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
39     $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
40     $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
41     $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
42     $ 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
43
44     $ DIR=odroid-n2
45     $ git clone --depth 1 \
46        https://github.com/hardkernel/u-boot.git -b odroidn2-v2015.01 \
47        $DIR
48
49     $ cd odroid-n2
50     $ make odroidn2_defconfig
51     $ make
52     $ export UBOOTDIR=$PWD
53
54  Go back to mainline U-Boot source tree then :
55
56 .. code-block:: bash
57
58     $ mkdir fip
59
60     $ wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
61     $ cp $UBOOTDIR/build/scp_task/bl301.bin fip/
62     $ cp $UBOOTDIR/build/board/hardkernel/odroidn2/firmware/acs.bin fip/
63     $ cp $UBOOTDIR/fip/g12b/bl2.bin fip/
64     $ cp $UBOOTDIR/fip/g12b/bl30.bin fip/
65     $ cp $UBOOTDIR/fip/g12b/bl31.img fip/
66     $ cp $UBOOTDIR/fip/g12b/ddr3_1d.fw fip/
67     $ cp $UBOOTDIR/fip/g12b/ddr4_1d.fw fip/
68     $ cp $UBOOTDIR/fip/g12b/ddr4_2d.fw fip/
69     $ cp $UBOOTDIR/fip/g12b/diag_lpddr4.fw fip/
70     $ cp $UBOOTDIR/fip/g12b/lpddr4_1d.fw fip/
71     $ cp $UBOOTDIR/fip/g12b/lpddr4_2d.fw fip/
72     $ cp $UBOOTDIR/fip/g12b/piei.fw fip/
73     $ cp $UBOOTDIR/fip/g12b/aml_ddr.fw fip/
74     $ cp u-boot.bin fip/bl33.bin
75
76     $ sh fip/blx_fix.sh \
77         fip/bl30.bin \
78         fip/zero_tmp \
79         fip/bl30_zero.bin \
80         fip/bl301.bin \
81         fip/bl301_zero.bin \
82         fip/bl30_new.bin \
83         bl30
84
85     $ sh fip/blx_fix.sh \
86         fip/bl2.bin \
87         fip/zero_tmp \
88         fip/bl2_zero.bin \
89         fip/acs.bin \
90         fip/bl21_zero.bin \
91         fip/bl2_new.bin \
92         bl2
93
94     $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
95                                         --output fip/bl30_new.bin.g12a.enc \
96                                         --level v3
97     $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
98                                         --output fip/bl30_new.bin.enc \
99                                         --level v3 --type bl30
100     $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
101                                         --output fip/bl31.img.enc \
102                                         --level v3 --type bl31
103     $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
104                                         --output fip/bl33.bin.enc \
105                                         --level v3 --type bl33 --compress lz4
106     $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
107                                         --output fip/bl2.n.bin.sig
108     $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bootmk \
109                 --output fip/u-boot.bin \
110                 --bl2 fip/bl2.n.bin.sig \
111                 --bl30 fip/bl30_new.bin.enc \
112                 --bl31 fip/bl31.img.enc \
113                 --bl33 fip/bl33.bin.enc \
114                 --ddrfw1 fip/ddr4_1d.fw \
115                 --ddrfw2 fip/ddr4_2d.fw \
116                 --ddrfw3 fip/ddr3_1d.fw \
117                 --ddrfw4 fip/piei.fw \
118                 --ddrfw5 fip/lpddr4_1d.fw \
119                 --ddrfw6 fip/lpddr4_2d.fw \
120                 --ddrfw7 fip/diag_lpddr4.fw \
121                 --ddrfw8 fip/aml_ddr.fw \
122                 --level v3
123
124 and then write the image to SD with:
125
126 .. code-block:: bash
127
128     $ DEV=/dev/your_sd_device
129     $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
130     $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444