1.. SPDX-License-Identifier: GPL-2.0+
2
3U-Boot for Beelink GT-King Pro
4==============================
5
6The Shenzen AZW (Beelink) GT-King Pro is based on the Amlogic W400 reference
7board with an S922X-H chip.
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- Analogue audio output
15- 1x RS232 port
16- 2x USB 2.0 port
17- 2x USB 3.0 ports
18- IR receiver
19- 1x SD card slot
20- 1x Power on/off button
21
22Beelink do not provide public schematics, but have been willing
23to share them with known distro developers on request.
24
25U-Boot compilation
26------------------
27
28.. code-block:: bash
29
30    $ export CROSS_COMPILE=aarch64-none-elf-
31    $ make beelink-gtkingpro_defconfig
32    $ make
33
34Image creation
35--------------
36
37Amlogic does not provide sources for the firmware and for tools needed
38to create the bootloader image. Beelink have provided the Amlogic "SDK"
39in their forums, but the u-boot sources included result in 2GB RAM being
40detected. The following FIPs were generated with newer private sources
41and give correct (4GB) RAM detection:
42
43https://github.com/LibreELEC/amlogic-boot-fip/tree/master/beelink-s922x
44
45NB: Beelink use a common board config for GT-King, GT-King Pro and the
46GS-King-X model, hence the "beelink-s922x" name.
47
48.. code-block:: bash
49
50    $ wget https://github.com/LibreELEC/amlogic-boot-fip/archive/master.zip
51    $ unzip master.zip
52    $ export FIPDIR=$PWD/amlogic-boot-fip/beelink-s922x
53
54Go back to the mainline U-Boot source tree then:
55
56.. code-block:: bash
57
58    $ mkdir fip
59    $ cp $FIPDIR/* fip/
60    $ cp u-boot.bin fip/bl33.bin
61
62    $ sh fip/blx_fix.sh \
63    	fip/bl30.bin \
64    	fip/zero_tmp \
65    	fip/bl30_zero.bin \
66    	fip/bl301.bin \
67    	fip/bl301_zero.bin \
68    	fip/bl30_new.bin \
69    	bl30
70
71    $ sh fip/blx_fix.sh \
72    	fip/bl2.bin \
73    	fip/zero_tmp \
74    	fip/bl2_zero.bin \
75    	fip/acs.bin \
76    	fip/bl21_zero.bin \
77    	fip/bl2_new.bin \
78    	bl2
79
80    $ fip/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
81    				--output fip/bl30_new.bin.g12a.enc \
82    				--level v3
83    $ fip/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
84    				--output fip/bl30_new.bin.enc \
85    				--level v3 --type bl30
86    $ fip/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
87    				--output fip/bl31.img.enc \
88    				--level v3 --type bl31
89    $ fip/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
90    				--output fip/bl33.bin.enc \
91    				--level v3 --type bl33
92    $ fip/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
93    				--output fip/bl2.n.bin.sig
94    $ fip/aml_encrypt_g12b --bootmk \
95    		--output fip/u-boot.bin \
96    		--bl2 fip/bl2.n.bin.sig \
97    		--bl30 fip/bl30_new.bin.enc \
98    		--bl31 fip/bl31.img.enc \
99    		--bl33 fip/bl33.bin.enc \
100    		--ddrfw1 fip/ddr4_1d.fw \
101    		--ddrfw2 fip/ddr4_2d.fw \
102    		--ddrfw3 fip/ddr3_1d.fw \
103    		--ddrfw4 fip/piei.fw \
104    		--ddrfw5 fip/lpddr4_1d.fw \
105    		--ddrfw6 fip/lpddr4_2d.fw \
106    		--ddrfw7 fip/diag_lpddr4.fw \
107    		--ddrfw8 fip/aml_ddr.fw \
108    		--level v3
109
110and then write the image to SD with:
111
112.. code-block:: bash
113
114    $ DEV=/dev/your_sd_device
115    $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
116    $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
117