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