Skip to content

Commit 072264c

Browse files
Sam Protsenkotrini
authored andcommitted
Revert "fdt: Make sure there is no stale initrd left"
This reverts commit 9fe2e4b. Commit 9fe2e4b ("fdt: Make sure there is no stale initrd left") introduces a regression in case when U-Boot transfers control to an EFI app which acts as a subsequent bootloading program. Such an app might try to set "linux,initrd-start" and "linux,initrd-end" fdt properties, but by that time those properties are already removed by the code added in the mentioned commit. Particularly, the issue was observed on the E850-96 board where GBL EFI app [1] can't run Android successfully anymore. More specifically, the kernel can't see the ramdisk and panics with next messages: /dev/root: Can't open blockdev VFS: Cannot open root device "" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; ... Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) fdt_initrd() function (where initrd dts properties are removed) is called two times: 1. First it's called by EFI boot manager (e.g. as a part of U-Boot Standard Boot mechanism) when it's installing FDT: fdt_initrd image_setup_libfdt efi_install_fdt efi_bootmgr_run efi_mgr_boot It's already enough for EFI app to malfunction. But then it's also called second time: 2. From the EFI app, via EFI DT fixup protocol: fdt_initrd image_setup_libfdt efi_dt_fixup struct efi_dt_fixup_protocol efi_dt_fixup_prot = { .fixup = efi_dt_fixup }; See [2] for specific GBL code which sets those fdt properties and then runs DT fixup protocol callback. This issue was discussed [3], but no action was taken since then. Revert this patch for now, until a proper solution can be found. [1] https://source.android.com/docs/core/architecture/bootloader/generic-bootloader/gbl-dev [2] https://android.googlesource.com/platform/bootable/libbootloader/+/refs/heads/gbl-mainline/gbl/libgbl/src/android_boot/mod.rs#208 [3] https://lists.denx.de/pipermail/u-boot/2025-July/593879.html Fixes: 9fe2e4b ("fdt: Make sure there is no stale initrd left") Signed-off-by: Sam Protsenko <[email protected]>
1 parent 5a3c306 commit 072264c

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

boot/fdt_support.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -224,24 +224,15 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)
224224
int is_u64;
225225
uint64_t addr, size;
226226

227+
/* just return if the size of initrd is zero */
228+
if (initrd_start == initrd_end)
229+
return 0;
230+
227231
/* find or create "/chosen" node. */
228232
nodeoffset = fdt_find_or_add_subnode(fdt, 0, "chosen");
229233
if (nodeoffset < 0)
230234
return nodeoffset;
231235

232-
/*
233-
* Although we didn't setup an initrd, there could be a stale
234-
* initrd setting from the previous boot firmware in the live
235-
* device tree. So, make sure there is no setting left if we
236-
* don't want an initrd.
237-
*/
238-
if (initrd_start == initrd_end) {
239-
fdt_delprop(fdt, nodeoffset, "linux,initrd-start");
240-
fdt_delprop(fdt, nodeoffset, "linux,initrd-end");
241-
242-
return 0;
243-
}
244-
245236
total = fdt_num_mem_rsv(fdt);
246237

247238
/*

0 commit comments

Comments
 (0)