Hacker News new | ask | show | jobs
by tsuraan 2427 days ago
Somewhat; if your system boots through EFI (as opposed to the ancient BIOS boot), then you can compile your kernel with the EFI_STUB option[0]. That kernel can be placed in EFI/Boot/bootx64.efi (or whatever you've configured your EFI to boot), and the EFI boot loader will run it without any other boot loader. IME, this goes very well with a built-in initramfs (INITRAMFS_SOURCE[1]), so you have a single-file kernel and ramfs that boots directly from EFI.

[0] - https://www.kernel.org/doc/html/latest/admin-guide/efi-stub.... [1] - https://github.com/torvalds/linux/blob/master/Documentation/...

2 comments

That's right. I'm using this kind of setup on Arch (including Secure Boot signing of the EFI kernel).
I'm curious why there kernel needs to be specially compiled for this. Is it somehow impossible to build an EFI program that boots whatever is concatenated to the end of it? Is it similarly impossible to have the kernel boot an initramfs concatenated to the end of it? This would make it trivial to swap out the individual components without recompilation.