Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hikey960 hangs when writing ptable. #33

Open
Erik-Koning opened this issue May 15, 2018 · 25 comments
Open

Hikey960 hangs when writing ptable. #33

Erik-Koning opened this issue May 15, 2018 · 25 comments

Comments

@Erik-Koning
Copy link

Regarding the steps for releaving a booting process loop, when removing the 3-4 pin after the hikey_idt config command when specifically should i power cycle the device? I have tried a few different ways and non are successfuly flashing the device with the base image files. There is a section in the doc labeled "flash images by bootloader", is that process one I can try to fix a booting loop?

@hzhuang1
Copy link
Contributor

booting loop? Please share your log to us. What images are you using?

@Erik-Koning
Copy link
Author

Erik-Koning commented May 15, 2018

I may have caused this problem by incorrectly flashed an AOSP image with some code for kernel security hardening, but am not really sure how to reproduce this problem.

I have attempted to recover using this repositories recovery-flash.sh, and alternatively just the ./hikey_idt program which works well but then when I proceed to use fastboot flash [ptable | xloader | fastboot | etc] with each respective .img file the Hikey does not accept it as it appears to be stuck in a fastboot booting loop as shown below.

I believe this is the log for one complete loop:

dump_stack begin:
cmd_process: [fdt_next_tag]:
 		pc: 000000001ad214cc sp: 000000001afbfd10 
cmd_process: [fdt_next_node]:
 		pc: 000000001ad21650 sp: 000000001afbfd60 
cmd_process: [load_nomap_mem_config]:
 		pc: 000000001ad46128 sp: 000000001afbfda0 
cmd_process: [load_teeos_init]:
 		pc: 000000001ad990a0 sp: 000000001afbff10 
cmd_process: [start_armboot]:
 		pc: 000000001ad9a5fc sp: 000000001afbff70 
exception: 
dump_stack end.
bbox: record exce_type is 0x00000075
bbox: -------show exception info begin
bbox:  modid:          [0x81fff202]
bbox:  reboot_pri:     [0x00000001]
bbox:  dump_mod_mask:  [0x0000000000000003]
bbox:  reset_mod_mask: [0x0000000000000003]
bbox:  from_module:    [0x0000000000000001]
bbox:  reentrant:      [0x0f00da01]
bbox:  exce_type:      [0x00000075]
bbox:  reserve_u64:    [0x0000000000000000]
bbox:  reserve_p:      [0x00000000]
bbox: -------show exception info end
bbox: dump module [0000000000000001] start!
bbox: modid is 0x81fff202, etype is 0x00000075, mod_group_id is 0x0000000000000001
bbox: modid:[0x81fff202], coreid:[0x0000000000000001]
bbox: bbox_dump_done current mask:[0x0000000000000001]
bbox: dump module [0000000000000001] end!
bbox: Skip module [0x0000000000000001]
bbox: bbox_notify_module_dump done. return mask=[0x0000000000000001]
bbox: current mask:[0x0000000000000001]
bbox: all dump done
bbox: save_log_to_dfx():462:storage_read fail[-1]
bbox: p_module_ops->s_mod_group_id is [0x0000000000000001]
bbox: reset module [0x0000000000000001] start!
bbox: modid is 0x81fff202, etype is 0x00000075, mod_group_id is 0x0000000000000001
bbox: reset module [0x0000000000000001] end!
bbox: -------system reset
hikey960 boarid:5301 xloader use UART6
scsysstat_value[8].
clear reset source
last_keypoint31,reboot_type117
secdbg not DCU.
SecDbgVer exit
 xloader chipid is: 0x36600110, start at 478ms.
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
C1R,V0x0000002d e:66
C3R,V0x0000002d e:66
C0R,V0x0000002c e:66
C1R,V0x0000002e e:66
C2R,V0x0000002d e:66
C3R,V0x0000002e e:66
C0R,V0x0000002d e:66
C1R,V0x0000002f e:66
C2R,V0x0000002e e:66
C3R,V0x0000002f e:66
C0R,V0x0000002e e:66
C1R,V0x00000030 e:65
C2R,V0x0000002f e:65
C3R,V0x00000030 e:66
1244M
1866M
C0R,V0x00000015 e:193
C0R,V0x00000016 e:66
C2R,V0x00000016 e:113
C3R,V0x00000016 e:66
C0R,V0x00000017 e:66
C2R,V0x00000017 e:66
C3R,V0x00000017 e:66
iomcu_subsys_init
boot_c0 PROFILE 4

