blob: b380c174560f60e5801295d6af7f849e9a347240 [file] [log] [blame]
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02001.. SPDX-License-Identifier: GPL-2.0+
2
3U-Boot for Khadas VIM3L
4=======================
5
6Khadas VIM3L is a single board computer manufactured by Shenzhen Wesion
7Technology Co., Ltd. with the following specifications:
8
9 - Amlogic S905D3 Arm Cortex-A55 quad-core SoC
10 - 2GB LPDDR4 SDRAM
11 - Gigabit Ethernet
12 - HDMI 2.1 display
13 - 40-pin GPIO header
14 - 1 x USB 3.0 Host, 1 x USB 2.0 Host
15 - eMMC, microSD
16 - M.2
17 - Infrared receiver
18
19Schematics are available on the manufacturer website.
20
21U-Boot compilation
22------------------
23
24 $ export CROSS_COMPILE=aarch64-none-elf-
25 $ make khadas-vim3l_defconfig
26 $ make
27
28Image creation
29--------------
30
31Amlogic doesn't provide sources for the firmware and for tools needed
32to create the bootloader image, so it is necessary to obtain them from
33the git tree published by the board vendor:
34
35.. code-block:: bash
36
37 $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
38 $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
39 $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
40 $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
41 $ 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
42
43 $ DIR=vim3l-u-boot
44 $ git clone --depth 1 \
45 https://github.com/khadas/u-boot.git -b khadas-vims-v2015.01 \
46 $DIR
47
48 $ cd vim3l-u-boot
49 $ make kvim3l_defconfig
50 $ make
51 $ export UBOOTDIR=$PWD
52
53 Go back to mainline U-Boot source tree then :
54
55.. code-block:: bash
56
57 $ mkdir fip
58
59 $ cp $UBOOTDIR/build/scp_task/bl301.bin fip/
60 $ cp $UBOOTDIR/build/board/khadas/kvim3l/firmware/acs.bin fip/
61 $ cp $UBOOTDIR/fip/g12a/bl2.bin fip/
62 $ cp $UBOOTDIR/fip/g12a/bl30.bin fip/
63 $ cp $UBOOTDIR/fip/g12a/bl31.img fip/
64 $ cp $UBOOTDIR/fip/g12a/ddr3_1d.fw fip/
65 $ cp $UBOOTDIR/fip/g12a/ddr4_1d.fw fip/
66 $ cp $UBOOTDIR/fip/g12a/ddr4_2d.fw fip/
67 $ cp $UBOOTDIR/fip/g12a/diag_lpddr4.fw fip/
68 $ cp $UBOOTDIR/fip/g12a/lpddr3_1d.fw fip/
69 $ cp $UBOOTDIR/fip/g12a/lpddr4_1d.fw fip/
70 $ cp $UBOOTDIR/fip/g12a/lpddr4_2d.fw fip/
71 $ cp $UBOOTDIR/fip/g12a/piei.fw fip/
72 $ cp $UBOOTDIR/fip/g12a/aml_ddr.fw fip/
73 $ cp u-boot.bin fip/bl33.bin
74
75 $ sh fip/blx_fix.sh \
76 fip/bl30.bin \
77 fip/zero_tmp \
78 fip/bl30_zero.bin \
79 fip/bl301.bin \
80 fip/bl301_zero.bin \
81 fip/bl30_new.bin \
82 bl30
83
84 $ sh fip/blx_fix.sh \
85 fip/bl2.bin \
86 fip/zero_tmp \
87 fip/bl2_zero.bin \
88 fip/acs.bin \
89 fip/bl21_zero.bin \
90 fip/bl2_new.bin \
91 bl2
92
93 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
94 --output fip/bl30_new.bin.g12a.enc \
95 --level v3
96 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc \
97 --output fip/bl30_new.bin.enc \
98 --level v3 --type bl30
99 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
100 --output fip/bl31.img.enc \
101 --level v3 --type bl31
102 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress lz4 \
103 --output fip/bl33.bin.enc \
104 --level v3 --type bl33 --compress lz4
105 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
106 --output fip/bl2.n.bin.sig
107 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bootmk \
108 --output fip/u-boot.bin \
109 --bl2 fip/bl2.n.bin.sig \
110 --bl30 fip/bl30_new.bin.enc \
111 --bl31 fip/bl31.img.enc \
112 --bl33 fip/bl33.bin.enc \
113 --ddrfw1 fip/ddr4_1d.fw \
114 --ddrfw2 fip/ddr4_2d.fw \
115 --ddrfw3 fip/ddr3_1d.fw \
116 --ddrfw4 fip/piei.fw \
117 --ddrfw5 fip/lpddr4_1d.fw \
118 --ddrfw6 fip/lpddr4_2d.fw \
119 --ddrfw7 fip/diag_lpddr4.fw \
120 --ddrfw8 fip/aml_ddr.fw \
121 --ddrfw9 fip/lpddr3_1d.fw \
122 --level v3
123
124and 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