blob: 20370ed49a873e8958019d31d27072701eeaa0aa [file] [log] [blame]
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02001.. SPDX-License-Identifier: GPL-2.0+
2
Christian Hewittc0a1afc2023-03-20 11:45:44 +00003U-Boot for Khadas VIM (S905X)
4=============================
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02005
Christian Hewittc0a1afc2023-03-20 11:45:44 +00006Khadas VIM is a Single Board Computer manufactured by Shenzhen Wesion Technology Co. Ltd
7with the following specifications:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +02008
9 - Amlogic S905X ARM Cortex-A53 quad-core SoC @ 1.5GHz
10 - ARM Mali 450 GPU
11 - 2GB DDR3 SDRAM
Christian Hewittc0a1afc2023-03-20 11:45:44 +000012 - 8GB/16GB eMMC
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020013 - 10/100 Ethernet
14 - HDMI 2.0 4K/60Hz display
15 - 40-pin GPIO header
16 - 2 x USB 2.0 Host, 1 x USB 2.0 Type-C OTG
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020017 - microSD
18 - SDIO Wifi Module, Bluetooth
Christian Hewittc0a1afc2023-03-20 11:45:44 +000019 - Two channel IR receiver
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020020
Christian Hewittc0a1afc2023-03-20 11:45:44 +000021U-Boot Compilation
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020022------------------
23
24.. code-block:: bash
25
26 $ export CROSS_COMPILE=aarch64-none-elf-
27 $ make khadas-vim_defconfig
28 $ make
29
Christian Hewittc0a1afc2023-03-20 11:45:44 +000030U-Boot Signing with Pre-Built FIP repo
31--------------------------------------
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020032
Christian Hewittc0a1afc2023-03-20 11:45:44 +000033.. code-block:: bash
34
35 $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
36 $ cd amlogic-boot-fip
37 $ mkdir my-output-dir
38 $ ./build-fip.sh khadas-vim /path/to/u-boot/u-boot.bin my-output-dir
39
40U-Boot Manual Signing
41---------------------
Neil Armstrong2ea98682022-03-02 10:42:22 +010042
Christian Hewittc0a1afc2023-03-20 11:45:44 +000043Amlogic does not provide sources for the firmware and tools needed to create a bootloader
44image so it is necessary to obtain binaries from sources published by the board vendor:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020045
46.. code-block:: bash
47
48 $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
49 $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
50 $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
51 $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
52 $ 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
53 $ git clone https://github.com/khadas/u-boot -b Vim vim-u-boot
54 $ cd vim-u-boot
55 $ make kvim_defconfig
56 $ make CROSS_COMPILE=aarch64-none-elf-
57 $ export FIPDIR=$PWD/fip
58
59Go back to mainline U-Boot source tree then :
60
61.. code-block:: bash
62
63 $ mkdir fip
64
65 $ cp $FIPDIR/gxl/bl2.bin fip/
66 $ cp $FIPDIR/gxl/acs.bin fip/
67 $ cp $FIPDIR/gxl/bl21.bin fip/
68 $ cp $FIPDIR/gxl/bl30.bin fip/
69 $ cp $FIPDIR/gxl/bl301.bin fip/
70 $ cp $FIPDIR/gxl/bl31.img fip/
71 $ cp u-boot.bin fip/bl33.bin
72
73 $ $FIPDIR/blx_fix.sh \
Christian Hewittc0a1afc2023-03-20 11:45:44 +000074 fip/bl30.bin \
75 fip/zero_tmp \
76 fip/bl30_zero.bin \
77 fip/bl301.bin \
78 fip/bl301_zero.bin \
79 fip/bl30_new.bin \
80 bl30
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020081
82 $ python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
83
84 $ $FIPDIR/blx_fix.sh \
Christian Hewittc0a1afc2023-03-20 11:45:44 +000085 fip/bl2_acs.bin \
86 fip/zero_tmp \
87 fip/bl2_zero.bin \
88 fip/bl21.bin \
89 fip/bl21_zero.bin \
90 fip/bl2_new.bin \
91 bl2
Neil Armstrong84e5e8e2020-06-11 10:53:49 +020092
93 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin
94 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img
95 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin
96 $ $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output fip/bl2.n.bin.sig
97 $ $FIPDIR/gxl/aml_encrypt_gxl --bootmk \
Christian Hewittc0a1afc2023-03-20 11:45:44 +000098 --output fip/u-boot.bin \
99 --bl2 fip/bl2.n.bin.sig \
100 --bl30 fip/bl30_new.bin.enc \
101 --bl31 fip/bl31.img.enc \
102 --bl33 fip/bl33.bin.enc
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200103
Christian Hewittc0a1afc2023-03-20 11:45:44 +0000104Then write U-Boot to SD or eMMC with:
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200105
106.. code-block:: bash
107
Christian Hewittc0a1afc2023-03-20 11:45:44 +0000108 $ DEV=/dev/boot_device
Neil Armstrong84e5e8e2020-06-11 10:53:49 +0200109 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
Christian Hewittc0a1afc2023-03-20 11:45:44 +0000110 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440