Skip to content

mkinitcpio: Support kernel version detection on other archtectures

Kristian Klausen requested to merge github/fork/adam900710/fallback_kver into master

Created by: adam900710

Current mkinitpcio only support kernel version detection on x86/x86_64.

This makes mkinitcpio on Archlinuxarm/ManajaroARM harder to generate their initramfs, as they have to specify the kernel version, other than let mkinitcpio to detect it automatically.

This limitation is especially obvious when kernel bisecting is involved, as the kernel version can change between each bisect, and re-generating initramfs with inconsistent kernel version is a blockage.

This patch adds a fallback method to detect kernel version for uncompressed kernel image. The fallback method will use "strings" command to filter out the "Kernel version " string and use the next string as kernel version.

This works on arm64 and x86_64 uncompressed kernel pretty well, but it's still slower since we need to read the full kernel image.

Thus the existing x86_64 magic offset way is still kept as is, and the new generic method is only a fallback for arch without a magic offset.

Signed-off-by: Qu Wenruo

Merge request reports