main:     ******** Fastboot for Kirin *****************
main:   ******** Build Date: Jun  2 2017, 17:34:24 **
main: ******** Fastboot start at 1846 ms **********

main: print soc_id computed in xloader phase, is below:
main: 00000000  main: 00000000  main: 00000000  main: 00000000  main: 
main: 00000000  main: 00000000  main: 00000000  main: 00000000  main: 
led_alwayson: can't get dtb operators
bbox: bbox_register_module_ops success.
bfm: : >>>>>enter bfm_init
bfm: : [disable_boot_fail_system] boot_fail_system state is 0
clock: PLL Stat
clock: PLL2 ctrl0=0x04909604,ctrl1=0x02000000
clock: PLL2 acpu en_stat:0x00000008, acpu gt_stat:0x00040000
clock: PLL2 final en_stat:0x00100000, final gt_stat:0x00020000
clock: PLL3 ctrl0=0x04904005,ctrl1=0x07000000
clock: PLL3 acpu en_stat:0x00000000, acpu gt_stat:0x00000000
clock: PLL3 final en_stat:0x00200000, final gt_stat:0x00040000
clock: clock init OK
ufs: ufs start on platform[36600110]ufs: ufs current mode: 0x00000011
ufs: ufs current gear: 0x00000003
ufs: ufs mphy reg 0x4A = 0x00000000
ufs: bUD0BaseOffset: 0x00000010, bUDConfigPLength: 0x00000010
ufs: UFS device manufacturerid = 0x00000198
ufs: UFS device: T******
bfm: : >>>>>enter set_boot_stage
bfm: : bootStageCode is 0x02000001, mntnStageCode is 27
bfm: : <<<<<exit set_boot_stage.
storage: emmc_ops invalid
storage: storage type is UFS
bfm: : bfm system is disabled!
storage: emmc_init: BL2_STAGE_EMMC_OK is 33554435!
bfm: : >>>>>enter set_boot_stage
bfm: : bootStageCode is 0x02000003, mntnStageCode is 29
bfm: : <<<<<exit set_boot_stage.
bfm: : >>>>>enter set_boot_stage
bfm: : bootStageCode is 0x02010001, mntnStageCode is 30
bfm: : <<<<<exit set_boot_stage.
ddr: current logic version is lpddr4 verison !!!
ddr: ddr size is 3072MB
bbox: register modid [0x81fff200]
bbox: register exception succeed.
bbox: register modid [0x81fff202]
bbox: register exception succeed.
bbox: register modid [0x81fff20b]
bbox: register exception succeed.
watchdog: Enable watchdog start
boardid: [BDID]boardid: 5301 
gpio: hikey960_gpio_init: GPIO 46 202 206 ouput low, GPIO 219 pullup.
load_kernel: register_update_dt_ops for usb!
usb: [USBERR]random_serial: fastboot serial: 4247257603000000
secureboot: Enter secboot_init: set pll efuse flag!
secureboot: pll efuse flag has been succ set!bbox: register modid [0x81fff20a]
bbox: register exception succeed.
secureboot: SECBOOT_DEV_INFO_DADDR = 0x1d7fff00, SECBOOT_DEV_INFO_SIZE = 0x00000040!
dtimage: number of dtb = 1
dtimage: =========uncompress_dtb_addr=[0x16f00000],====vrl_addr=[0x1b0e64e0]====
dtimage: [device_tree_get_dtb_entry:215] Verify Not Exist
dtimage: fdt_init success!
dtimage: -----can not find hisilicon,fastboot node by compatible 
dtimage: -----can not find hisilicon,fastboot node by compatible 
load_kernel: register_update_dt_ops for led!
dtimage: -----can not find hisilicon,fastboot node by compatible 
vibrator: vibrator_delay: hisilicon,fastboot motor-vib_type failed!
dtimage: -----can not find hisilicon,fastboot node by compatible 
vibrator: vibrator_off: hisilicon,fastboot motor-vib_type failed!
reboot_reason: scsysstat_value is 0x00000008
pmu: can not find fastboot,hisi-pmic-mntn node1 
pmu: pmu_property_read_u32 fastboot,hisi-pmic-mntn, hisilicon,data-width, failed
pmu: pmu_mntn_record_dts_parse failed!
reboot_reason: enter [check_hardware_reset]
reboot_reason: fdt_open_into failed.
reboot_reason: get_sysctrl_reason_data is error
ddr: reset dmc_rint_0:00000000
ddr: reset dmc_rint_1:00000000
ddr: reset dmc_rint_2:00000000
ddr: reset dmc_rint_3:00000000
ddr: new dmc_rint_0:00000000
ddr: new dmc_rint_1:00000000
ddr: new dmc_rint_2:00000000
ddr: new dmc_rint_3:00000000
bbox: save_tempbuffer_to_loop_area():727:storage_read fail[-1]
reboot_reason: reboot_reason is FASTBOOT_S_PANIC
reboot_reason: clear_reset_source in!
reboot_reason: tmp =0x0effcc70
dtimage: -----can not find fastboot,charger node by compatible 
power: get_chargerIC_type: getU32byCompatible fastboot,charger, hw_charger_type failed!
dtimage: -----can not find fastboot,coul node by compatible 
power: get_coul_type: get  coul_type failed!
power: get  coul_type failed!
power: hi6421v500 register coulometer ops fail!
dtimage: -----can not find huawei,hisi_bci_battery node by compatible 
no_module: [hi6523_get_config_info]: can't get battery board type
dtimage: -----can not find fastboot,charger node by compatible 
no_module: get hi6523 i2c reg num fail!
dtimage: -----can not find fastboot,charger node by compatible 
no_module: [hi6523_start_charging_by_init_params]: get ichrg_pre_limit fail
dtimage: -----can not find huawei,hi6523_charger node by compatible 
no_module: [hi6523_start_charging_by_init_params]: get reg fail
dtimage: -----can not find fastboot,buckboost node by compatible 
max77813: get_buckboost_type: getU32byCompatible fastboot,buckboost, hw_buckboost_type failed!
max77813: get dts buckboost type fail!
cpu_buck: pmu type3 not registered
cpu_buck: Bad cpu buck info:1
bbox: fdt_open_into failed.
mntn: tele_mntn_stat_point_init: can not bbox_ops !
dtimage: -----can not find hisilicon,fastboot node by compatible 
mntn: [tele_mntn_m3_wdt_config]: getU32byCompatible(hisilicon,fastboot, lpm3-board-type) error!
mntn: mntn init
mntndump: [MNTN]:fdt_open_into failed.
mntndump: mntn_dump_init failed
mntndump: get_mntn_dump_addr:mid[2] is not init
mntn: kernel dump is not available
mntn: reboot_type is 117
mntn: 
no need to dump_mem...
mntn: enter [registe_pstore_ramoops_dump]
mntndump: get_mntn_dump_addr:mid[5] is not init
mntn: no mdump_pstore info
mntn: M3_RDR_SYS_CONTEXT_BASE_ADDR is null
uart_cfg: [MNTN]:fdt_open_into failed.
uart_cfg: set_default_uart_cfg: uart_from_dts_read failed!
uart_cfg: module_idx 2, uart_no 6 
uart_cfg: odule_idx 11, uart_no 15 
uart_cfg: module_idx 2, uart_no 6 
uart_cfg: getU32byCompatible(hisilicon,fastboot, uart-board-type) error!
uart_cfg: boardid: 5301 use uart port: 6
pasr: in pasr_init-43 ...ddr: current logic version is lpddr4 verison !!!
ddr: current logic version is lpddr4 verison !!!
dtimage: -----can not find huawei,lcd_panel_type node by compatible 
display: [display]get_detect_type: huawei,lcd_panel_type: get detect_type fail
display: lcd:no lcd detect_type
no_module: [LOGO] get_logo_buffer_from_dtsi: fdt_open_into failed.
no_module: [LOGO] logo_init: logo init failed!!! used the default fb addr.
display: [display]jdi_nt35696_panel_init: lcd type is not JDI_NT35696_5P5_LCD.
display: [display]jdi_otm2503b_panel_init: lcd type is not JDI_OTM2503B_5P5_LCD.
bfm: : >>>>>enter set_boot_stage
bfm: : bootStageCode is 0x02010002, mntnStageCode is 31
bfm: : <<<<<exit set_boot_stage.
dtimage: -----can not find huawei,lcd_panel_type node by compatible 
display: [display]get_dts_value: can not get huawei,lcd_panel_type, bl_bus_id=4!
dtimage: -----can not find ti,lm36923 node by compatible 
display: [display]get_dts_value: can not get ti,lm36923, support=0!
display: get lm36923_support failed!
Audio_codec: [audio]:fdt_open_into failed.
load_teeos: can not find fb node fingerprint
load_teeos: failed to find fb node ese_config
display: [display]hisi_get_disp_info: hisifb_data is NULL pointer, return!
exception: "Synchronous Abort" handler, esr 0x96000021
exception: ELR:     000000001ad214cc
exception: LR:      000000001ad214c8
exception: x0: 0000000089f06669 x1: 0000000073206669
exception: x2: 0000000073206669 x3: 0000000073200000
exception: x4: 0000000000000066 x5: 0000000000000065
exception: x6: 0000000000000001 x7: 00000000ffffffc8
exception: x8: 000000001afbff10 x9: 000000001afbff10
exception: x10: 000000001ae9d000 x11: 000000000000000f
exception: x12: 0000000000000006 x13: 00000000ffd72044
exception: x14: 00000000ffd72040 x15: 00000000ffd72004
exception: x16: 00000000ffd72000 x17: 0000000100000000
exception: x18: 0000000000000000 x19: 0000000000000000
exception: x20: 000000001afbfe14 x21: 000000001afbfd9c
exception: x22: 0000000016d00000 x23: 0000000000000000
exception: x24: 000000001afbfe28 x25: 000000001ae1df28
exception: x26: 000000001ae03168 x27: 000000001afbfe14
exception: x28: 000000001adf8000 x29: 000000001afbfd10
exception: 
dump_stack begin:
cmd_process: [fdt_next_tag]:
 		pc: 000000001ad214cc sp: 000000001afbfd10 
