Christian Hewitt | e284680 | 2023-03-23 14:31:42 +0000 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
| 3 | U-Boot for WeTek Hub (S905) |
| 4 | =========================== |
| 5 | |
| 6 | WeTek Hub is a small form-factor Android STB manufactured by WeTek with the following |
| 7 | specification: |
| 8 | |
| 9 | - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 1.5GHz |
| 10 | - ARM Mali 450 GPU |
| 11 | - 1GB DDR3 SDRAM |
| 12 | - 8GB eMMC |
| 13 | - Gigabit Ethernet |
| 14 | - HDMI 2.0 4K/60Hz display |
| 15 | - 1x USB otg |
| 16 | - microSD |
| 17 | - UART jack |
| 18 | - Infrared receiver |
| 19 | |
| 20 | Schematics are not publicly available but have been shared privately to maintainers. |
| 21 | |
| 22 | U-Boot Compilation |
| 23 | ------------------ |
| 24 | |
| 25 | .. code-block:: bash |
| 26 | |
| 27 | $ export CROSS_COMPILE=aarch64-none-elf- |
| 28 | $ make wetek-hub_defconfig |
| 29 | $ make |
| 30 | |
| 31 | U-Boot Signing with Pre-Built FIP repo |
| 32 | -------------------------------------- |
| 33 | |
| 34 | .. code-block:: bash |
| 35 | |
| 36 | $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1 |
| 37 | $ cd amlogic-boot-fip |
| 38 | $ mkdir my-output-dir |
| 39 | $ ./build-fip.sh wetek-hub /path/to/u-boot/u-boot.bin my-output-dir |
| 40 | |
| 41 | U-Boot Manual Signing |
| 42 | --------------------- |
| 43 | |
| 44 | Amlogic does not provide sources for the firmware and tools needed to create a bootloader |
| 45 | image and WeTek has not publicly shared the U-Boot sources needed to build FIP binaries |
| 46 | for signing. However you can download them from the amlogic-fip-repo. |
| 47 | |
| 48 | .. code-block:: bash |
| 49 | |
| 50 | $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1 |
| 51 | $ cd amlogic-boot-fip/wetek-hub |
| 52 | $ export FIPDIR=$PWD |
| 53 | |
| 54 | Go back to the mainline U-Boot source tree then: |
| 55 | |
| 56 | .. code-block:: bash |
| 57 | |
| 58 | $ mkdir fip |
| 59 | |
| 60 | $ cp $FIPDIR/bl2.bin fip/ |
| 61 | $ cp $FIPDIR/acs.bin fip/ |
| 62 | $ cp $FIPDIR/bl21.bin fip/ |
| 63 | $ cp $FIPDIR/bl30.bin fip/ |
| 64 | $ cp $FIPDIR/bl301.bin fip/ |
| 65 | $ cp $FIPDIR/bl31.img fip/ |
| 66 | $ cp u-boot.bin fip/bl33.bin |
| 67 | |
| 68 | $ $FIPDIR/blx_fix.sh \ |
| 69 | fip/bl30.bin \ |
| 70 | fip/zero_tmp \ |
| 71 | fip/bl30_zero.bin \ |
| 72 | fip/bl301.bin \ |
| 73 | fip/bl301_zero.bin \ |
| 74 | fip/bl30_new.bin \ |
| 75 | bl30 |
| 76 | |
| 77 | $ $FIPDIR/fip_create --bl30 fip/bl30_new.bin \ |
| 78 | --bl31 fip/bl31.img \ |
| 79 | --bl33 fip/bl33.bin \ |
| 80 | fip/fip.bin |
| 81 | |
| 82 | $ sed -i 's/\x73\x02\x08\x91/\x1F\x20\x03\xD5/' fip/bl2.bin |
| 83 | $ python3 $FIPDIR/acs_tool.py fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0 |
| 84 | |
| 85 | $ $FIPDIR/blx_fix.sh \ |
| 86 | fip/bl2_acs.bin \ |
| 87 | fip/zero_tmp \ |
| 88 | fip/bl2_zero.bin \ |
| 89 | fip/bl21.bin \ |
| 90 | fip/bl21_zero.bin \ |
| 91 | fip/bl2_new.bin \ |
| 92 | bl2 |
| 93 | |
| 94 | $ cat fip/bl2_new.bin fip/fip.bin > fip/boot_new.bin |
| 95 | |
| 96 | $ $FIPDIR/aml_encrypt_gxb --bootsig \ |
| 97 | --input fip/boot_new.bin |
| 98 | --output fip/u-boot.bin |
| 99 | |
| 100 | Then write U-Boot to SD or eMMC with: |
| 101 | |
| 102 | .. code-block:: bash |
| 103 | |
| 104 | $ DEV=/dev/boot_device |
| 105 | $ dd if=fip/u-boot.bin of=fip/u-boot.bin.gxbb bs=512 conv=fsync |
| 106 | $ dd if=fip/u-boot.bin of=fip/u-boot.bin.gxbb bs=512 seek=9 skip=8 count=87 conv=fsync,notrunc |
| 107 | $ dd if=/dev/zero of=fip/u-boot.bin.gxbb bs=512 seek=8 count=1 conv=fsync,notrunc |
| 108 | $ dd if=bl1.bin.hardkernel of=fip/u-boot.bin.gxbb bs=512 seek=2 skip=2 count=1 conv=fsync,notrunc |
| 109 | $ ./aml_chksum fip/u-boot.bin.gxbb |
| 110 | $ dd if=fip/u-boot.gxbb of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 |
| 111 | $ dd if=fip/u-boot.gxbb of=$DEV conv=fsync,notrunc bs=1 count=440 |