* [PATCH] common: bootm: only use initrd override if non-empty
@ 2025-08-26 6:11 chalianis1
0 siblings, 0 replies; only message in thread
From: chalianis1 @ 2025-08-26 6:11 UTC (permalink / raw)
To: s.hauer; +Cc: barebox, Chali Anis
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.
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)) {
+ if (!stat(data->initrd_file, &st) && st.st_size > 0)
+ goto initrd_file;
+ }
if (data->initrd_res)
return data->initrd_res;
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-26 6:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-26 6:11 [PATCH] common: bootm: only use initrd override if non-empty chalianis1
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox