Skip to content

Kernel loads extremely slowly on some SD cards #262

@Gadget64

Description

@Gadget64

Whenever I use the UEFI firmware on my UHS-I SanDisk Extreme 64GB microSD, it takes extremely long for the bootloader to start Linux. The process clearly gets stuck while loading the kernel & initrd into memory, as shown by systemd-analyze:

Startup finished in 4.861s (firmware) + 1min 52.088s (loader) + 3.983s (kernel) + 12.310s (userspace) = 2min 13.244s

While I am using systemd-boot on my system, the exact same issue happens with GRUB. (Unfortunately, systemd-boot does not seem to have proper logging capabilities, and I didn't manage to get useful info trying to debug this with GRUB yet.) The only thing I can tell is that after the bootloader's picker is shown without issues and the boot has continued, it just stays at a black screen for a minute or two before Linux seems to have been loaded, which is when the following text is shown at once:

EFI stub: Booting Linux Kernel...
EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services...

It seems that what took so long is for the kernel to load; and this is on a fresh install of NixOS, with a kernel image of just 70 MB. But once these messages have been shown after the wait, the Linux kernel starts booting quickly and properly as usual.

I can rule out that the card is not at fault, as it boots all non-UEFI configurations as quickly as expected. And even with UEFI, it performs well once the system has gotten past the point of loading the kernel into memory. Additionally, an identical install of UEFI + NixOS starts the kernel almost immediately on an USB 2.0 flash drive, although it's much slower than my microSD.

Is the card maybe simply running at an extremely low speed at that stage before the kernel has properly configured it? Linux does indeed only report it as sd high-speed with cat /sys/kernel/debug/mmc*/ios (which should be 25 MB/s) before I've properly applied the device-trees, and only then is it shown as sd uhs DDR50 (the expected UHS-I speed of 50 MB/s, which is what vanilla RPi OS reports too), although both should be fast enough. Let me know if I can provide any more information!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions