Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 3 | U-Boot for WeTek Core2 (S912) |
| 4 | ============================= |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 5 | |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 6 | WeTek Core2 is an Android STB based on the Q200 reference design with the following |
| 7 | specifications: |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 8 | |
| 9 | - Amlogic S912 ARM Cortex-A53 octo-core SoC @ 1.5GHz |
| 10 | - ARM Mali T820 GPU |
| 11 | - 3GB DDR4 SDRAM |
| 12 | - 10/100 Realtek RTL8152 Ethernet (internal USB) |
| 13 | - HDMI 2.0 4K/60Hz display |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 14 | - 2x USB 2.0 Host |
| 15 | - 1x USB 2.0 OTG (internal) |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 16 | - 32GB eMMC |
| 17 | - microSD |
| 18 | - SDIO Wifi Module, Bluetooth |
| 19 | - Two channel IR receiver |
| 20 | |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 21 | U-Boot Compilation |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 22 | ------------------ |
| 23 | |
| 24 | .. code-block:: bash |
| 25 | |
| 26 | $ export CROSS_COMPILE=aarch64-none-elf- |
| 27 | $ make wetek-core2_defconfig |
| 28 | $ make |
| 29 | |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 30 | U-Boot Signing with Pre-Built FIP repo |
| 31 | -------------------------------------- |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 32 | |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 33 | .. 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 wetek-core2 /path/to/u-boot/u-boot.bin my-output-dir |
Neil Armstrong | 2ea9868 | 2022-03-02 10:42:22 +0100 | [diff] [blame] | 39 | |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 40 | U-Boot Manual Signing |
| 41 | --------------------- |
| 42 | |
| 43 | Amlogic does not provide firmware sources or tools needed to create the bootloader image |
| 44 | and WeTek has not publicly shared the precompiled FIP binaries. However the Khadas VIM2 |
| 45 | sources also work with the Core2 box so we can use the Khadas git tree: |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 46 | |
| 47 | .. code-block:: bash |
| 48 | |
| 49 | $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz |
| 50 | $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz |
| 51 | $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz |
| 52 | $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz |
| 53 | $ 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 |
| 54 | $ git clone https://github.com/khadas/u-boot -b khadas-vim-v2015.01 vim-u-boot |
| 55 | $ cd vim-u-boot |
| 56 | $ make kvim2_defconfig |
| 57 | $ make |
| 58 | $ export FIPDIR=$PWD/fip |
| 59 | |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 60 | Go back to the mainline U-Boot source tree then: |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 61 | |
| 62 | .. code-block:: bash |
| 63 | |
| 64 | $ mkdir fip |
| 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 |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 72 | |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 73 | $ $FIPDIR/blx_fix.sh \ |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 74 | 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 |
| 81 | |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 82 | $ python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0 |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 83 | |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 84 | $ $FIPDIR/blx_fix.sh \ |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 85 | 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 |
| 92 | |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 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 Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 98 | --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 |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 103 | |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 104 | Then write U-Boot to SD or eMMC with: |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 105 | |
| 106 | .. code-block:: bash |
| 107 | |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 108 | $ DEV=/dev/boot_device |
Christian Hewitt | c1aae0a | 2020-12-15 12:32:14 +0000 | [diff] [blame] | 109 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 |
Christian Hewitt | 3881139 | 2023-03-20 11:46:05 +0000 | [diff] [blame] | 110 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440 |