[PATCH master 4/5] efi: payload: reinstate error message when booting non-EFI stubbed kernel
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri Nov 7 06:17:21 PST 2025
With the introduction of filetype_x86_linux_image, we never detect a
filetype_mbr, but instead filetype_x86_linux_image.
Now that we have filetype_x86_efi_linux_image, we can fix this handler
by matching against the distinct filetype_x86_linux_image.
Fixes: 7b0cedb9ddb4 ("efi: payload: split image handling from legacy
handover boot and add linux x86 image filetype")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
efi/payload/image.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/efi/payload/image.c b/efi/payload/image.c
index e4e2d26463da..ea6033edc363 100644
--- a/efi/payload/image.c
+++ b/efi/payload/image.c
@@ -165,24 +165,24 @@ static struct binfmt_hook binfmt_efi_hook = {
.hook = efi_execute,
};
-static int do_bootm_mbr(struct image_data *data)
+static struct image_handler non_efi_handle_linux_x86;
+
+static int do_bootm_nonefi(struct image_data *data)
{
- /* On x86, Linux kernel images have a MBR magic at the end of
- * the first 512 byte sector and a PE magic if they're EFI-stubbed.
- * The PE magic has precedence over the MBR, so if we arrive in
- * this boot handler, the kernel has no EFI stub.
- *
- * Print a descriptive error message instead of "no image handler
- * found for image type MBR sector".
+ /* On x86, Linux kernel images have a bzImage header as well as
+ * a PE magic if they're EFI-stubbed.
+ * We have separate file types for x86 Linux images with and
+ * without PE.
*/
- pr_err("Can't boot MBR sector: Is CONFIG_EFI_STUB disabled in your Linux kernel config?\n");
+ pr_err("'%s' unsupported: CONFIG_EFI_STUB must be enabled in your Linux kernel config\n",
+ non_efi_handle_linux_x86.name);
return -ENOSYS;
}
static struct image_handler non_efi_handle_linux_x86 = {
.name = "non-EFI x86 Linux Image",
- .bootm = do_bootm_mbr,
- .filetype = filetype_mbr,
+ .bootm = do_bootm_nonefi,
+ .filetype = filetype_x86_linux_image,
};
static struct binfmt_hook binfmt_arm64_efi_hook = {
--
2.47.3
More information about the barebox
mailing list