From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 2/5] filetype: introduce separate filetype_x86_efi_linux_image
Date: Fri, 7 Nov 2025 15:17:19 +0100 [thread overview]
Message-ID: <20251107141725.2590394-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20251107141725.2590394-1-a.fatoum@pengutronix.de>
I originally suggested adding only filetype_x86_linux_image during
review, because I was eyeing removal of the EFI types for the other
architectures in favor of handling the EFI stub differently.
I am not pursuing this further, so let's add filetype_x86_efi_linux_image
as it will simplify code at a number of places in following commits.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/filetype.c | 3 ++-
efi/payload/bootm.c | 2 +-
efi/payload/image.c | 2 +-
include/filetype.h | 1 +
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/common/filetype.c b/common/filetype.c
index 72f84442cae9..a1807d285258 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -88,6 +88,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_rockchip_rkss_image] = { "Rockchip signed boot image",
"rk-image" },
[filetype_x86_linux_image] = { "x86 Linux image", "x86-linux" },
+ [filetype_x86_efi_linux_image] = { "x86 Linux/EFI image", "x86-efi-linux" },
};
static const char *file_type_to_nr_string(enum filetype f)
@@ -437,7 +438,7 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (is_riscv_linux_bootimage(buf) && !memcmp(&buf[12], "barebox", 8))
return filetype_riscv_barebox_image;
if (bufsize > 0x206 && is_x86_linux_bootimage(buf))
- return filetype_x86_linux_image;
+ return is_dos_exe(buf8) ? filetype_x86_efi_linux_image : filetype_x86_linux_image;
if (le32_to_cpu(buf[5]) == 0x504d5453)
return filetype_mxs_bootstream;
diff --git a/efi/payload/bootm.c b/efi/payload/bootm.c
index 3e9ccd42bf7f..e205664b3262 100644
--- a/efi/payload/bootm.c
+++ b/efi/payload/bootm.c
@@ -276,7 +276,7 @@ static struct image_handler efi_app_handle_tr = {
static struct image_handler efi_x86_linux_handle_tr = {
.name = "EFI X86 Linux kernel",
.bootm = do_bootm_efi_stub,
- .filetype = filetype_x86_linux_image,
+ .filetype = filetype_x86_efi_linux_image,
};
static struct image_handler efi_arm64_handle_tr = {
diff --git a/efi/payload/image.c b/efi/payload/image.c
index 5d20221a135e..e4e2d26463da 100644
--- a/efi/payload/image.c
+++ b/efi/payload/image.c
@@ -191,7 +191,7 @@ static struct binfmt_hook binfmt_arm64_efi_hook = {
};
static struct binfmt_hook binfmt_x86_efi_hook = {
- .type = filetype_x86_linux_image,
+ .type = filetype_x86_efi_linux_image,
.hook = efi_execute,
};
diff --git a/include/filetype.h b/include/filetype.h
index ff4d54ee3c45..ecbbd5873b00 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -68,6 +68,7 @@ enum filetype {
filetype_zstd_compressed,
filetype_rockchip_rkss_image,
filetype_x86_linux_image,
+ filetype_x86_efi_linux_image,
filetype_max,
};
--
2.47.3
next prev parent reply other threads:[~2025-11-07 14:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 14:17 [PATCH master 1/5] efi: payload: drop unreferenced efi_do_execute_image() Ahmad Fatoum
2025-11-07 14:17 ` Ahmad Fatoum [this message]
2025-11-07 14:17 ` [PATCH master 3/5] efi: payload: handover: fix filetype match Ahmad Fatoum
2025-11-07 14:17 ` [PATCH master 4/5] efi: payload: reinstate error message when booting non-EFI stubbed kernel Ahmad Fatoum
2025-11-07 14:17 ` [PATCH master 5/5] efi: payload: align kernel boot status messages Ahmad Fatoum
2025-11-10 8:20 ` [PATCH master 1/5] efi: payload: drop unreferenced efi_do_execute_image() Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251107141725.2590394-2-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox