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