Zircon on 96boards.org HiKey960

Requirements

  1. The following hardware is required:
  • HiKey960 + Power Adapter (Look here for more info)
  • USB-C cable to connect to workstation for purpose of flashing
  • 1.8v FTDI Serial adapter for console
  • Suggested: mezzanine board (eliminates need for 1.8v serial adapter)
  1. The following software is required:
  • fastboot Can be installed on Ubuntu via:

    sudo apt-get install android-tools-fastboot

  • mkbootimg, mkdtimg. It is suggested to use the version of these tools available in the build-from-source dirctory of the 96boards-hikey tools repo on github. Both of these tools will need to be in your execution path.

    git clone https://github.com/96boards-hikey/tools-images-hikey960.git

Useful Information

Building

To build zircon, invoke the following command from the top level Zircon directory (ensure that you have checked out the ARM64 toolchains). For more information, see docs/getting_started.md:

  make zircon-hikey960-arm64

Setup

Periodically check this file as the setup workflow will change/improve.

To interact with the board over serial, use a baud rate of 115200.

If using the mezzanine board, follow the instructions included with the board.

If using a FTDI style serial adapter:

  1. The signals are available on the 40 pin LS connector (reference)

    Pin 1 - GND Pin 11 - UART TX (HiKey960 -> Host) PIN 13 - UART RX (Hikey960 <- Host)

    So for a common FTDI style adapter:

     Black  -> Pin1
     Yellow -> Pin11
     Orange -> Pin13
    
  2. Optional - If not using the mezzanine board, an active low reset is avalable on pin 6 of the 40 pin LS connector. A jumper wire intermittently shorted from this pin to GND (shields of the connectors are all grounded) can provide an easy way to reset the board and place in fastboot mode.

Installing Low Level Firmware

We have run into inconsistent behavior between different Hikey 960 boards, depending on the low level firmware came installed on the device. We recommend setting up your board with known good firmware from the Android AOSP project. To install the firmware, put your board in fastboot mode and run the following commands:

git clone https://android.googlesource.com/device/linaro/hikey hikey-firmware
git -C hikey-firmware checkout 972114436628f874ac9ca28ef38ba82862937fbf
fastboot flash ptable hikey-firmware/installer/hikey960/ptable.img
fastboot flash xloader hikey-firmware/installer/hikey960/sec_xloader.img
fastboot flash fastboot hikey-firmware/installer/hikey960/fastboot.img
fastboot flash nvme hikey-firmware/installer/hikey960/nvme.img
fastboot flash fw_lpm3 hikey-firmware/installer/hikey960/lpm3.img
fastboot flash trustfirmware hikey-firmware/installer/hikey960/bl31.bin

This will install all the firmware from AOSP other than Android itself. If you want to use a different bootloader than the one from AOSP, complete the commands above and then install your bootloader.

Installing UEFI Firmware

Alternatively, if you require the UEFI firmware, you can put your board into recovery mode and run the following command:

scripts/hikey-efi-prebuilt hikey-uefi

Once the script completes, the board will boot into fastboot mode where you can run the following commands:

fastboot flash ptable hikey-uefi/prm_ptable.img
fastboot flash xloader hikey-uefi/sec_xloader.img
fastboot flash fastboot hikey-uefi/l-loader.bin
fastboot flash fip hikey-uefi/fip.bin

Installing Zircon

In order to flash the board, it will need to be connected to your workstation via the USB-C OTG connection on the HiKey960.

To install Zircon, the HiKey960 will need to be placed in fastboot mode. This can be done in one of two ways:

  1. Using the DIP switches on the back of the board. To place in fastboot mode the switches should be in the following positions:

     Auto Power up(Switch 1)   closed/ON
     Recovery(Switch 2)        open/OFF
     Fastboot(Switch 3)        closed/ON
    

    Once the switches are in these positions, either cycle power or reset the board and it will boot into fastboot mode, awaiting for commands from the host. This can be done with the jumper wire on pin 6 mentioned earlier in these instructions.

  2. If the board is reset, then reset again immediately after seeing the the following messages on the console:

     C3R,V0x00000016 e:113
     C0R,V0x00000017 e:66
     C1R,V0x00000017 e:66
     C2R,V0x00000017 e:66
     C3R,V0x00000017 e:66
    

    The second reset should allow it to boot into fastboot, which is indicated by the following messages at the end of the boot spew:

     usbloader: bootmode is 4
     usb: [USBFINFO]USB RESET
     usb: [USBFINFO]USB CONNDONE, highspeed
     usb: [USBFINFO]USB RESET
     usb: [USBFINFO]USB CONNDONE, highspeed
     usbloader: usb: online (highspeed)
     usb: [USBFINFO]usb enum done
    

Once the board is in fastboot, the following script can be run from the zircon root director to flash the necessary files onto the board:

    ./scripts/flash-hikey

The board will reboot after flashing. If the DIP switch method was used to place the board in fastboot mode, it is a good idea to flip the fastboot switch (switch 3) back to open/OFF before running the script so that it will boot into the kernel after flashing and not back into fastboot mode.

If the double tap reset method was used to place the board in fastboot mode, then no further action is needed and the board will boot into the kernel after it has completed flashing.