1Introduction
2============
3
4HiKey960 is one of the 96Boards Consumer Edition board from HiSilicon.
5The board/SoC has: -
6* HiSilicon Kirin960 (HI3660) SoC with 4xCortex-A73 and 4xCortex-A53
7* ARM Mali G71 MP8 GPU
8* 3GB LPDDR4 SDRAM
9* 32GB UFS Flash Storage
10* microSD
11* 802.11a/b/g/n WiFi, Bluetooth
12
13More information about this board can be found in 96Boards website:
14https://www.96boards.org/product/hikey960/
15
16Currently the u-boot port supports: -
17* SD card
18
19Compile from source
20===================
21
22First get all the sources
23
24  > mkdir -p ~/hikey960/src ~/hikey960/bin
25  > cd ~/hikey960/src
26  > git clone https://github.com/ARM-software/arm-trusted-firmware
27  > git clone https://github.com/96boards-hikey/OpenPlatformPkg -b testing/hikey960_v1.3.4
28  > git clone https://github.com/96boards-hikey/l-loader -b testing/hikey960_v1.2
29  > wget http://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/config
30  > wget http://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/hisi-sec_usb_xloader.img
31  > wget http://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/hisi-sec_uce_boot.img
32  > wget http://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/sec_xloader.img
33  > wget http://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/recovery.bin
34  > wget http://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/hikey_idt
35
36Get the SCP_BL2 lpm3.img binary. It is shipped as part of the UEFI source.
37The latest version can be obtained from the OpenPlatformPkg repo.
38
39  > cp OpenPlatformPkg/Platforms/Hisilicon/HiKey960/Binary/lpm3.img ~/hikey960/bin/
40
41Compile U-Boot
42==============
43
44  > cd ~/hikey960/src/u-boot
45  > make CROSS_COMPILE=aarch64-linux-gnu- hikey960_defconfig
46  > make CROSS_COMPILE=aarch64-linux-gnu-
47  > cp u-boot.bin ~/hikey960/bin/
48
49Compile ARM Trusted Firmware (ATF)
50==================================
51
52  > cd ~/hikey960/src/arm-trusted-firmware
53  > make CROSS_COMPILE=aarch64-linux-gnu- all fip \
54    SCP_BL2=~/hikey960/bin/lpm3.img \
55    BL33=~/hikey960/bin/u-boot.bin DEBUG=1 PLAT=hikey960
56
57Copy the resulting FIP binary
58  > cp build/hikey960/debug/fip.bin ~/hikey960/bin
59
60Compile l-loader
61================
62  > cd ~/hikey960/src/l-loader
63  > ln -sf ~/hikey960/src/arm-trusted-firmware/build/hikey960/debug/bl1.bin
64  > ln -sf ~/hikey960/src/arm-trusted-firmware/build/hikey960/debug/bl2.bin
65  > ln -sf ~/hikey960/src/arm-trusted-firmware/build/hikey960/debug/fip.bin
66  > ln -sf ~/hikey960/bin/u-boot.bin
67  > make hikey960 PTABLE_LST=linux-32g NS_BL1U=u-boot.bin
68
69Copy the resulting binaries
70  > cp *.img ~/hikey960/bin
71  > cp l-loader.bin ~/hikey960/bin
72
73These instructions are adapted from
74https://github.com/ARM-software/arm-trusted-firmware/blob/master/docs/plat/hikey960.rst
75
76Setup Console
77=============
78
79Install ser2net. Use telnet as the console since UEFI in recovery mode
80output window fails to display in minicom.
81
82  > sudo apt-get install ser2net
83
84Configure ser2net
85
86  > sudo vi /etc/ser2net.conf
87
88Append one line for serial-over-USB in #ser2net.conf
89
90  > 2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner
91
92Start ser2net
93
94  > sudo killall ser2net
95  > sudo ser2net -u
96
97Open the console.
98
99  > telnet localhost 2004
100
101And you could open the console remotely, too.
102
103Flashing
104========
105
1061. Boot Hikey960 into recovery mode as per the below document:
107https://github.com/96boards/documentation/blob/master/consumer/hikey/hikey960/installation/board-recovery.md
108
109Once Hikey960 is in recovery mode, flash the recovery binary:
110
111  > cd ~/hikey960/src
112  > chmod +x ./hikey_idt
113  > sudo ./hikey_idt -c config -p /dev/ttyUSB1
114
115Now move to the Hikey960 console and press `f` during UEFI boot. This
116will allow the board to boot into fastboot mode. Once the board is in
117fastboot mode, you should see the ID of the HiKey960 board using the
118following command
119
120  > sudo fastboot devices
121
1221ED3822A018E3372	fastboot
123
1243. Flash the images
125
126Now, the images can be flashed using fastboot:
127
128  > sudo fastboot flash ptable ~/hikey960/bin/prm_ptable.img
129  > sudo fastboot flash xloader ~/hikey960/bin/sec_xloader.img
130  > sudo fastboot flash fastboot ~/hikey960/bin/l-loader.bin
131  > sudo fastboot flash fip ~/hikey960/bin/fip.bin
132
1334. Set the "Boot Mode" switch to OFF position for normal boot mode.
134Then power on HiKey960
135
136Observe the console traces using UART6 on the Low Speed Expansion header:
137
138NOTICE:  BL2: v2.1(debug):v2.1-531-g3ee48f40
139NOTICE:  BL2: Built : 18:15:58, Aug  2 2019
140INFO:    BL2: Doing platform setup
141INFO:    UFS LUN0 contains 1024 blocks with 4096-byte size
142INFO:    UFS LUN1 contains 1024 blocks with 4096-byte size
143INFO:    UFS LUN2 contains 2048 blocks with 4096-byte size
144INFO:    UFS LUN3 contains 7805952 blocks with 4096-byte size
145INFO:    ufs: change power mode success
146INFO:    BL2: Loading image id 2
147INFO:    Loading image id=2 at address 0x89c80000
148INFO:    Image id=2 loaded: 0x89c80000 - 0x89cb5088
149INFO:    BL2: Initiating SCP_BL2 transfer to SCP
150INFO:    BL2: SCP_BL2: 0x89c80000@0x35088
151INFO:    BL2: SCP_BL2 HEAD:
152INFO:    BL2: SCP_BL2 0x7000 0x179 0x159 0x149
153INFO:    BL2: SCP_BL2 0x189 0x18b 0x18d 0x0
154INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x18f
155INFO:    BL2: SCP_BL2 0x191 0x0 0x193 0x195
156INFO:    BL2: SCP_BL2 0x18fd 0x18fd 0x18fd 0x18fd
157INFO:    BL2: SCP_BL2 0x18fd 0x18fd 0x18fd 0x18fd
158INFO:    BL2: SCP_BL2 0x18fd 0x18fd 0x18fd 0x18fd
159INFO:    BL2: SCP_BL2 0x4d454355 0x43494741 0x424d554e 0x21215245
160INFO:    BL2: SCP_BL2 0x4a054904 0x42912000 0xf841bfbc 0xe7fa0b04
161INFO:    BL2: SCP_BL2 0xb88cf000 0x3b18 0x3d1c 0x6809493e
162INFO:    BL2: SCP_BL2 0x4613680a 0x201f102 0xf0002a04 0x600a804c
163INFO:    BL2: SCP_BL2 0x204f04f 0xf203fb02 0xf102440a 0x60100204
164INFO:    BL2: SCP_BL2 0x160f04f 0xf103fb01 0x68004834 0x61044408
165INFO:    BL2: SCP_BL2 0x61866145 0xf8c061c7 0xf8c08020 0xf8c09024
166INFO:    BL2: SCP_BL2 0xf8c0a028 0xf3efb02c 0xf3ef8208 0x68118309
167INFO:    BL2: SCP_BL2 0xf1026401 0xf0110204 0xbf070f04 0x46113220
168INFO:    BL2: SCP_BL2 TAIL:
169INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
170INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
171INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
172INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
173INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
174INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
175INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
176INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
177INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
178INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
179INFO:    BL2: SCP_BL2 0x0 0x19cad151 0x19b80040 0x0
180INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
181INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
182INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
183INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
184INFO:    BL2: SCP_BL2 0x0 0x0 0x0 0x0
185INFO:    BL2: SCP_BL2 transferred to SCP
186INFO:    start fw loading
187INFO:    fw load success
188WARNING: BL2: Platform setup already done!!
189INFO:    BL2: Loading image id 3
190INFO:    Loading image id=3 at address 0x1ac58000
191INFO:    Image id=3 loaded: 0x1ac58000 - 0x1ac63024
192INFO:    BL2: Loading image id 5
193INFO:    Loading image id=5 at address 0x1ac98000
194INFO:    Image id=5 loaded: 0x1ac98000 - 0x1ad0819c
195NOTICE:  BL2: Booting BL31
196INFO:    Entry point address = 0x1ac58000
197INFO:    SPSR = 0x3cd
198NOTICE:  BL31: v2.1(debug):v2.1-531-g3ee48f40
199NOTICE:  BL31: Built : 18:16:01, Aug  2 2019
200INFO:    ARM GICv2 driver initialized
201INFO:    BL31: Initializing runtime services
202INFO:    BL31: cortex_a53: CPU workaround for 855873 was applied
203INFO:    plat_setup_psci_ops: sec_entrypoint=0x1ac580fc
204INFO:    BL31: Preparing for EL3 exit to normal world
205INFO:    Entry point address = 0x1ac98000
206INFO:    SPSR = 0x3c9
207
208
209U-Boot 2019.07-00628-g286f05a6fc-dirty (Aug 02 2019 - 17:14:05 +0530)
210Hikey960
211
212DRAM:  3 GiB
213PSCI:  v1.1
214MMC:   dwmmc1@ff37f000: 0
215Loading Environment from EXT4... ** File not found /uboot.env **
216
217** Unable to read "/uboot.env" from mmc0:2 **
218In:    serial@fff32000
219Out:   serial@fff32000
220Err:   serial@fff32000
221Net:   Net Initialization Skipped
222No ethernet found.
223Hit any key to stop autoboot:  0
224switch to partitions #0, OK
225mmc0 is current device
226Scanning mmc 0:1...
227Found /extlinux/extlinux.conf
228Retrieving file: /extlinux/extlinux.conf
229201 bytes read in 12 ms (15.6 KiB/s)
2301:      hikey960-kernel
231Retrieving file: /Image
23224689152 bytes read in 4377 ms (5.4 MiB/s)
233append: earlycon=pl011,mmio32,0xfff32000 console=ttyAMA6,115200 rw root=/dev/mmcblk0p2 rot
234Retrieving file: /hi3660-hikey960.dtb
23535047 bytes read in 14 ms (2.4 MiB/s)
236## Flattened Device Tree blob at 10000000
237   Booting using the fdt blob at 0x10000000
238   Using Device Tree in place at 0000000010000000, end 000000001000b8e6
239
240Starting kernel ...
241
242[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
243[    0.000000] Linux version 5.2.0-03138-gd75da80dce39 (mani@Mani-XPS-13-9360) (gcc versi9
244[    0.000000] Machine model: HiKey960
245[    0.000000] earlycon: pl11 at MMIO32 0x00000000fff32000 (options '')
246[    0.000000] printk: bootconsole [pl11] enabled
247[    0.000000] efi: Getting EFI parameters from FDT:
248