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