From: Jan Kiszka <[email protected]>

Extract the PE headers from the provided kernel image to make sure that
it is actually coming with an EFI stub. Avoids surprises and crashes
later on when trying to run the unified kernel image.

Reported-by: Michael Adler <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
---

Gives "Invalid kernel, bad DOS header magic" if selecting a "normal" 
kernel as input, at least for me here.

 tools/bg_gen_unified_kernel | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/bg_gen_unified_kernel b/tools/bg_gen_unified_kernel
index afda8ce..1d426e1 100755
--- a/tools/bg_gen_unified_kernel
+++ b/tools/bg_gen_unified_kernel
@@ -258,6 +258,9 @@ def main():
 
     kernel = args.kernel.read()
 
+    # Just to perform an integrity test for the kernel image
+    PEHeaders('kernel', kernel)
+
     current_offs = cmdline_section.data_offs + cmdline_section.data_size
     sect_size = align(len(kernel), file_align)
     kernel_section = Section(b'.kernel', sect_size, 0x2000000,
-- 
2.35.3

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/57f5b6ce-5896-cd7b-3b2f-904861428260%40siemens.com.

Reply via email to