1.. SPDX-License-Identifier: GPL-2.0+
2
3U-Boot for JetHub J100 (A113X)
4==============================
5
6JetHome Jethub D1 (http://jethome.ru/jethub-d1) is a home automation controller device
7manufactured by JetHome with the following specifications:
8
9 - Amlogic A113X (ARM Cortex-A53) quad-core up to 1.5GHz
10 - no video out
11 - 512MB/1GB DDR3 or 2GB DDR4 SDRAM
12 - 8/16/32GB eMMC flash
13 - 1 x USB 2.0
14 - 1 x 10/100Mbps ethernet
15 - WiFi / Bluetooth one from:
16   - AMPAK AP6255 (Broadcom BCM43455) IEEE 802.11a/b/g/n/ac, Bluetooth 4.2
17   - RTL8822CS IEEE 802.11a/b/g/n/ac, Bluetooth 5.0
18   - Amlogic W155S1 WiFi5 IEEE 802.11a/b/g/n/ac, Bluetooth 5.2
19 - 2 x gpio LEDS
20 - GPIO user Button
21 - DC source with a voltage of 9 to 56 V / Passive POE
22 - DIN Rail Mounting case
23
24The basic version also has:
25
26 - TI CC2538 + CC2592 Zigbee Wireless with upto 20dBm output power and Zigbee 3.0
27 - 1 x 1-Wire
28 - 2 x RS-485
29 - 4 x dry contact digital GPIO inputs
30 - 3 x relay GPIO outputs
31
32U-Boot Compilation
33------------------
34
35.. code-block:: bash
36
37    $ export CROSS_COMPILE=aarch64-none-elf-
38    $ make jethub_j100_defconfig
39    $ make
40
41U-Boot Signing with Pre-Built FIP repo
42--------------------------------------
43
44.. code-block:: bash
45
46    $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
47    $ cd amlogic-boot-fip
48    $ mkdir my-output-dir
49    $ ./build-fip.sh jethub-j100 /path/to/u-boot/u-boot.bin my-output-dir
50
51U-Boot Manual Signing
52---------------------
53
54Amlogic does not provide sources for the firmware and tools needed to create a bootloader
55image so it is necessary to obtain binaries from sources published by the board vendor:
56
57.. code-block:: bash
58
59    $ git clone https://github.com/jethome-ru/jethub-aml-tools jethub-u-boot
60    $ cd jethub-u-boot
61    $ export FIPDIR=$PWD
62
63Go back to the mainline U-Boot source tree then:
64
65.. code-block:: bash
66
67    $ mkdir fip
68
69    $ cp $FIPDIR/j100/bl2.bin fip/
70    $ cp $FIPDIR/j100/acs.bin fip/
71    $ cp $FIPDIR/j100/bl21.bin fip/
72    $ cp $FIPDIR/j100/bl30.bin fip/
73    $ cp $FIPDIR/j100/bl301.bin fip/
74    $ cp $FIPDIR/j100/bl31.img fip/
75    $ cp u-boot.bin fip/bl33.bin
76
77    $ $FIPDIR/blx_fix.sh \
78        fip/bl30.bin \
79        fip/zero_tmp \
80        fip/bl30_zero.bin \
81        fip/bl301.bin \
82        fip/bl301_zero.bin \
83        fip/bl30_new.bin \
84        bl30
85
86    $ $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
87
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
97    $ $FIPDIR/j100/aml_encrypt_axg --bl3sig --input fip/bl30_new.bin \
98                                   --output fip/bl30_new.bin.enc \
99                                   --level v3 --type bl30
100    $ $FIPDIR/j100/aml_encrypt_axg --bl3sig --input fip/bl31.img \
101                                   --output fip/bl31.img.enc \
102                                   --level v3 --type bl31
103    $ $FIPDIR/j100/aml_encrypt_axg --bl3sig --input fip/bl33.bin --compress lz4 \
104                                   --output fip/bl33.bin.enc \
105                                   --level v3 --type bl33
106    $ $FIPDIR/j100/aml_encrypt_axg --bl2sig --input fip/bl2_new.bin \
107                                   --output fip/bl2.n.bin.sig
108    $ $FIPDIR/j100/aml_encrypt_axg --bootmk \
109                                   --output fip/u-boot.bin \
110                                   --bl2 fip/bl2.n.bin.sig \
111                                   --bl30 fip/bl30_new.bin.enc \
112                                   --bl31 fip/bl31.img.enc \
113                                   --bl33 fip/bl33.bin.enc --level v3
114
115Then write U-Boot to SD or eMMC with:
116
117.. code-block:: bash
118
119    $ DEV=/dev/boot_device
120    $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
121    $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
122