From: Sascha Hauer <s.hauer@pengutronix.de>
To: chalianis1@gmail.com
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] common: bootm: only use initrd override if non-empty
Date: Wed, 27 Aug 2025 13:05:45 +0200 [thread overview]
Message-ID: <aK7mic8MBXuUVJXc@pengutronix.de> (raw)
In-Reply-To: <20250826061108.3372599-1-chalianis1@gmail.com>
Hi,
I have some trouble understanding this patch.
On Tue, Aug 26, 2025 at 02:11:08AM -0400, chalianis1@gmail.com wrote:
> From: Chali Anis <chalianis1@gmail.com>
>
> OSTree integration in Yocto generates an empty initramfs
> file and references it in the boot configuration (under
> /boot/loader/ostree-1.conf) to suppress init= kernel arguments.
> This caused Barebox to always prefer the override, even when
> the initramfs was empty, preventing booting of FIT images
> that already contain an embedded initramfs.
So you have one initrd specified in /boot/loader/ostree-1.conf and
another one in your FIT image, right?
By default and without this patch I would assume the initrd from the FIT
image takes precedence, right?
>
> Signed-off-by: Chali Anis <chalianis1@gmail.com>
> ---
> common/bootm.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/common/bootm.c b/common/bootm.c
> index 3a2eb262b26a..f31ef546d92c 100644
> --- a/common/bootm.c
> +++ b/common/bootm.c
> @@ -279,14 +279,18 @@ static int bootm_open_initrd_uimage(struct image_data *data)
> const struct resource *
> bootm_load_initrd(struct image_data *data, unsigned long load_address)
> {
> + struct stat st;
> enum filetype type;
> int ret;
>
> if (!IS_ENABLED(CONFIG_BOOTM_INITRD))
> return NULL;
>
> - if (bootm_get_override(&data->initrd_file, bootm_overrides.initrd_file))
> - goto initrd_file;
> + if (bootm_get_override(&data->initrd_file,
> + bootm_overrides.initrd_file)) {
This path is only taken when bootm_overrides.initrd_file is non empty,
so it seems you are booting with boot -o bootm.initrd=/some/initrd
Without this patch you would then end up using /some/initrd as initrd
> + if (!stat(data->initrd_file, &st) && st.st_size > 0)
> + goto initrd_file;
Now with this patch you use /some/initrd only when it exists and is non
empty. Otherwise you would end up using the initrd from the FIT image,
the same initrd which would be used if you had not set -o bootm.initrd=/some/initrd.
I think I am misunderstanding something.
Sascha
--
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 |
prev parent reply other threads:[~2025-08-27 11:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 6:11 chalianis1
2025-08-27 11:05 ` Sascha Hauer [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=aK7mic8MBXuUVJXc@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=chalianis1@gmail.com \
/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