Translate

Archives

EFI Boot Stub Added to Linux 3.3 Kernel

The 3.3 Linux kernel added support for an EFI boot stub that allows an x86 bzImage to be loaded and executed directly by EFI firmware. The bzImage appears to the EFU firmware to be an EFI application. Both BIOS and EFI boot loaders can still load and run the same bzImage, thereby allowing a single kernel image to work with both BIOS and UEFI firmware.

Here is the commit message:

There is currently a large divide between kernel development and the development of EFI boot loaders. The idea behind this patch is to give the kernel developers full control over the EFI boot process. As H. Peter Anvin put it,

“The ‘kernel carries its own stub’ approach been very successful in dealing with BIOS, and would make a lot of sense to me for EFI as well.”

This patch introduces an EFI boot stub that allows an x86 bzImage to be loaded and executed by EFI firmware. The bzImage appears to the firmware as an EFI application. Luckily there are enough free bits within the bzImage header so that it can masquerade as an EFI application, thereby coercing the EFI firmware into loading it and jumping to its entry point. The beauty of this masquerading approach is that both BIOS and EFI boot loaders can still load and run the same bzImage, thereby allowing a single kernel image to work in any boot environment.

The EFI boot stub supports multiple initrds, but they must exist on the same partition as the bzImage. Command-line arguments for the kernel can be appended after the bzImage name when run from the EFI shell, e.g.

EFI Shell> bzImage console=ttyS0 root=/dev/sdb initrd=initrd.img

More information about the actual commits can be found here.

Comments are closed.