Install UEFI on HiKey960 from Binaries [Instructions]

  1. Prepare the required files
$ git clone https://github.com/96boards-hikey/tools-images-hikey960
$ cd tools-images-hikey960
$ rm config hikey_idt sec_uce_boot.img sec_usb_xloader.img sec_xloader.img
$ wget http://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/13/hikey960/debug/config
$ wget http://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/13/hikey960/debug/fip.bin
$ wget http://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/13/hikey960/debug/hikey_idt
$ wget http://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/13/hikey960/debug/l-loader.bin
$ wget http://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/13/hikey960/debug/prm_ptable.img
$ wget http://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/13/hikey960/debug/sec_uce_boot.img
$ wget http://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/13/hikey960/debug/sec_usb_xloader.img
$ wget http://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/13/hikey960/debug/sec_xloader.img
  1. Connect the HiKey960 and prepare for flash assuming the host machine already has adb and fastboot installed

a.On the Hikey960
ā€¦Set switch 1 and 2 to on and 3 to off
ā€¦Connect the uart to the host system and make sure it shows up as ttyUSB0 using dmesg command
ā€¦Power on the HiKey960
ā€¦Connect the usb-c otg to host system and make sure that shows up as ttyUSB1

b.On the Host machine open up a new terminal

$ sudo apt install picocom
$ picocom /dev/ttyUSB0 -b 115200
  1. Start the flash process make sure your main terminal in in the tools-images-hikey960 directory
$ chmod +x hikey_idt
$ sudo ./hikey_idt -c config -p /dev/ttyUSB1
  1. The picocom terminal would show an output like:
Press ESCAPE for boot options UfsExecScsiCmds() fails with Target Failure
UfsExecScsiCmds() fails with Target Failure
UfsExecScsiCmds() fails with Target Failure
UfsExecScsiCmds() fails with Target Failure
.

at this time you have upto 10 seconds to press ā€œfā€ and enter Fastboot mode.

  1. Then on the host machine continue with the following commands
$ sudo fastboot flash ptable prm_ptable.img
$ sudo fastboot flash xloader sec_xloader.img
$ sudo fastboot flash fastboot l-loader.bin
$ sudo fastboot flash fip fip.bin
  1. Set switch 1 to ON and 2 & 3 to OFF and reboot.

  2. Done!
    To enter UEFI Boot Options press the escape key at boot.
    To enter Fastboot mode press ā€˜fā€™ at boot.
    Remember Android is not yet officially supported on uefi for Hikey960, this is only for openembedded builds.
    You can now enter fastboot mode and flash boot and system images for the same.

1 Like

Cool, thanks for your tutorial. I will definitely try it.
By the way, is there any instruction to install Linux-image ? Sorry if my question is duplicate.
Thank you very much

1 Like

Hi.

Thank you the instructions but UEFI does not run.
After commands

$ sudo fastboot flash ptable prm_ptable.img
$ sudo fastboot flash xloader sec_xloader.img
$ sudo fastboot flash fastboot l-loader.bin
$ sudo fastboot flash fip fip.bin

and reboot, evrytime booting stops. Dmsg is as below.
Are there some preparations before setup UEFI?
Anybody please help meā€¦ Thank you.


hikey960 boarid:5301 xloader use UART6
scsysstat_value[0].
clear reset source
last_keypoint0,reboot_type0
secdbg not DCU.
SecDbgVer exit