cmd_process: [fdt_next_node]:
 		pc: 000000001ad21650 sp: 000000001afbfd60 
cmd_process: [load_nomap_mem_config]:
 		pc: 000000001ad46128 sp: 000000001afbfda0 
cmd_process: [load_teeos_init]:
 		pc: 000000001ad990a0 sp: 000000001afbff10 
cmd_process: [start_armboot]:
 		pc: 000000001ad9a5fc sp: 000000001afbff70 
exception: 
dump_stack end.

@hzhuang1
Copy link
Contributor

You're using Hisilicon property bootloader. Maybe it's time to switch to ATF/UEFI now.

@Erik-Koning
Copy link
Author

Your suggesting i follow the recovery-flash-uefi.sh script to restore?

@Erik-Koning
Copy link
Author

As an update i tried to install via prebuilt uefi, as described in the folder "install-prebuilt-uefi", It appeared to be successful for all steps until i had to leave recovery mode to normal mode and then the same behavior as above was observed. Looking closer at some of the log does it appear y hardware is damaged? I have been careful when handling it, no observable events have occurred that would seem to have damaged it.

Same log as above:
reboot_reason: enter [check_hardware_reset] reboot_reason: fdt_open_into failed. reboot_reason: get_sysctrl_reason_data is error ddr: reset dmc_rint_0:00000000 ddr: reset dmc_rint_1:00000000 ddr: reset dmc_rint_2:00000000 ddr: reset dmc_rint_3:00000000 ddr: new dmc_rint_0:00000000 ddr: new dmc_rint_1:00000000 ddr: new dmc_rint_2:00000000 ddr: new dmc_rint_3:00000000 bbox: save_tempbuffer_to_loop_area():727:storage_read fail[-1] reboot_reason: reboot_reason is FASTBOOT_S_PANIC reboot_reason: clear_reset_source in! reboot_reason: tmp =0x0effcc70 dtimage: -----can not find fastboot,charger node by compatible power: get_chargerIC_type: getU32byCompatible fastboot,charger, hw_charger_type failed! dtimage: -----can not find fastboot,coul node by compatible power: get_coul_type: get coul_type failed! power: get coul_type failed! power: hi6421v500 register coulometer ops fail! dtimage: -----can not find huawei,hisi_bci_battery node by compatible no_module: [hi6523_get_config_info]: can't get battery board type dtimage: -----can not find fastboot,charger node by compatible no_module: get hi6523 i2c reg num fail! dtimage: -----can not find fastboot,charger node by compatible no_module: [hi6523_start_charging_by_init_params]: get ichrg_pre_limit fail dtimage: -----can not find huawei,hi6523_charger node by compatible no_module: [hi6523_start_charging_by_init_params]: get reg fail dtimage: -----can not find fastboot,buckboost node by compatible max77813: get_buckboost_type: getU32byCompatible fastboot,buckboost, hw_buckboost_type failed! max77813: get dts buckboost type fail! cpu_buck: pmu type3 not registered cpu_buck: Bad cpu buck info:1

@hzhuang1
Copy link
Contributor

It's the same log of Hisilicon property bootloader. It's not the log of ATF/UEFI.

When you download images into the hardware in recovery mode, you need to run "fastboot flash" commands to burn l-loader.bin & fip.bin first. You need to reference the scripts, "recovery-flash-uefi.sh".

@Erik-Koning
Copy link
Author

Erik-Koning commented May 16, 2018

Thanks for the guidance, but still having issues.
I referenced the "recovery-flash-uefi.sh" and performed the following:
Note: ttyUSB0 is my usb C OTG connection to the Hikey960

sudo ./hikey_idt -c ./config -p /dev/ttyUSB0

Config name: ./config
Port name: /dev/ttyUSB0
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

fastboot flash fastboot ./l-loader.bin

target reported max download size of 134217728 bytes
sending 'fastboot' (25 KB)...
OKAY [ 0.008s]
writing 'fastboot'...
FAILED (remote: No such partition.)
finished. total time: 0.011s

fastboot flash ptable ./prm_ptable.img

target reported max download size of 134217728 bytes
sending 'ptable' (24 KB)...
OKAY [ 0.008s]
writing 'ptable'...

It has been writing the 'ptable' for 5 hours now. It seems i must write the ptable in order to burn l-loader.bin & fip.bin first.

