Skip to content

efi: Add generic magic number in header

Ard Biesheuvel grub-devel linux-efi 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 10 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2efi: libstub: Always enable initrd command line loader and bump versiondrivers/firmware/efi/Kconfig drivers/firmware/efi/libstub/efi-stub-helper.c include/linux/pe.h+2 -180 replies
2/2efi: Put Linux specific magic number in the DOS headerarch/loongarch/kernel/head.S arch/x86/boot/header.S drivers/firmware/efi/libstub/zboot-header.S +1 more+13 -39 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchLeif LindholmDaniel Kiper
SeriesA-b
1/2
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] efi: Add generic magic number in header

This is a minimal respin of the RFC patch I sent out a few week ago. No changes were applied except the /0x30/0x38 typo fix and some additional wording in the commit log. I also added a patch to make the command line initrd loader always built-in.

The purpose of all of this is to create *and document* a common baseline for EFI booting of Linux. (I know I promised some documentation myself, but I simply don't have time for that, so if anyone feels so inclined, please go ahead).

The idea is that EFI images with the LINUX_PE_MAGIC number are guaranteed to support:
- initrd loading via LoadFile2
- initrd loading via the command line
- (on x86) mixed mode boot via the .compat entry point
- other things I missed?

Architectures such as arm64 and RISC-V already have their own magic numbers, in which case the PE/COFF major/minor image version should be inspected, where 1.1 corresponds with the set described above.

If other architectures want to create hybrid images as well, it would be better to use a different offset to store the magic number, so that the generic EFI one can be carried as well. The reason for deviating from this for arm64 and RISC-V is the simple fact that existing images already exist, so for those architectures, we have to consider both anyway.

Cc Huacai Chen <[email protected]>
Cc Atish Patra <[email protected]>
Cc Heinrich Schuchardt <[email protected]>
Cc Daniel Kiper <[email protected]>
Cc Leif Lindholm <[email protected]>

Ard Biesheuvel (2):
efi: libstub: Always enable initrd command line loader and bump
version
efi: Put Linux specific magic number in the DOS header

 arch/loongarch/kernel/head.S                   |  3 ++-
 arch/x86/boot/header.S                         |  3 ++-
 drivers/firmware/efi/Kconfig                   | 15 ---------------
 drivers/firmware/efi/libstub/efi-stub-helper.c |  3 +--
 drivers/firmware/efi/libstub/zboot-header.S    |  3 ++-
 include/linux/pe.h                             |  9 ++++++++-
 6 files changed, 15 insertions(+), 21 deletions(-)
Signature · 1 line
2.35.1