HiKey960
The HiKey960 is based on a HiSilicon Kirin 960 processor, but is different to the Hikey, which uses a Kirin 620 processor. Both are arm64 architecture machines. Do not mix up the Hikey960 with the Hikey: they are different computers.
More product information https://www.96boards.org/product/hikey960/
https://github.com/96boards/documentation/tree/master/consumer/hikey/hikey960/getting-started
Hardware documentation: https://www.96boards.org/documentation/consumer/hikey960/hardware-docs/hardware-user-manual.md.html
Tools needed on your Debian host machine
# apt install fastboot minicom simg2img wget
USB to Serial adapter
Currently an serial adapter is needed to see boot messages of the UEFI bios and the kernel.
We recommend using a 96boards serial board https://www.96boards.org/product/uartserial/ Alternatively look into the end of this page for DIY adapters.
During booting and flashing new software, you will see output on this console. There are two serial devices involved in reflashing: /dev/ttyUSB0 for the console you are monitoring and /dev/ttyUSB1 for the fastboot (USB C connector). The numbers may vary between boots.
It is _possible_ to do this process with just the USB C fastboot connector direct to the board (i.e. without a serial console), but you will be doing it 'blind' so it will be much harder to tell what's wrong if it's not working.
Flashing a new UEFI version
First, you should update to the newest UEFI version. (This is true in the first half of 2018 - at some point the board will come with a sensible version of UEFI and you will be able to skip this step and go straight to the simpler OS install).
This has two parts:
- hikey_idt uploads the initial bootloader files
- fastboot uploads the UEFI image
Connect the serial console to your computer, start minicom. Connect the USB OTG (the USB C small thing) port to your computer. This USB device is used for flashing UEFI and the OS.
Use dmesg -H to identify which serial port is which (replug the cable and run the command). The 96boards serial board appears as:
Product: FT230X 96Boards Console FTDI USB Serial Device converter now attached to ttyUSB0
The switches of the Hikey 960 must be set to recovery mode. See https://www.96boards.org/documentation/consumer/hikey960/getting-started/ This takes effect on next reboot, and waits 90 seconds.
Get the newest firmware from
https://snapshots.linaro.org/reference-platform/components/uefi-staging/latest/hikey960/release/
or
http://snapshots.linaro.org/reference-platform/embedded/morty/hikey960/135/rpb/bootloader/
I used the files from /96boards
Reset the board and run this script to download the files and install them.
# flash new UEFI version to hikey960 UEFI_URL=https://snapshots.linaro.org/reference-platform/components/uefi-staging/latest/hikey960/release/ files="config hikey_idt prm_ptable.img sec_xloader.img sec_usb_xloader.img sec_uce_boot.img l-loader.bin fip.bin recovery.bin" rm -f $files for f in $files; do wget $UEFI_URL/$f done echo Running hikey_idt... chmod +x hikey_idt # in version 59 the file config had a wrong file name for l-loader.bin ./hikey_idt -c config -p /dev/ttyUSB1 echo "Sleeping till device resets... zzz" sleep 15 fastboot flash ptable prm_ptable.img fastboot flash xloader sec_xloader.img fastboot flash fastboot l-loader.bin fastboot flash fip fip.bin
With a bit of luck this will 'just work', uploading three files with hikey_idt, then 4 files over fastboot. But there may be issues and you might need to split up the steps.
A successful upload (script output) looks like this, and takes no more than 30 seconds.
Running hikey_idt... Config name: config Port name: /dev/ttyUSB1 0: Image: sec_usb_xloader.img Downalod Address: 0x20000 1: Image: sec_uce_boot.img Downalod Address: 0x6a908000 2: Image: recovery.bin Downalod Address: 0x1ac00000 Serial port open successfully! Start downloading sec_usb_xloader.img@0x20000... file total size 99584 downlaod address 0x20000 Finish downloading Start downloading sec_uce_boot.img@0x6a908000... file total size 23680 downlaod address 0x6a908000 Finish downloading Start downloading recovery.bin@0x1ac00000... file total size 1179648 downlaod address 0x1ac00000 Finish downloading Sleeping till device resets... zzz target reported max download size of 134217728 bytes sending 'ptable' (24 KB)... OKAY [ 0.008s] writing 'ptable'... OKAY [ 0.003s] finished. total time: 0.012s target reported max download size of 134217728 bytes sending 'xloader' (151 KB)... OKAY [ 0.009s] writing 'xloader'... OKAY [ 0.009s] finished. total time: 0.019s target reported max download size of 134217728 bytes sending 'fastboot' (25 KB)... OKAY [ 0.008s] writing 'fastboot'... OKAY [ 0.053s] finished. total time: 0.061s target reported max download size of 134217728 bytes sending 'fip' (1466 KB)... OKAY [ 0.058s] writing 'fip'... OKAY [ 0.063s] finished. total time: 0.121s
Once this is done you can take the board out of 'recovery' mode (and into 'fastboot' mode if you are going to upload the OS next).
Flashing details
If everything is working, the hikey_idt script takes 10-20 seconds to reprogram the board. If it is using the wrong port, hikey_idt stalls with:
... Serial port open successfully! Start downloading sec_usb_xloader.img@0x20000... file total size 99584 downlaod address 0x20000
When the command hikey_idt is called you may see some boot messages in the serial console, and may need to type f on reboot to enter the fastboot mode (Otherwise my system is doing the UEFI boot, boots grub and the the system) or it may just do the fastboot uploads without intervention.
In the serial console you should see a message like this when it reboots:
Press ESCAPE for boot options .Android Fastboot mode - version 0.7. Press RETURN or SPACE key to quit.
If you are in fastboot mode, a new device /dev/ttyUSB1 appears after several seconds and now you can see the fastboot device on the computer.
# fastboot devices 8211F5D02876987 fastboot
Now you can flash the images using the four fastboot flash command from above. This takes about a second for all 4.
Debian Installation
Installation onto the UFS storage
The Hikey960 has 32GB of onbard UFS storage.
Get the files from http://snapshots.linaro.org/96boards/hikey/linaro/debian/latest/
- Boot the Hikey into fastboot mode
Wait until fastboot devices shows some device
- Use following commands to flash the boot and the system partition
# flash debian fastboot flash boot boot-linaro-stretch-developer-hikey-20180212-17.img fastboot flash system rootfs-linaro-stretch-developer-hikey-20180212-17.img fastboot reboot
Tips: system only has 4GB, you can try to flash rootfs into userdata to get 24GB
fastboot flash userdata rootfs-linaro-stretch-developer-hikey-20180212-17.img
Installing Debian onto SD card
wget http://snapshots.linaro.org/96boards/hikey/linaro/debian/latest/linaro-stretch-developer-hikey-20180212-17.sd.gz gunzip *sd.gz dd if=linaro-stretch-developer-hikey-20180212-17.sd of=/dev/mmcblk0 bs=1M status=progress
When booting the Hikey960 press ESC to enter the UEFI menu, then select Boot from CD card, which may be the default entry.
Running the installer
Not done yet.
Using a different kernel with Debian
Currently (2018/3/19), the Debian kernel Linux linaro-developer 4.15-hikey #1 SMP PREEMPT Mon Feb 12 14:07:40 UTC 2018 does not support all hardware, for e.g. the USB devices.
Therefore we install an additional kernel but still run the Debian OS. Get the Reference Platform Build – CE ?OpenEmbedded
http://snapshots.linaro.org/reference-platform/embedded/morty/hikey960/135/rpb/
wget http://snapshots.linaro.org/reference-platform/embedded/morty/hikey960/129/rpb/rpb-console-image-hikey960-20180209072216-129.rootfs.tar.xz tar axf rpb-console-image-hikey960-20180209072216-129.rootfs.tar.xz tar Jcvf kernel.tar.xz boot/*.dtb boot/Image* lib/modules/4.14.0-rc7-linaro-hikey960/
Now mount the SD card and extract the kernel.tar.xz there.
# change the root device to your UUID or mmcblk0p2, do not use sdd10, which is the onboard UFS storage
Then, create an additional grub menu entry.
/etc/grub.d/40_custom: menuentry 'CE Reference Platform kernel' { linux /boot/Image console=tty0 console=ttyAMA6,115200n8 root=/dev/mmcblk0p2 rootwait rw quiet efi=noruntime devicetree /boot/hi3660-hikey960.dtb }
You then need to call update-grub, so a new grub.cfg will be written. Mount the SD card to /mnt, then
mount --bind /dev /mnt/dev mount --bind /proc /mnt/proc chroot /mnt update-grub umount /mnt/proc umount /mnt/dev umount /mnt
What is working
Using the Debian kernel 4.15
- UFS
- SD card
- WLAN using nmtui
- USB is NOT working
Speed of UFS using dd to an file in an ext4 FS. read 280 MB/s, write 130 MB/s
Using the CE Reference Platform kernel
IMO everything is working.
DYI serial connection
The UART of the Hikey960 is using 1.8V, not 3.3V or 5V as other boards do. It's possible to modify a cheap USB to Serial adapter to work with 1.8V. See https://discuss.96boards.org/t/1-8v-uart-ttl-to-usb-diy-for-around-5-for-ce-boards/1911
Adapters using the FT232 chip are supported by the Linux kernel. Some adapters use other chips. I use a LDO Voltage Regulators 1.8V 0.8A Positive to get the 1.8V on my adapter board. Adpaters usually have mini or micro USB connector. For e.g. https://eckstein-shop.de/FT232-USB-UART-Board-mini
Connect the USB to serial adapter to the Hikey960 to PIN 11,13 and GND (e.g. 1,2) and the USB to your computer (). The serial console will appear as /dev/ttyUSB0 on your host. You can then use minicom -con to connect to the serial console (or 'screen /dev/ttyUSB0 115200' if you prefer)