The serial port of the hikey960 displays Synchronous Exception at 0x0000000000000000 when the writing 'ptable' hangs.

@hzhuang1
Copy link
Contributor

Does it mean that you always meet hang when you flush ptable?

@Erik-Koning
Copy link
Author

Erik-Koning commented May 17, 2018

Yes, flashing the ptable is always as far as i can make it. I have discovered how to access the Android Fastboot boot manager menu through the serial line that my serial board provides if that can be helpful for solving this issue?

@hzhuang1
Copy link
Contributor

Could you help to check whether you're fetching the latest code of all repositories? Or, you can use the prebuilt binaries to test first. (https://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey/release/) Now the latest one is build #70.

@Erik-Koning
Copy link
Author

Erik-Koning commented May 17, 2018

I remember downloading the #70 build but my folder contained hisi_idt binaries not hisi-idt.py. It was also missing the ptable-aosp-4g.img / ptable-aosp-8g.img. I will try this idt version and ptable image in a few hours. Thanks for the link.
Where can i determine which filesystem my hikey960 has? 4gb or 8gb?
I found this wiki very informative but not clear how to find which filesystem version.

@hzhuang1
Copy link
Contributor

Oh, you're running on HiKey960. I'm sorry to give the wrong link. The right one is at here. (https://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/)

@Erik-Koning
Copy link
Author

Erik-Koning commented May 17, 2018

Here I am trying again with the latest hikey960 release files as linked above.
After correctly setting up recovery mode, my UEFI_70 directory to store all latest release files, and ttyUSB0 and ttyUSB1 for OTG i run:
sudo ./hikey_idt -c config -p /dev/ttyUSB1
Using picocom reading ttyUSB0 i get:

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 122452ms.
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
UfsLuInit ret:0
UsbMode, nvData invalid
rtc_nve_read failed !
Hikey960[5301] no need avs_init.
ddr ft:0xf20332a3,mode:1 target:4
[USBI]driver init:0003e800 0003f840 00000000
[USBI]download start! total_frame:24
+1 0|+2 0|+3 0|+4 0|+5 0|+6 0|+7 0|+8 0|+9 0|+10 0|+11 0|+12 0|+13 0|+14 0|+15 0|+16 0|+17 0|+18 0|+19 0|+20 0|+21 0|+22 0|+23 0|+24 0|
[USBI]expected:23680, received:23680 (bytes)
[USBI]download suc
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,V0x0000002d e:66
C2R,V0x0000002d e:66
C3R,V0x0000002d e:66
C0R,V0x0000002d e:66
C1R,V0x0000002e e:66
C2R,V0x0000002e e:66
C3R,V0x0000002e e:66
C0R,V0x0000002e e:66
C1R,V0x0000002f e:66
C2R,V0x0000002f e:65
C3R,V0x0000002f e:66
C0R,V0x0000002f e:65
C1R,V0x00000030 e:65
C2R,V0x00000030 e:65
C3R,V0x00000030 e:66
1244M
1866M
C0R,V0x00000015 e:193
C3R,V0x00000015 e:113
C0R,V0x00000016 e:66
C3R,V0x00000016 e:66
C0R,V0x00000017 e:66
C2R,V0x00000017 e:66
C3R,V0x00000017 e:66
UsbMode, nvData invalid
UsbMode, nvData invalid
UsbMode, nvData invalid
[USBI]driver init:0003e800 0003f840 00000000
[USBI]download start! total_frame:1152
+1 0|+2 0|+3 0|+4 0|+5 0|+6 0|+7 0|+8 0|+9 0|+10 0|+11 0|+12 0|+13 0|+14 0|+15
0|+16 0|+17 0|+18 0|+19 0|+20 0|+21 0|+22 0|+23 0|+24 0|+25
DOWNLOADING
0|+1150 0|+1151 0|+11520|
[USBI]expected:1179648, received:1179648 (bytes)
[USBI]download suc
iomcu_subsys_init
boot_c0 PROFILE 4
slave0 irq0:0x00000004
slave1 irq0:0x00000004
NOTICE: Booting Trusted Firmware
NOTICE: BL1: v1.5(release):v1.5-149-gda9d1d59
NOTICE: BL1: Built : 13:29:43, May 14 2018
NOTICE: BL1-FWU: FWU Process Started
UEFI firmware (version Alpha built at 13:29:12 on May 14 2018)
WARNING: CAN NOT BOOT KERNEL IN RECOVERY MODE!
Switch to normal boot mode, then reboot to boot kernel.

Press ESCAPE for boot options .Android Fastboot mode - version 0.7.
Press RETURN or SPACE key to quit.

ttyUSB1 Console:

Config name: config
Port name: /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
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

But then again i attempt to flash the ptable and fails:
fastboot flash ptable prm_ptable.img
ttyUSB0:

Downloading 24576 bytes
24576 / 24576 bytes downloaded (100%)
Flashing partition ptable

Synchronous Exception at 0x0000000000000000

ttyUSB1 Console:

target reported max download size of 134217728 bytes
sending 'ptable' (24 KB)...
OKAY [ 0.008s]
writing 'ptable'...

@Erik-Koning Erik-Koning changed the title Technical-readme Clarification Hikey960 hangs when writing ptable. May 17, 2018
@hzhuang1
Copy link
Contributor

How many boards do you have? Do you have the same issue on other boards?

@Erik-Koning
Copy link
Author

We have two identical boards, the other one is able to be recovered.

@hzhuang1
Copy link
Contributor

Up to now, I doubt it's a hardware issue. Since we don't have the synchronous exception issue in recovery mode.

@hzhuang1
Copy link
Contributor

Other guy is also reporting this issue. Maybe there's something wrong in UFS driver. Need to investigate it.

@hzhuang1
Copy link
Contributor

Could you help to check what the difference on the two boards? vendors on UFS chips?

@Erik-Koning
Copy link
Author

It is a LeMaker Hikey960 (specifies Ver.B on the board), 4 cortex A73 + 4 cortex A53 Big.Little CPU architecture, ARM Mali G71 MP8 GPU

@Erik-Koning
Copy link
Author

Erik-Koning commented Jun 5, 2018

SOLVED by following these steps:

git clone https://github.com/96boards-hikey/tools-images-hikey960.git
cd tools-images-hikey960/install-prebuilt-uefi
place hikey960 in restore mode 1:on 2:on 3:off
Connect as usb0 with type c usb
sudo ./hikey960-efi-prebuilt.sh -r -v 57

The above line downloads & installs the uefi on the board
Note: 57 is the version of UEFI released by Linaro so make sure you download the correct one.It might change over a period of time.

If the device becomes stuck waiting for devices, I found restarting the device in recovery-mode, and then running either the recovery-flash-uefi.sh, or the recovery-flash.sh script for whatever reason cleared out the device rom memory so i was able to go back and try the "install-prebuilt-uefi" step again.
Im not sure why this procedure was necessary, but for me it fixed the device from being stuck waiting for devices.

Use fastboot to flash OS after this point.

On hikey board switch to fastboot mode 1:on 2:off 3:on
call flash-starting-from-fastboot.sh script below from bbry_kerenel_hikey installer dir with stock android binaries.


#!/bin/bash
INSTALLER_DIR="dirname ${0}"

for cases that don’t run "lunch hikey960-userdebug

if [ -z “${ANDROID_BUILD_TOP}” ]; then
ANDROID_BUILD_TOP=${INSTALLER_DIR}/…/…/…/…/…/
ANDROID_PRODUCT_OUT="${ANDROID_BUILD_TOP}/out/target/product/hikey960"
fi

if [ ! -d “${ANDROID_PRODUCT_OUT}” ]; then
echo “error in locating out directory, check if it exist”
exit
fi

echo “android out dir:${ANDROID_PRODUCT_OUT}”

fastboot flash fastboot “${INSTALLER_DIR}”/fastboot.img
fastboot flash nvme “${INSTALLER_DIR}”/nvme.img
fastboot flash fw_lpm3 “${INSTALLER_DIR}”/lpm3.img
fastboot flash trustfirmware “${INSTALLER_DIR}”/bl31.bin

fastboot flash boot “${ANDROID_PRODUCT_OUT}”/boot.img
fastboot flash dts “${ANDROID_PRODUCT_OUT}”/dt.img
fastboot flash system “${ANDROID_PRODUCT_OUT}”/system.img
#fastboot flash vendor “${ANDROID_PRODUCT_OUT}”/vendor.img
fastboot flash cache “${ANDROID_PRODUCT_OUT}”/cache.img
fastboot flash userdata “${ANDROID_PRODUCT_OUT}”/userdata.img

On hikey board switch to run mode 1:on 2:off 3:off plug in hdmi is desired and then power board.

@hzhuang1
Copy link
Contributor

hzhuang1 commented Jun 6, 2018

Could you help to format a patch?

@mpadiy
Copy link

mpadiy commented Jun 8, 2018

Hi , i did as Erik-Koning said , all was ok before echo “Sleeping till device resets… zzz” sleep 15
and after that always show < waiting for device > , unable to fastboot below :

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

what am I wrong , and what to do ?

@Erik-Koning
Copy link
Author

@mpadiy Sorry for the late respone.
Ive had that issue too, I found restarting the device in recovery-mode, and then running either the recovery-flash-uefi.sh, or the recovery-flash.sh script for whatever reason cleared out the device rom memory so i was able to go back and try the "install-prebuilt-uefi" step again.

Im not sure why this procedure was necessary, but for me it fixed the device from being stuck waiting for devices.

@Erik-Koning
Copy link
Author

Erik-Koning commented Jun 13, 2018

Refined instructions:

If the board experiences an interrupt when flashing or a mysterious event occurs that causes the board to software brick, the boards base firmware/UEFI must be flashed before an OS can be flashed.

The following steps restored a software bricked Hikey960 that was observed to be in a fastboot booting-loop, back to being flashed with AOSP source code, and a fastboot boot rom:

git clone https://github.com/96boards-hikey/tools-images-hikey960.git
Place the board into recovery mode.
Switch 1 : ON
Switch 2 : ON
Switch 3 : OFF
Connect the type C USB cable to the host and board and make sure it is configured as ttyUSB1 (dmesg or observe the /dev directories when type C connected). Power on board.
cd tools-images-hikey960/install-prebuilt-uefi
sudo ./hikey960-efi-prebuilt.sh -r -v 57
The above line downloads & installs the uefi on the board, the board will then be in an android fastboot mode and 4 partitions are flashed.
Note: 57 is the version of UEFI released by Linaro so make sure you download the correct one.
It might change over a period of time, but most older versions should be compatible.
If the board is hung waiting for devices, restart in recovery mode and run the recovery-flash.sh (non-uefi) script to overwrite old memory before rebooting, and trying step 5 again.
Power off the board and place the board into fastboot mode.
Switch 1 : ON
Switch 2 : OFF
Switch 3 : ON
Configure environment, config files if desired (see here for hdmi display config), and build a complete android kernel's .img files.
Use this script:

#!/bin/bash

INSTALLER_DIR="dirname ${0}"

#for cases that don't run "lunch hikey960-userdebug"
if [ -z "${ANDROID_BUILD_TOP}" ]; then
ANDROID_BUILD_TOP=${INSTALLER_DIR}/../../../../../
ANDROID_PRODUCT_OUT="${ANDROID_BUILD_TOP}/out/target/product/hikey960"
fi

if [ ! -d "${ANDROID_PRODUCT_OUT}" ]; then
echo "error in locating out directory, check if it exist"
exit
fi

echo "android out dir:${ANDROID_PRODUCT_OUT}"

fastboot flash fastboot "${INSTALLER_DIR}"/fastboot.img
fastboot flash nvme "${INSTALLER_DIR}"/nvme.img
fastboot flash fw_lpm3 "${INSTALLER_DIR}"/lpm3.img
fastboot flash trustfirmware "${INSTALLER_DIR}"/bl31.bin

fastboot flash boot "${ANDROID_PRODUCT_OUT}"/boot.img
fastboot flash dts "${ANDROID_PRODUCT_OUT}"/dt.img
fastboot flash system "${ANDROID_PRODUCT_OUT}"/system.img
#fastboot flash vendor "${ANDROID_PRODUCT_OUT}"/vendor.img
fastboot flash cache "${ANDROID_PRODUCT_OUT}"/cache.img
fastboot flash userdata "${ANDROID_PRODUCT_OUT}"/userdata.img

to flash the AOSP fastboot and image files to bring back original flashing functionality.
Note: Make sure the scripts path variables are configured correctly to point to the relevant image files. for a linaro kernel you may want to put this script with the other flash-all.sh script found in "/device/linaro/hikey/installer/hikey960".
place the board into run-mode, connect HDMI, and power on board.

@hzhuang1
Copy link
Contributor

@Erik-Koning Could you help to format a patch on it? Then we could merge your patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants