Christian Hewitt | a97557f | 2023-03-20 11:46:08 +0000 | [diff] [blame^] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
| 3 | U-Boot for Beelink GS-King-X (S922X) |
| 4 | ==================================== |
| 5 | |
| 6 | The Shenzen AZW (Beelink) GS-King-X is based on the Amlogic W400 reference board with an |
| 7 | S922X-H chip and the following specifications: |
| 8 | |
| 9 | - 4GB LPDDR4 RAM |
| 10 | - 64GB eMMC storage |
| 11 | - 10/100/1000 Base-T Ethernet |
| 12 | - AP6356S Wireless (802.11 a/b/g/n/ac, BT 4.1) |
| 13 | - HDMI 2.1 video |
| 14 | - S/PDIF optical output |
| 15 | - 2x ESS9018 audio DACs |
| 16 | - 4x Ricor RT6862 audio amps |
| 17 | - Analogue headphone output |
| 18 | - 1x USB 2.0 OTG port |
| 19 | - 3x USB 3.0 ports |
| 20 | - IR receiver |
| 21 | - 1x micro SD card slot (internal) |
| 22 | - USB SATA controller with 2x 3.5" drive bays |
| 23 | - 1x Power on/off button |
| 24 | |
| 25 | Beelink do not provide public schematics, but have been willing to share them with known |
| 26 | distro developers to assist with development. |
| 27 | |
| 28 | U-Boot Compilation |
| 29 | ------------------ |
| 30 | |
| 31 | .. code-block:: bash |
| 32 | |
| 33 | $ export CROSS_COMPILE=aarch64-none-elf- |
| 34 | $ make beelink-gsking-x_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 beelink-s922x /path/to/u-boot/u-boot.bin my-output-dir |
| 46 | |
| 47 | U-Boot Manual Signing |
| 48 | --------------------- |
| 49 | |
| 50 | Beelink released an Amlogic "SDK" dump in their forums but the U-Boot sources included |
| 51 | result in 2GB RAM detected. The following FIPs were generated with newer sources and |
| 52 | detect 4GB RAM: https://github.com/LibreELEC/amlogic-boot-fip/tree/master/beelink-s922x |
| 53 | |
| 54 | .. code-block:: bash |
| 55 | |
| 56 | $ wget https://github.com/LibreELEC/amlogic-boot-fip/archive/master.zip |
| 57 | $ unzip master.zip |
| 58 | $ export FIPDIR=$PWD/amlogic-boot-fip/beelink-s922x |
| 59 | |
| 60 | Go back to the mainline U-Boot source tree then: |
| 61 | |
| 62 | .. code-block:: bash |
| 63 | |
| 64 | $ mkdir fip |
| 65 | $ cp $FIPDIR/* fip/ |
| 66 | $ cp u-boot.bin fip/bl33.bin |
| 67 | |
| 68 | $ sh fip/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 | $ sh fip/blx_fix.sh \ |
| 78 | fip/bl2.bin \ |
| 79 | fip/zero_tmp \ |
| 80 | fip/bl2_zero.bin \ |
| 81 | fip/acs.bin \ |
| 82 | fip/bl21_zero.bin \ |
| 83 | fip/bl2_new.bin \ |
| 84 | bl2 |
| 85 | |
| 86 | $ fip/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \ |
| 87 | --output fip/bl30_new.bin.g12a.enc \ |
| 88 | --level v3 |
| 89 | $ fip/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \ |
| 90 | --output fip/bl30_new.bin.enc \ |
| 91 | --level v3 --type bl30 |
| 92 | $ fip/aml_encrypt_g12b --bl3sig --input fip/bl31.img \ |
| 93 | --output fip/bl31.img.enc \ |
| 94 | --level v3 --type bl31 |
| 95 | $ fip/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \ |
| 96 | --output fip/bl33.bin.enc \ |
| 97 | --level v3 --type bl33 |
| 98 | $ fip/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \ |
| 99 | --output fip/bl2.n.bin.sig |
| 100 | $ fip/aml_encrypt_g12b --bootmk \ |
| 101 | --output fip/u-boot.bin \ |
| 102 | --bl2 fip/bl2.n.bin.sig \ |
| 103 | --bl30 fip/bl30_new.bin.enc \ |
| 104 | --bl31 fip/bl31.img.enc \ |
| 105 | --bl33 fip/bl33.bin.enc \ |
| 106 | --ddrfw1 fip/ddr4_1d.fw \ |
| 107 | --ddrfw2 fip/ddr4_2d.fw \ |
| 108 | --ddrfw3 fip/ddr3_1d.fw \ |
| 109 | --ddrfw4 fip/piei.fw \ |
| 110 | --ddrfw5 fip/lpddr4_1d.fw \ |
| 111 | --ddrfw6 fip/lpddr4_2d.fw \ |
| 112 | --ddrfw7 fip/diag_lpddr4.fw \ |
| 113 | --ddrfw8 fip/aml_ddr.fw \ |
| 114 | --level v3 |
| 115 | |
| 116 | Then write U-Boot to SD or eMMC with: |
| 117 | |
| 118 | .. code-block:: bash |
| 119 | |
| 120 | $ DEV=/dev/boot_device |
| 121 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 |
| 122 | $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440 |