[PATCH 5/7] boot: Move adding initrd earlier in image_setup_libfdt()
Simon Glass
sjg at chromium.org
Sun Nov 12 16:27:48 CET 2023
This may as well happen before the general event is emitted, so move it.
This will allow us to use the livetree for the event part, but the
flattree for the earlier part.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
boot/image-fdt.c | 5 ++++-
include/fdt_support.h | 12 +++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/boot/image-fdt.c b/boot/image-fdt.c
index 408369d489ca..ac7dc055cc9c 100644
--- a/boot/image-fdt.c
+++ b/boot/image-fdt.c
@@ -664,6 +664,10 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob,
goto err;
}
}
+
+ if (fdt_initrd(blob, *initrd_start, *initrd_end))
+ goto err;
+
if (!of_live_active() && CONFIG_IS_ENABLED(EVENT)) {
struct event_ft_fixup fixup;
@@ -693,7 +697,6 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob,
if (lmb)
lmb_reserve(lmb, (ulong)blob, of_size);
- fdt_initrd(blob, *initrd_start, *initrd_end);
if (!ft_verify_fdt(blob))
goto err;
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 791258ec7eff..bc249b045302 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -57,7 +57,17 @@ int fdt_chosen(void *fdt);
/**
* Add initrd information to the FDT before booting the OS.
*
- * @param fdt FDT address in memory
+ * Adds linux,initrd-start and linux,initrd-end properties to the /chosen node,
+ * creating it if necessary.
+ *
+ * A memory reservation for the ramdisk is added to the FDT, or an existing one
+ * (with matching @initrd_start) updated.
+ *
+ * If @initrd_start == @initrd_end this function does nothing and returns 0.
+ *
+ * @fdt: Pointer to FDT in memory
+ * @initrd_start: Start of ramdisk
+ * @initrd_end: End of ramdisk
* Return: 0 if ok, or -FDT_ERR_... on error
*/
int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end);
--
2.42.0.869.gea05f2083d-goog
More information about the U-Boot
mailing list