Fastboot boot <boot.img> doesn't work but flash does

Hi there !

I compiled a kernel for my DB410.

I am trying to boot it using
$ fastboot boot boot.img

Following the instructions that can be found here: https://builds.96boards.org/releases/dragonboard410c/linaro/debian/17.06.1/

Unfortunately, the device doesn’t boot. It starts the booting protocol and ends with:

[140] [140] Error reading MISC partition
[140] [140] failed to get ffbm cookie[140] [140] ERROR: Invalid boot image header
[150] [150] ERROR: Could not do normal boot. Reverting to fastboot mode.
[150] [150] Invalid partition index
[160] [160] Invalid partition index
[160] [160] Invalid partition index
[170] [170] fastboot_init()
[170] [170] Error: ssd partition not found
[280] [280] USB init ept @ 0x8f697000
[300] [300] udc_start()

However if I use:
$ fastboot flash boot boot.img
And then boot, it does work correctly.

Any idea why the device cannot be boot just using fastboot boot ?

Thanks !

Could you please display full log from the start of bootloader.
Have you updated your LK/aboot recently ?

Hello !
Thanks for the help here’s my procedure with the full logs.

To give you a bit more info on my procedure:

But if I flash the exact same image:

My LK/aboot is updated following the instructions on the kernel build page Debian 17.06.1 that I posted before.

Thanks !

Actually both of them fail after:

Warning: File system check failed but did not detect errors
[ 3.775029] msm_otg 78d9000.phy: USB in low power mode

Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset), D - Delta, S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.BF.3.0-00286
S - IMAGE_VARIANT_STRING=HAAAANAZA

In the first case (boot), since the boot partition is empty device is unable to reboot.
In the second case (flash) reboot happens, but the second reboot is OK.
In both cases reboot happens after msm_otg 78d9000.phy: USB in low power mode

Your usb otg seems to be runtime suspended and crash happens, not sure it’s linked.

Thanks for the precision.

Yes I noticed this behavior.
Then why the usb otg needs two boot phases to work ?

Also I can’t do a second fastboot boot, after the first one the board doesn’t go back to fastboot mode (even though it says it does).

Any idea on how to get it working ? As it is writtend in the doc I expected it to work right away

OK, I just made a test.

If I unplug the USB otg after running $ fastboot boot boot.img
The board does boot correctly.

But still it is not a solution, I need to have my board connected to USB otg all the time. I won’t be able to manually operate it every time I want to boot a new kernel…

Thanks for the help !

EDIT: Definitely not a solution. When I replug the USB otg cable the board crashes with log:
[ 29.564990] msm_hsusb_host 78d9000.ehci: remove, state 4
[ 29.565101] usb usb1: USB disconnect, device number 1
[ 29.569698] usb 1-1: USB disconnect, device number 2
[ 29.590391] msm_hsusb_host 78d9000.ehci: USB bus 1 deregistered
[ 29.780493] msm_otg 78d9000.phy: Avail curr from USB = 1500
[ 30.812148] msm_otg 78d9000.phy: USB in low power mode
[ 32.295273] Unhandled fault: synchronous external abort (0x96000010) at 0xffff0000092fc1a4

For debug purpose could you try the following before reconnecting:
$ echo on > /sys/bus/platform/devices/soc/78d9000.phy/power/control

This would confirm the issue is related to usb otg suspend.

Are you using the boot img release or a custom one ?

This works:

root@linaro-alip:~# echo on > /sys/bus/platform/devices/soc/78d9000.phy/power/control
root@linaro-alip:~# cat /sys/bus/platform/devices/soc/78d9000.phy/power/control
on
root@linaro-alip:~# [ 66.764493] msm_hsusb_host 78d9000.ehci: remove, state 4
[ 66.872135] hub 1-0:1.0: activate → -108
[ 66.872278] hub 1-0:1.0: hub_ext_port_status failed (err = -108)
[ 66.872293] usb usb1: USB disconnect, device number 1
[ 66.890268] usb 1-1: USB disconnect, device number 2
[ 66.895084] msm_hsusb_host 78d9000.ehci: USB bus 1 deregistered
[ 67.084035] msm_otg 78d9000.phy: Avail curr from USB = 1500
[ 69.600335] msm_hsusb_host 78d9000.ehci: EHCI Host Controller
[ 69.600463] msm_hsusb_host 78d9000.ehci: new USB bus registered, assigned bus number 1
[ 69.613071] msm_hsusb_host 78d9000.ehci: irq 150, io mem 0x078d9000
[ 69.627989] msm_hsusb_host 78d9000.ehci: USB 2.0 started, EHCI 1.00
[ 69.628284] usb usb1: runtime PM trying to activate child device usb1 but parent (78d9000.ehci) is not active
[ 69.639816] hub 1-0:1.0: USB hub found
[ 69.643386] hub 1-0:1.0: 1 port detected
[ 69.979905] usb 1-1: new high-speed USB device number 2 using msm_hsusb_host
[ 70.129466] hub 1-1:1.0: USB hub found
[ 70.129648] hub 1-1:1.0: 3 ports detected
[ 71.992274] msm_hsusb_host 78d9000.ehci: remove, state 4
[ 72.099903] hub 1-0:1.0: activate → -108
[ 72.100045] hub 1-0:1.0: hub_ext_port_status failed (err = -108)
[ 72.100075] usb usb1: USB disconnect, device number 1
[ 72.118077] usb 1-1: USB disconnect, device number 2
[ 72.123157] msm_hsusb_host 78d9000.ehci: USB bus 1 deregistered
[ 73.132115] msm_otg 78d9000.phy: USB in low power mode

