Linux kernel 4.9.40 : 30 seconds delay when eMMC booting

Hi, guys. Please help me.

There are mysterious 30 seconds delay when only eMMC booting.
Below log is from my new compiled kernel.

And oddly, with the same kernel, there is no delay when it boots from SD/USB.
I did everything to remove the delay for weeks, but everything was useless.

I desperately need any hint about causing the delay.

The 30 seconds delay exists in Khadas’ eMMC firmware image.

There is around 30 seconds delay between below 4 ~ 35 seconds logs.

[ 4.166117@2] usb usb2: We don’t know the algorithms for LPM for this host, disabling LPM.
[ 4.174892@2] hub 2-0:1.0: USB hub found
[ 4.178150@2] hub 2-0:1.0: config failed, hub doesn’t have any ports! (err -19)
[ 4.186200@2] dwc_otg: usb0: type: 2 speed: 0, [ 4.189685@4] config: 0, dma: 0, id: 0,
[ 4.193553@4] phy: d0078000, ctrl: 0
[ 4.297416@4] dwc_otg: Core Release: 3.10a
[ 4.297457@4] dwc_otg: Setting default values for core params
[ 4.301612@4] dwc_otg: curmode: 0, host_only: 0
[ 4.318449@4] dwc_otg: Using Buffer DMA mode
[ 4.318487@4] dwc_otg: OTG VER PARAM: 1, OTG VER FLAG: 1
[ 4.322367@4] dwc_otg: Working on port type = SLAVE
[ 4.327198@4] dwc_otg: Dedicated Tx FIFOs mode
[ 4.332840@4] gxbb_pm: enter meson_pm_probe!
[ 4.335833@4] gxbb_pm: system suspend level: 1
[ 4.340271@4] gxbb_pm: meson_pm_probe done
[ 4.345209@4] Freeing unused kernel memory: 768K (ffffffc001b40000 - ffffffc001c00000)
[ 4.480280@2] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[ 4.888253@2] usb 1-2: new high-speed USB device number 3 using xhci-hcd
[ 4.909289@0] random: fast init done
[ 35.340630@6] EXT4-fs (mmcblk0p6): 13 orphan inodes deleted
[ 35.340688@6] EXT4-fs (mmcblk0p6): recovery complete
[ 35.353898@6] EXT4-fs (mmcblk0p6): mounted filesystem with writeback data mode. Opts: data=writeback
[ 35.554757@7] systemd[1]: System time before build time, advancing clock.
[ 35.558975@7] cgroup: cgroup2: unknown option “nsdelegate”
E2 default-hierarchy=hybrid)

not sure but seems ext4 filesystem on mmcblk0p6 needed recovery.

Thansk for the reply.

Me too, first I doubted filesystem recovery issue for the delay.
But it has always 30 seconds delay when there is no ext4 recovery log.

If anyone built a eMMC image with no delay issue, let me know about the linux kernel environment.


For Ubuntu xenial seems have a shorter delay about 15 seconds, have no idea about this issue yet…

