Prominent Intel Linux engineer H. Peter Anvin has posted a new patch series working to clean-up the Linux x86/x86_64 kernel boot code. Besides cleaning up the code, the kernel configuration would drop options around EFI stub mode and relocatable kernels in making those features now always enabled.
CONFIG_EFI_STUB is for allowing the compressed kernel executable to be loaded directly by the EFI firmware without the use of a bootloader. While many Linux users still rely on a bootloader like GRUB or systemd-boot, EFI_STUB doesn’t impact or restrict that ability. With EFI_STUB not affecting the run-time memory footprint and most Linux x86/x86_64 systems these days being EFI-based anyhow, H. Peter Anvin argues for it to being unconditionally enabled with getting rid of the Kconfig option.
The patch series also makes building a relocatable kernel unconditionally with there being “absolutely no valid reason to build a non-relocatable kernel”. This is straight-forward and in these modern times very practical for memory position-independent kernel support especially for having KASLR address space layout randomization and the like.
H. Peter Anvin commented with the patch series:
“Again, the only potentially controversial thing here is removing the options for non-relocatable kernels and building kernels without the EFI stub. Those configurations should be considered obsolete, and they don’t add any cost to the runtime kernel.”
The x86 Linux boot clean-up patches are now out for review.
