mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: chalianis1@gmail.com, s.hauer@pengutronix.de
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 01/11] common: filetype: add detection for x86 Linux kernel images
Date: Mon, 6 Oct 2025 13:39:56 +0200	[thread overview]
Message-ID: <22c78351-ad50-43d0-bb6a-80b1de547588@pengutronix.de> (raw)
In-Reply-To: <20251006041512.1360284-1-chalianis1@gmail.com>

Hi,

On 10/6/25 6:15 AM, chalianis1@gmail.com wrote:
> From: Chali Anis <chalianis1@gmail.com>
> 
> Introduce a new filetype for x86 Linux kernel images by checking for
> the "HdrS" magic (0x53726448) at offset 0x202 in the setup header.
> 
> Signed-off-by: Chali Anis <chalianis1@gmail.com>

This introduces intermittent breakage, which can complicate e.g. git
bisect. I suggest this patch be squashed into patch 07/11.

Alternatively, the hunk registering the binfmt and bootm handlers
need to be moved into this patch here.

Cheers,
Ahmad

> ---
>  common/filetype.c  | 3 +++
>  include/filetype.h | 6 ++++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/common/filetype.c b/common/filetype.c
> index eb397a175cb6..72f84442cae9 100644
> --- a/common/filetype.c
> +++ b/common/filetype.c
> @@ -87,6 +87,7 @@ 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_linux_image] = { "x86 Linux image", "x86-linux" },
>  };
>  
>  static const char *file_type_to_nr_string(enum filetype f)
> @@ -435,6 +436,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_linux_image;
>  
>  	if (le32_to_cpu(buf[5]) == 0x504d5453)
>  		return filetype_mxs_bootstream;
> diff --git a/include/filetype.h b/include/filetype.h
> index 6f4a103df304..ff4d54ee3c45 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_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 */

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




      parent reply	other threads:[~2025-10-06 11:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-06  4:15 chalianis1
2025-10-06  4:15 ` [PATCH 02/11] efi: payload: split out payload Kconfig symbols chalianis1
2025-10-06  4:15 ` [PATCH 03/11] efi: payload: add support for EFI initrd media protocol chalianis1
2025-10-06 11:31   ` Ahmad Fatoum
2025-10-06  4:15 ` [PATCH 04/11] tlsf: move kasan_poison_shadow into tlsf_add_pool chalianis1
2025-10-06  4:15 ` [PATCH 05/11] tlsf: support on-demand requesting memory from external store chalianis1
2025-10-06  4:15 ` [PATCH 06/11] efi: payload: earlymem: allocate only the barebox needs in term of memory chalianis1
2025-10-06 11:32   ` Ahmad Fatoum
2025-10-06  4:15 ` [PATCH 07/11] efi: payload: split image handling from legacy handover boot chalianis1
2025-10-06 11:37   ` Ahmad Fatoum
2025-10-06  4:15 ` [PATCH 08/11] efi: payload: bootm: add support for efi stub boot chalianis1
2025-10-06 11:40   ` Ahmad Fatoum
2025-10-06  4:15 ` [PATCH 09/11] efi: payload: bootm: add support for fit image chalianis1
2025-10-06 11:41   ` Ahmad Fatoum
2025-10-06  4:15 ` [PATCH 10/11] efi: payload: make selectable without COMPILE_TEST chalianis1
2025-10-06  4:15 ` [PATCH 11/11] ARM: efi: add a generic defconfig for v8 efi payload chalianis1
2025-10-06 11:41   ` Ahmad Fatoum
2025-10-06 11:39 ` Ahmad Fatoum [this message]

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=22c78351-ad50-43d0-bb6a-80b1de547588@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=chalianis1@gmail.com \
    --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