[    8.158645@7] fb: current vmode=720p60hz, cmd: 0x20000
[    8.207775@0] Start = 0x10000100   End = 0x100001ff
[    8.207783@0] [0x10000104]: 0x00000001
[    8.207883@0] [0x10000180]: 0x000000ff
[    8.207886@0] [0x10000181]: 0x000000ff
[    8.207889@0] [0x10000182]: 0x00000003
[    8.207892@0] [0x10000183]: 0x00000007
[    8.207895@0] [0x10000184]: 0x0000003f
[    8.207897@0] [0x10000185]: 0x00000002
[    8.207901@0] [0x10000187]: 0x000000ff
[    8.207904@0] [0x10000188]: 0x00000003
[    8.305676@7] fb: osd[0] enable: 1 (
[    8.327508@7] fb: osd[1] enable: 0 (
[   11.754453@1] vout: aml_tvout_mode_work: monitor_timeout
[   23.559901@7] EXT4-fs (mmcblk0p6): 2 orphan inodes deleted
[   23.565379@7] EXT4-fs (mmcblk0p6): recovery complete
[   23.574125@7] EXT4-fs (mmcblk0p6): mounted filesystem with writeback data mode. Opts: data=writeback
[   23.726124@5] systemd[1]: System time before build time, advancing clock.
[   23.755584@6] systemd[1]: systemd 229 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN)
[   23.774652@6] systemd[1]: Detected architecture arm64.
[   23.800294@6] systemd[1]: Set hostname to <Khadas>.
[   23.835298@0] meson_uart c81004c0.serial: ttyS0 use xtal(8M) 24000000 change 115200 to 115200
[   23.995915@5] systemd[1]: Listening on Journal Audit Socket.
[   24.008161@5] systemd[1]: Reached target Swap.
[   24.020328@5] systemd[1]: Listening on udev Control Socket.
[   24.032728@5] systemd[1]: Started Trigger resolvconf update for networkd DNS.
[   24.046843@5] systemd[1]: Listening on Syslog Socket.
[   24.059970@5] systemd[1]: Created slice User and Session Slice.
[   24.073046@5] systemd[1]: Listening on udev Kernel Socket.
[   24.248510@6] dhd_module_init: in Dongle Host Driver, version 1.363.59.144.10 (r)
[   24.256963@6] ======== dhd_wlan_init_plat_data ========
[   24.263650@6] dhd_wlan_init_gpio: GPIO(WL_REG_ON) = -1
[   24.270342@6] dhd_wlan_init_gpio: GPIO(WL_HOST_WAKE) = -1
[   24.276938@6] dhd_wlan_init_gpio: host_oob_irq: 127
[   24.283532@6] dhd_wlan_init_gpio: host_oob_irq_flags=0x418

Thanks for the replay.

Xenial? I use bionic Ubuntu.

Which firmware image did you use?
I will check the difference between xenial and bionic.



Thanks for quick reply.

Do VIM1 images work on VIM2 board?

Anyway I will try them.

Thanks. numbqq.

NO. VIM1 board should use image for VIM1,VIM2 board should use image for VIM2.

Thansk. numbqq.

You save me from a lot hard work. ^^;

I think maybe this issue related to the partition table.

For SD/USB image, it uses MBR patition structure.
For eMMC image, it uses AML partition structure, in order to use Amlogic burn tool to upgrade firmware.

If I changed the eMMC image from AML partition structure to MBR patition structure, it boots eMMC image just with a delay of 5 seconds.

[    8.496628@6] 720p60hz 60 1
[    8.503906@6] 720p60hz 60 1
[    8.511015@6] hdmtix: set audio
[    8.518101@6] hdmitx tx_aud_src = 0
[    8.525225@6] hdmitx: fs = 3, cd = 4, tmds_clk = 74250
[    8.532351@6] hdmitx aud_n_para = 6144
[    8.539481@6] hdmitx set channel status
[    8.546593@6] hdmitx: audio: Audio Type: PCM
[    8.553697@6] vout: new mode 720p60hz
[    8.553697@6]  set ok
[    8.567993@6] fb: current vmode=720p60hz, cmd: 0x20000
[    8.619779@6] fb: osd[0] enable: 1 (
[    8.643690@6] fb: osd[1] enable: 0 (
[   11.657195@1] vout: aml_tvout_mode_work: monitor_timeout
[   13.818415@6] EXT4-fs (mmcblk0p2): recovery complete
[   13.826260@6] EXT4-fs (mmcblk0p2): mounted filesystem with writeback data mode. Opts: data=writeback
[   14.077264@6] cgroup: cgroup2: unknown option "nsdelegate"
[   14.093563@6] systemd[1]: systemd 237 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
[   14.124994@6] systemd[1]: Detected architecture arm64.
[   14.160456@6] systemd[1]: Set hostname to <Khadas>.
[   14.204710@7] meson_uart c81004c0.serial: ttyS0 use xtal(8M) 24000000 change 115200 to 115200
[   14.277156@7] systemd[1]: File /lib/systemd/system/systemd-journald.service:36 configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling.
[   14.295849@7] systemd[1]: Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first loaded unit using IP firewalling.)
[   14.466521@6] systemd[1]: Reached target Remote File Systems.
[   14.483482@6] systemd[1]: Created slice User and Session Slice.
[   14.499029@6] systemd[1]: Reached target Swap.
[   14.514976@6] systemd[1]: Created slice System Slice.

Thanks numbqq.

It’s the help I desperately want to get.

But i am not good at handling partition structure.
Is it possible to change partition with fdisk, dd?

How can I change the partition structure?
Let me know how to change the partition structure or site to refer to.


Dear numbqq.

You have already given enough help.

I will try to find out for myself how to change partitions.

I sincerely appreciate your help.

The method I used is to dd the full SD/USB image to eMMC directly. You can use Fenix script to build such image, but you need some patches.

Download U-boot patch here.
Download Linux 4.9 patch here.
Download Fenix patch here.

After apply these patches, try to build SD/USB image.

Version: 0.5
Current environment:



Build image:

$ make kernel && make debs && make

When you built the image, you need to boot from SD card first (any SD card image is OK), and then copy the image to your SD card, and write it to eMMC use dd command.

khadas@Khadas:~$ sudo dd if=VIM2_Ubuntu-server-bionic_Linux-4.9_arm64_SD-USB_V20190107.img of=/dev/mmcblk0 bs=8M
khadas@Khadas:~$ sync

Remove the SD card, then reset the board, you will boot from eMMC with MBR partition table.

Note: If you change the patition table, you will can’t use Amlogic burn tool to upgrade your firmware anymore.



Dear numbqq.

There are some things I did not think of.
The patches you gave me were not easy to figure out.

I only thought about booting from SD / USB and copying the system image using DD.

Thank you again for your enthusiastic support.

Dear numbqq.

Thank you for your quick support.
I changed to MBR partition and the 30 second delay is gone.

But with MBR partition, System update via USB is not available.
I need u-boot system update capability using AML partition.

Please check whether the delay problem of AML partition can not be solved.
Is there an identical delay in the updated kernel?

Thank you.

I have no idea about this issue yet. But for Ubuntu 16.04, the boot delay is shorter then Ubuntu 18.04.

Finally this issue is resolved, reduce 25 seconds bootup time…

1 Like