mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
fdt: Make sure there is no stale initrd left
Although if we don't setup an initrd, there could be a stale initrd setting from the previous boot firmware in the live device tree. So, make sure there is no setting left if we don't want an initrd. This can happen when booting on a Raspberry Pi. The boot firmware can happily load an initrd before us and configuring the addresses in the live device tree we get handed over. Especially the setting `auto_initramfs` in config.txt is dangerous. When enabled (default), the firmware tries to be smart and looks for initramfs files. Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
committed by
Tom Rini
parent
53cc4332b3
commit
9fe2e4b464
@@ -224,15 +224,24 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)
|
||||
int is_u64;
|
||||
uint64_t addr, size;
|
||||
|
||||
/* just return if the size of initrd is zero */
|
||||
if (initrd_start == initrd_end)
|
||||
return 0;
|
||||
|
||||
/* find or create "/chosen" node. */
|
||||
nodeoffset = fdt_find_or_add_subnode(fdt, 0, "chosen");
|
||||
if (nodeoffset < 0)
|
||||
return nodeoffset;
|
||||
|
||||
/*
|
||||
* Although we didn't setup an initrd, there could be a stale
|
||||
* initrd setting from the previous boot firmware in the live
|
||||
* device tree. So, make sure there is no setting left if we
|
||||
* don't want an initrd.
|
||||
*/
|
||||
if (initrd_start == initrd_end) {
|
||||
fdt_delprop(fdt, nodeoffset, "linux,initrd-start");
|
||||
fdt_delprop(fdt, nodeoffset, "linux,initrd-end");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
total = fdt_num_mem_rsv(fdt);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user