xloader chipid is: 0x36600110, start at 490ms.
Build Date: Jun 20 2017, 20:37:08
[clock_init] ++
hikey960 [hikey960_clk_init]
hi3660 [clk_setup]
[clock_init] ā€“
storage type is UFS
ufs retry: 6 count v_tx:0 v_rx:0
ufs set v_tx:0 v_rx:0
Hikey960[5301] no need avs_init.
ddr ft:0xf20332a3,mode:1 target:4
UceLdOk
ch 0 gt_errfail, STATUS:0x00000060
ch 0 gdst_errfail, STATUS:0x00000040
ch 1 gt_errfail, STATUS:0x00000060
ch 1 gdst_errfail, STATUS:0x00000040
ch 2 gt_errfail, STATUS:0x00000060
ch 2 gdst_errfail, STATUS:0x00000040
ch 3 gt_errfail, STATUS:0x00000060
ch 3 gdst_errfail, STATUS:0x00000040
timeout
timeout
timeout
timeout
density:
0x0c0c0c0c,0x00000000,0x0c0c0c0c,0x00000000,0x0c0c0c0c,0x00000000,0x0c0c0c0c,0x00000000
ddr info 0x00000306
400M
685M
1067M
C0R,V0x0000002c e:66
C1R,V0x0000002e e:66
C2R,V0x0000002c e:66
C3R,V0x0000002d e:193
C0R,V0x0000002d e:66
C1R,V0x0000002f e:66
C2R,V0x0000002d e:66
C3R,V0x0000002e e:66
C0R,V0x0000002e e:66
C1R,V0x00000030 e:66
C2R,V0x0000002e e:65
C3R,V0x0000002f e:66
C0R,V0x0000002f e:65
C1R,V0x00000031 e:65
C2R,V0x0000002f e:65
C3R,V0x00000030 e:65
1244M
1866M
C0R,V0x00000016 e:66
C2R,V0x00000016 e:66
C0R,V0x00000017 e:66
C2R,V0x00000017 e:66
C3R,V0x00000017 e:66
iomcu_subsys_init
boot_c0 PROFILE 4
slave0 irq0:0x00000004
slave1 irq0:0x00000004
NOTICE: Booting Trusted Firmware
NOTICE: BL1: v1.4(release):v1.4-155-g827cd9f1
NOTICE: BL1: Built : 11:45:25, Sep 4 2017
NOTICE: BL1: Booting BL2
NOTICE: BL2: v1.4(release):v1.4-155-g827cd9f1
NOTICE: BL2: Built : 11:45:25, Sep 4 2017
NOTICE: BL1: Booting BL31
NOTICE: BL31: v1.4(release):v1.4-155-g827cd9f1
NOTICE: BL31: Built : 11:45:25, Sep 4 2017

Same here! I did the same thing and got the same result.

I cant enter fastboot mode or uefi

@Lucas_Tanure @sukisaki
Iā€™ll test it on my end, but I use this very guide to install uefi
did you change back the switches to
Set switch 1 to ON and 2 & 3 to OFF and reboot

after UEFI I did switch 1 to on
2 and 3 to off

@ric96
Thank you for your response. Yes, I switched.
Do I need flash cache and userdata?

@sukisaki @sukisaki
hmā€¦ Iā€™ll get back on this asap, Iā€™ll have to check it for myself

@sukisaki @Lucas_Tanure
thanks for reporting, I had recently updated the links in the guide to build 21, seems like that is not working, i am facing the same issues. Iā€™ve reverted it to build 13

Iā€™d reccomend you to remove uefi for now https://github.com/96boards-hikey/tools-images-hikey960, Iā€™m having issues even with build 13

Iā€™ve successed at build 12!

This UEFI stuff is open source ?
Can we generate the binaries ?
I didnā€™t test the version 12 yet.

Do you plan to release a full tutorial about how to get Linux on this board ?
The information about how to get Linux is spread across several pages, there is no explanation about what is this linux distro, there is no information about to compile a new kernel for hikey 960 and use with this distro.

My main point is : How I should develop linux drivers for new hardware using Hikey if I canā€™t use a linux distro and develop my own linux driver ?

12 works , I can enter in fastboot mode using 12

UEFI is not completely open source: there is no source for the low-power-manager firmware (fw_lpm3) and also the xloader loading it into RAM.
UEFI can be seen as a replacement for fastboot, which is also loaded and executed at 0x1ac00000. In theory it should be possible to run a zImage+dtb+initramfs blob instead, but this needs more closer investigation.

ric96, is it possible to build uefi without BL32 (TOS_BIN=tee-pager.bin) ?

@helg If you follow the instructions in https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md, it will not build BL32.

Specifically, BL32 will only be built if uefi-build.sh is run with the -s option.

The builds 12 & 13 are not available anymore at
http://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/

Which version is now recommended? With build 23 I am stuck with following boot message:

NOTICE:  Booting Trusted Firmware
NOTICE:  BL1: v1.4(release):v1.4-183-g50915b89
NOTICE:  BL1: Built : 12:08:25, Sep 12 2017
NOTICE:  BL1: Booting BL2
NOTICE:  BL2: v1.4(release):v1.4-183-g50915b89
NOTICE:  BL2: Built : 12:08:25, Sep 12 2017
NOTICE:  BL1: Booting BL31
NOTICE:  BL31: v1.4(release):v1.4-183-g50915b89
NOTICE:  BL31: Built : 12:08:25, Sep 12 2017