From: Chali Anis <chalianis1@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>,
BAREBOX <barebox@lists.infradead.org>
Cc: Chali Anis <chalianis1@gmail.com>
Subject: [PATCH 07/15] common: filetype: add x86 linux filetype.
Date: Fri, 19 Sep 2025 23:03:16 -0400 [thread overview]
Message-ID: <20250919-efi-loader-v1-7-dd8cdafb9067@gmail.com> (raw)
In-Reply-To: <20250919-efi-loader-v1-0-dd8cdafb9067@gmail.com>
add x86 linux filetype to be used to boot with efi stub
bootm image handler.
Signed-off-by: Chali Anis <chalianis1@gmail.com>
---
common/filetype.c | 4 ++++
include/filetype.h | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/common/filetype.c b/common/filetype.c
index eb397a175cb63df06e4426d2b99e4fde360c5b11..8735d3b16723b88c470750a1ca9ca10a6bcbba14 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -87,6 +87,8 @@ static const struct filetype_str filetype_str[] = {
[filetype_zstd_compressed] = { "ZSTD compressed", "zstd" },
[filetype_rockchip_rkss_image] = { "Rockchip signed boot image",
"rk-image" },
+ [filetype_x86_efi_linux_image] = { "X86 Linux/EFI image",
+ "x86-efi-linux" },
};
static const char *file_type_to_nr_string(enum filetype f)
@@ -435,6 +437,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
return is_dos_exe(buf8) ? filetype_riscv_efi_linux_image : filetype_riscv_linux_image;
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_efi_linux_image;
if (le32_to_cpu(buf[5]) == 0x504d5453)
return filetype_mxs_bootstream;
diff --git a/include/filetype.h b/include/filetype.h
index 6f4a103df3040ef259660d06ca878f72e2245c12..7ca9fe2158cbd20cda3ed587293a91addf2bd79c 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -67,6 +67,7 @@ enum filetype {
filetype_nxp_fspi_image,
filetype_zstd_compressed,
filetype_rockchip_rkss_image,
+ filetype_x86_efi_linux_image,
filetype_max,
};
@@ -150,4 +151,9 @@ static inline bool is_riscv_linux_bootimage(const void *header)
return le32_to_cpup(header + 56) == 0x05435352;
}
+static inline bool is_x86_linux_bootimage(const void *header)
+{
+ return le32_to_cpup(header + 0x202) == 0x53726448;
+}
+
#endif /* __FILE_TYPE_H */
--
2.34.1
next prev parent reply other threads:[~2025-09-20 3:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-20 3:03 [PATCH 00/15] Implement efi loader to run barebox as efi payload app and then load efi stubed application/kernels chalianis1
2025-09-20 3:03 ` [PATCH 01/15] efi: payload: split image handling from legacy handover boot support chalianis1
2025-09-20 3:03 ` [PATCH 02/15] efi: payload: add support for efi stub boot chalianis1
2025-09-20 3:03 ` [PATCH 03/15] efi: payload: add support for fit image chalianis1
2025-09-20 3:03 ` [PATCH 04/15] efi: payload: make selectable without COMPILE_TEST chalianis1
2025-09-20 3:03 ` [PATCH 05/15] arm: efi: add a generic defconfig for v8 efi payload, Chali Anis
2025-09-20 3:03 ` [PATCH 06/15] efi: payload: initrd: implement efi initrd media protocol Chali Anis
2025-09-20 3:03 ` Chali Anis [this message]
2025-09-20 3:03 ` [PATCH 08/15] efi: payload: early-mem: helps to correctly boot x86 linux Chali Anis
2025-09-20 3:03 ` [PATCH 09/15] efi: payload: bootm: add x86 efi stub boot support Chali Anis
2025-09-20 3:03 ` [PATCH 10/15] efi: payload: x86: enable the possibility to efi stub bootm for x86 Chali Anis
2025-09-20 3:03 ` [PATCH 11/15] malloc: tlsf: efi: add a fallback for allocate more memory when we are in efi Chali Anis
2025-09-20 3:03 ` [PATCH 12/15] configs: efi: arm64: x86: enable the use of efi malloc fallback Chali Anis
2025-09-20 3:03 ` [PATCH 13/15] efi: payload: earlymem: allocate only the barebox needs in term of memory Chali Anis
2025-09-20 3:03 ` [PATCH 14/15] ARM: cpu: allow selecting CPU_V7/CPU_V8 directly chalianis1
2025-09-20 3:03 ` [PATCH 15/15] efi: payload: bootm: remove redundant reallocations in image loader Chali Anis
2025-09-22 7:37 ` [PATCH 00/15] Implement efi loader to run barebox as efi payload app and then load efi stubed application/kernels Ahmad Fatoum
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=20250919-efi-loader-v1-7-dd8cdafb9067@gmail.com \
--to=chalianis1@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/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