root@linaro-alip:~# ls
root@linaro-alip:~#

could I enable that in the driver by default ?

FYI if I try the same thing with boot-linaro-jessie-qcom-snapdragon-arm64-20161006-144.img

I do not get the crash and the board boots up using boot.
So there is a regression between kernel 4.4.23 and 4.9.39

Link I used to get the boot image
https://builds.96boards.org/releases/dragonboard410c/linaro/debian/16.09/

Thanks Loic for helping me investigate this issue.

@Loic

Are you using the boot img release or a custom one ?

I tried with the release and custom. Ideally I’d like to use a custom one but if I can get this to work with the release I can port it easily to my custom one.

Thanks, I try to identify the failing path, but not able to reproduce on my side.

Could you please enable debug msg for the usb otg phy driver and try to reproduce the issue, by removing cable at boot and inserting it after the following:
$ echo 'module phy_msm_usb +p' > /sys/kernel/debug/dynamic_debug/control
$ dmesg -n 8

For my interest, Do you reproduce the issue when connecting to external usb hub ?

root@linaro-alip:~# echo ‘module phy_msm_usb +p’ > /sys/kernel/debug/dynamic_debug/control
root@linaro-alip:~# dmesg -n 8
root@linaro-alip:~# [ 51.487223] msm_otg 78d9000.phy: OTG_STATE_A_HOST state
[ 51.487285] msm_otg 78d9000.phy: host off
[ 51.496685] msm_hsusb_host 78d9000.ehci: remove, state 1
[ 51.594840] hub 1-0:1.0: activate → -108
[ 51.594981] hub 1-0:1.0: hub_ext_port_status failed (err = -108)
[ 51.595010] usb usb1: USB disconnect, device number 1
[ 51.612931] usb 1-1: USB disconnect, device number 2
[ 51.617280] msm_hsusb_host 78d9000.ehci: USB bus 1 deregistered
[ 51.617404] msm_otg 78d9000.phy: OTG_STATE_B_IDLE state
[ 51.623203] msm_otg 78d9000.phy: chg detection work
[ 51.730865] msm_otg 78d9000.phy: chg detection work
[ 51.774848] msm_otg 78d9000.phy: chg detection work
[ 51.818783] msm_otg 78d9000.phy: chg detection work
[ 51.818833] msm_otg 78d9000.phy: charger = 2
[ 51.822470] msm_otg 78d9000.phy: OTG_STATE_B_IDLE state
[ 51.827438] msm_otg 78d9000.phy: Avail curr from USB = 1500
[ 51.832272] msm_otg 78d9000.phy: OTG runtime idle
[ 52.862996] msm_otg 78d9000.phy: OTG runtime suspend
[ 52.863092] reg (LPM)
[ 52.867995] msm_hsusb_config_vddcx: min_vol:500000 max_vol:1320000
[ 52.869236] msm_otg 78d9000.phy: USB in low power mode

Then reboots

DO you mean if I connect an USB hub to the USB port of the board after the boot ?
If yes then:

[ 29.172655] usb 1-1.1: new high-speed USB device number 3 using msm_hsusb_host
[ 29.286357] hub 1-1.1:1.0: USB hub found
[ 29.286729] hub 1-1.1:1.0: 4 ports detected
[ 29.604575] usb 1-1.1.4: new high-speed USB device number 4 using msm_hsusb_host
[ 29.728897] hub 1-1.1.4:1.0: USB hub found
[ 29.729189] hub 1-1.1.4:1.0: 4 ports detected
[ 30.040649] usb 1-1.1.4.3: new full-speed USB device number 5 using msm_hsusb_host
[ 30.165176] hub 1-1.1.4.3:1.0: USB hub found
[ 30.165482] hub 1-1.1.4.3:1.0: 3 ports detected
[ 30.464586] usb 1-1.1.4.3.1: new full-speed USB device number 6 using msm_hsusb_host
[ 30.579264] input: Dell Dell USB Keyboard Hub as /devices/platform/soc/78d9000.ehci/usb1/1-1/1-1.1/1-1.1.4/1-1.1.4.3/1-1.1.4.3.1/1-1.1.4.3.1:1.0/0003:413C:2010.0001/input/input2
[ 30.638341] hid-generic 0003:413C:2010.0001: input: USB HID v1.10 Keyboard [Dell Dell USB Keyboard Hub] on usb-78d9000.ehci-1.1.4.3.1/input0
[ 30.645509] input: Dell Dell USB Keyboard Hub as /devices/platform/soc/78d9000.ehci/usb1/1-1/1-1.1/1-1.1.4/1-1.1.4.3/1-1.1.4.3.1/1-1.1.4.3.1:1.1/0003:413C:2010.0002/input/input3
[ 30.709545] hid-generic 0003:413C:2010.0002: input: USB HID v1.10 Device [Dell Dell USB Keyboard Hub] on usb-78d9000.ehci-1.1.4.3.1/input1
[ 32.440645] usb 1-1.1.4.4: new low-speed USB device number 7 using msm_hsusb_host
[ 32.618109] input: USB OPTICAL MOUSE as /devices/platform/soc/78d9000.ehci/usb1/1-1/1-1.1/1-1.1.4/1-1.1.4.4/1-1.1.4.4:1.0/0003:093A:2521.0003/input/input4
[ 32.677341] hid-generic 0003:093A:2521.0003: input: USB HID v1.11 Mouse [USB OPTICAL MOUSE] on usb-78d9000.ehci-1.1.4.4/input0

No crash

Even if I reconnect the USB otg to the hub it doesn’t crash

[ 16.721823] wlan0: authenticate with e0:ac:f1:c0:3b:40
[ 16.767875] wlan0: send auth to e0:ac:f1:c0:3b:40 (try 1/3)
[ 16.771782] wlan0: authenticated
[ 16.774697] wcn36xx a204000.wcnss:smd-edge:wcnss:wifi wlan0: disabling HT as WMM/QoS is not supported by the AP
[ 16.775738] wcn36xx a204000.wcnss:smd-edge:wcnss:wifi wlan0: disabling VHT as WMM/QoS is not supported by the AP
[ 16.794277] wlan0: associate with e0:ac:f1:c0:3b:40 (try 1/3)
[ 16.798739] wlan0: RX AssocResp from e0:ac:f1:c0:3b:40 (capab=0x411 status=0 aid=10)
[ 16.831973] wlan0: associated
[ 16.832174] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 17.968796] Bluetooth: RFCOMM TTY layer initialized
[ 17.968833] Bluetooth: RFCOMM socket layer initialized
[ 17.972552] Bluetooth: RFCOMM ver 1.11
[ 21.630549] msm_hsusb_host 78d9000.ehci: remove, state 4
[ 21.738202] hub 1-0:1.0: activate → -108
[ 21.738256] hub 1-0:1.0: hub_ext_port_status failed (err = -108)
[ 21.738260] usb usb1: USB disconnect, device number 1
[ 21.751979] usb 1-1: USB disconnect, device number 2
[ 21.753531] msm_hsusb_host 78d9000.ehci: USB bus 1 deregistered
[ 21.902221] msm_otg 78d9000.phy: Avail curr from USB = 100

OK after further testing, this issue happens only when the USB otg is connected to a USB 3.0 port. It works fine on a USB 2.0 port without having to unplug/replug

Thanks for the logs, I’m now able to reproduce this (runtime suspend) issue.
This can be reproduced by connecting a DCP (Dedicated charging port) device:
msm_otg 78d9000.phy: charger = 2

For example, connecting a external USB charger to my Dragonboard make the suspend/crash happen.

Glad to know. Now we can debug this.

Again, thanks for the help. Connecting to an USB 2.0 port is a valid solution for me. Although if I have some time I’ll try to fix it for USB 3.0

Hmmm there is an interesting patch upstream which could potentially fix the issue:
https://patchwork.kernel.org/patch/9876117/

I’m going to give it a try.