Hikey960 Boot process BL2 error


#1

Hi,

I have flash my ATF and Android build. When I want to boot the hikey this error appear on the UART :

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 364ms.
Build Date: Dec 6 2017, 15:31:59
[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
density: 0x08080808,0x08080808,0x08080808,0x08080808,0x08080808,0x08080808,0x08080808,0x08080808
ddr info 0x000004ff
400M
685M
1067M
C0R,V0x00000031 e:66
C0R,V0x00000032 e:66
C1R,V0x00000032 e:66
C2R,V0x00000032 e:66
C3R,V0x00000032 e:66
C0R,V0x00000033 e:66
C1R,V0x00000033 e:66
C2R,V0x00000033 e:66
C3R,V0x00000033 e:66
C0R,V0x00000034 e:65
C1R,V0x00000034 e:65
C2R,V0x00000034 e:65
C3R,V0x00000034 e:65
C1R,V0x00000031 e:66
C2R,V0x00000031 e:66
C0R,V0x00000031 e:66
C1R,V0x00000032 e:66
C2R,V0x00000032 e:66
C3R,V0x00000032 e:66
C0R,V0x00000032 e:66
C1R,V0x00000033 e:66
C2R,V0x00000033 e:66
C3R,V0x00000033 e:66
C0R,V0x00000033 e:66
C1R,V0x00000034 e:66
C2R,V0x00000034 e:65
C3R,V0x00000034 e:65
1244M
1866M
pack0Idx0Dcc:1
pack1Idx0Dcc:0
pack2Idx0Dcc:1
pack3Idx0Dcc:1
iomcu_subsys_init
boot_c0 PROFILE 4
slave0 irq0:0x00000014
slave1 irq0:0x00000004
NOTICE: BL2: v1.4(release):v1.5-rc2
NOTICE: BL2: Built : 09:38:02, Aug 21 2018
NOTICE: ufs: H**** device must set VS_DebugSaveConfigTime 0x10
ERROR: BL2: Failed to load image (-2)

After few search on the forum I find a topic with the “same” issue : Hikey960 soft bricks ?

In this one its seems there are five component in the fip.bin but when I check my fip.bin and the fip.bin in the last Linaro Snapshot, there are only four component.

Linaro release

SCP Firmware SCP_BL2: offset=0x200, size=0x35100, cmdline="–scp-fw"
EL3 Runtime Firmware BL31: offset=0x35400, size=0x8010, cmdline="–soc-fw"
Secure Payload BL32 (Trusted OS): offset=0x3D600, size=0x44270, cmdline="–tos-fw"
Non-Trusted Firmware BL33: offset=0x81A00, size=0xF0000, cmdline="–nt-fw"

My fip.bin

SCP Firmware SCP_BL2: offset=0x200, size=0x35100, cmdline="–scp-fw"
EL3 Runtime Firmware BL31: offset=0x35400, size=0x8010, cmdline="–soc-fw"
Secure Payload BL32 (Trusted OS): offset=0x3D600, size=0x66B00, cmdline="–tos-fw"
Non-Trusted Firmware BL33: offset=0xA4200, size=0xF0000, cmdline="–nt-fw"

When in doubt in try to add the tb-fw component with fiptool but this change nothing.

My new fip.bin

Trusted Boot Firmware BL2: offset=0x100, size=0x6470, cmdline="–tb-fw"
SCP Firmware SCP_BL2: offset=0x6570, size=0x35100, cmdline="–scp-fw"
EL3 Runtime Firmware BL31: offset=0x3B670, size=0x8010, cmdline="–soc-fw"
Secure Payload BL32 (Trusted OS): offset=0x43680, size=0x66B00, cmdline="–tos-fw"
Non-Trusted Firmware BL33: offset=0xAA180, size=0xF0000, cmdline="–nt-fw"

I try to do make recovery like it’s said in the topic above but it doesn’t work :confused:

Thanks in advance


#2

AFAI BL2 is no more part of the fip package and is used as a l-loader. Did you correctly flash l-loader in recovery mode and then the prm_table and fip package in fastboot?


#3

In recovery mode I execute hikey_idt after that I pass in fastboot mode and execute the following :

fastboot flash ptable prm_ptable.img
fastboot flash xloader sec_xloader.img
fastboot flash fastboot l-loader.bin
fastboot flash fip fip.bin
ect …

To flash l-loader in recovery mode fastboot partition is right ?


#4

I try what you said and it seems to work. The board now stucks in load kernel.

---- boot time is 3697 ms----
load_kernel: boot_from_bl31: boot to trusted firmware. addr=0x00000000

This problem may come from my boot.img ?


#5

Yes this looks good.
I’ve just tested a latest snapshot [1] which works on my side:

NOTICE:  BL2: v1.5(release):v1.5-649-g7e8a891f
NOTICE:  BL2: Built : 09:20:38, Aug 14 2018
NOTICE:  BL2: Booting BL31
NOTICE:  BL31: v1.5(release):v1.5-649-g7e8a891f
NOTICE:  BL31: Built : 09:20:38, Aug 14 2018
I/TC:  
I/TC:  OP-TEE version: 3.0.0 #1 Tue Aug 14 09:20:35 UTC 2018 aarch64
I/TC:  Initialized
UEFI firmware (version Alpha built at 09:20:06 on Aug 14 2018)

Could you please confirm it works on your side and maybe update your board component by component to find which one goes wrong.

[1] https://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/


#6

I haven’t what you expected in UART with snapshot files :confused:.

l-loader need to be flash in recovery and fastboot mode ? Can you attach your UART to your next message ?

I added logs where the BL2 image is load and when I boot the hikey my message aren’t print on the UART, it seems the boot don’t pass at the same place that when I had the BL2 error.


Marginality with UFS chip change?
#7
  1. switch ON-ON-OFF, power-on the board
  2. Run hikey_idt

host:

$ sudo ./hikey_idt -c config -p /dev/ttyUSB1
0: Image: hisi-sec_usb_xloader.img Downalod Address: 0x20000
1: Image: hisi-sec_uce_boot.img Downalod Address: 0x6a908000
2: Image: recovery.bin Downalod Address: 0x1ac00000
...
downlaod address 0x1ac00000
Finish downloading
  1. Board then reboots, When prompt ‘Press ESCAPE for boot options .’ is displayed on console, press hotkey ‘f’.

console:

Press ESCAPE for boot options .Android Fastboot mode - version 0.7.
Press RETURN or SPACE key to quit.
  1. Device is in fastboot mode

host:

$ sudo fastboot devices
178F8AE603352AD7	fastboot
$ fastboot flash ptable prm_ptable.img
$ fastboot flash xloader hisi-sec_xloader.img
$ fastboot flash fastboot l-loader.bin
$ fastboot flash fip fip.bin
  1. Power-off, switch ON-OFF-OFF, Power-on

console:

NOTICE:  BL2: v1.5(release):v1.5-649-g7e8a891f
NOTICE:  BL2: Built : 09:20:38, Aug 14 2018
NOTICE:  BL2: Booting BL31
NOTICE:  BL31: v1.5(release):v1.5-649-g7e8a891f
NOTICE:  BL31: Built : 09:20:38, Aug 14 2018
I/TC:  
I/TC:  OP-TEE version: 3.0.0 #1 Tue Aug 14 09:20:35 UTC 2018 aarch64
I/TC:  Initialized
UEFI firmware (version Alpha built at 09:20:06 on Aug 14 2018)

#8

Thank you for your completed answer :slight_smile:
I found my mistake this morning.
My flash didn’t work as expected because after your step 4 I flashed the l-loader and after I powered off the board, switched it to ON - OFF - ON (to pass in Fastboot mode) and then I flashed the rest of images.

After a rebuild of the kernel I can boot the board with android + OP-TEE (Even if there is again few issues ^^).

Thank you


#9

@Loic, after the procedure:

rah@hrah:uefi_76$ sudo ./hikey_idt -c config.orig -p /dev/ttyUSB3
[sudo] password for rah: 
Config name: config.orig
Port name: /dev/ttyUSB3
0: Image: hisi-sec_usb_xloader.img Downalod Address: 0x20000
1: Image: hisi-sec_uce_boot.img Downalod Address: 0x6a908000
2: Image: recovery.bin Downalod Address: 0x1ac00000
Serial port open successfully!
Start downloading hisi-sec_usb_xloader.img@0x20000...
file total size 99584
downlaod address 0x20000
Finish downloading
Start downloading hisi-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
rah@hrah:uefi_76$ sudo fastboot devices
96Boards	fastboot
6965292720000000	fastboot
rah@hrah:uefi_76$ fastboot flash ptable prm_ptable.img
target reported max download size of 134217728 bytes
sending 'ptable' (24 KB)...
OKAY [  0.008s]
writing 'ptable'...

the host stuck in writing ptable an the console:

Press ESCAPE for boot options .Android Fastboot mode - version 0.7.
Press RETURN or SPACE key to quit.
Downloading 24576 bytes
   24576 /    24576 bytes downloaded (100%)
Flashing partition ptable


Synchronous Exception at 0x0000000000000000

only loading fastboot instead of recovery allows me to write ptable but then i got stuck loading “BL2” with error -2:

NOTICE:  BL2: v1.5(release):v1.5-649-g7e8a891f
NOTICE:  BL2: Built : 09:20:38, Aug 14 2018
ERROR:   BL2: Failed to load image (-2)

any advise?

Thanks,
F


#10

I assume your are using files from the uefi snapshot I linked above.
weird, which version/revision of the hikey960 do you have?


#11

yes, shuold be release #76. I have board ver. B I had the “Synchronous Exception” only with HK ufs not with SS one.