Does Hikey960 support booting 'kernel + ramdisk' using fasboot's boot command?


#1

Hello,

I got a Hikey960 target board with permanently damaged UFS chip.

So my query is, can I make use of recovery mode and get fastboot running.
From fastboot can I boot linux kernel and ramdisk using fasboot’s boot command?

Anybody tried, fasboot’s boot command with hikey960?

Thanks in advance,
Sreenad.


#2

I did not try, but ‘fastboot boot’ should work yes.


#3

I tried booting a boot.img just to see what happens,
It looks like, the fastboot’s boot command is not supported at hikey960 side.

Logs from host side

ubuntu@linux:~$ fastboot boot Hikey_960/AOSP/out/target/product/hikey960/boot.img
downloading 'boot.img'...
OKAY [  0.311s]
booting...
FAILED (remote: invalid command)
finished. total time: 0.314s

Logs from hikey960 serial console

usbloader: usb_rx_cmd_complete() 'download:0099a000', size is 0x00000011
usbloader: usb_rx_cmd_complete() 'boot', size is 0x00000004
usbloader: invalid cmd boot

I think this command will have some platform dependency like DRAM address to load and execute.

Anybody have a working reference or idea to make this work?

Thanks in advance,
Sreenad.


#4

I have updated the UEFI bootloader package to latest.

After that, the command is accepting data.

Now I am getting data format related errors.

I think it can accept boot.img (inside this, there has to be a kernel appended with dtb).

I have kernel appended with dtb. But from that I have to create boot.img

i have seen somewhere a tool like mkboot.img.

I have to try that I guess.

I shall update if I get any progress.


#5

I succeeded in booting using fasboot boot command.

Installed abootimg package in my ubuntu and created the boot.img as follows.

$ sudo apt-get install abootimg
$ cd l-loader
$ vim bootimg-960.cfg 

Deleted bootsize entry from the above config file.

$ abootimg --create myboot.img -k ~/Image-dtb -r ramdisk.img -f bootimg-960.cfg
$ fasboot boot myboot.img
Note:
I could not get a ramdisk now, so just created a dummy file.
Image-dtb is created by setting dtb appending config in kernel’s “Boot Option” menu.
After that, ‘make Image-dtb’

Kernel could boot till rootfs mounting stage.
As the ramdisk here is dummy, I got a crash as expected.

Anyways I could boot hikey960 ‘kernel+dtb+ramdisk’ directly from fasboot without flashing.


#6

You could try to use the prebuilt ramdisk.img: http://snapshots.linaro.org/96boards/hikey960/linaro/aosp-master/629/ramdisk.img; I tried at my side I can see “sudo fastboot boot boot.img” can work well without panic.


#7

Thanks @leo-yan for the ramdisk link.

Today I got an observation like below.

Few day’s back I confirmed I could boot a kernel (boot.img) directly with fasboot’s boot command.
That was with fastboot option during normal boot.

Today, I tried the recovery mode and used recovery.bin to get a fastboot running on hikey960.
But in this way, fastboot could receive and process the boot.img like before, but it did not execute it.
Looks like fastboot could not jump to kernel entry point. ( I mean, no prints from kernel)

Any idea about this?


#8

If you mean using recovery.bin to support “fastboot boot” command, I believe this is not expected so far :frowning:

Please see the code [1], it generate recovery.bin with two images: bl1.bin and BL33_AP_UEFI.fd, this is the short cut to change CPU mode from EL3 to NS-EL2 and reuse the fastboot related functionality in UEFI; but it absent to support runtime firmware for EL3 (e.g. PSCI for power management), this results in any invoking ‘SMC’ instruction will introduce system crash when boot Linux kernel.

So recovery.bin can only be used for “fastboot flash” sub command to flash images.

[1] https://github.com/96boards-hikey/l-loader/blob/testing/hikey960_v1.2/hikey960.mk#L18


#9

Thank @leo-yan for the explanation.

Few queries.

but it absent to support runtime firmware for EL3

What is the file-name of the above firmware?

As you said , it is not possible now with the existing method.
But. is it possible to achieve the same (by someone other than Hisilicon team)?

I would like to have a look into this.
But I could not find any detailed information about Hikey960’s boot flow.

Regards,
Sreenad.


#10

Thank @leo-yan for the explanation.

Few queries.

but it absent to support runtime firmware for EL3

What is the file-name of the above firmware?

The firmware naming definition usually we are referring to ARM-TF doc
[1]. So for runtime firmware of EL3, usually it’s naming as BL31
which are provided by ARM trusted firmware.

As you said , it is not possible now with the existing method.
But. is it possible to achieve the same (by someone other than Hisilicon team)?

AFAIK, Hisilicon and Linaro have no plan to support “fastboot boot” in
recovery mode. Could you give more info why you want to use “fastboot
boot” in recovery mode? Usually recovery mode is only used to
recovery board and from then on you could only use normal booting
method, you also can flash booting images with normal booting method.

So I am a bit confused this requirement for support “fastboot boot” in
recovery mode.

I would like to have a look into this.
But I could not find any detailed information about Hikey960’s boot flow.

For Hikey960, I think we are almostly complying with the standard
booting sequence defined by ARM-TF. Please note, usually for booting
is also relative with secure boot, AFAIK, we can use the simple way to
without support secure booting, or we can enable secure booting and
integration with OP-TEE.

You could find the doc [2] to check more info about the booting
images and the related source code for Hikey960.

[1] https://github.com/ARM-software/arm-trusted-firmware/blob/master/docs/firmware-design.rst
[2] https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md

Thanks,
Leo Yan