boot: Move adding initrd earlier in image_setup_libfdt()

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@chromium.org>
This commit is contained in:
Simon Glass 2023-11-12 08:27:48 -07:00 committed by Tom Rini
parent 83cd8fb13c
commit f2cbe6e43e
2 changed files with 15 additions and 2 deletions

View File

@ -635,6 +635,10 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob,
goto err; goto err;
} }
} }
if (fdt_initrd(blob, *initrd_start, *initrd_end))
goto err;
if (!of_live_active() && CONFIG_IS_ENABLED(EVENT)) { if (!of_live_active() && CONFIG_IS_ENABLED(EVENT)) {
struct event_ft_fixup fixup; struct event_ft_fixup fixup;
@ -664,7 +668,6 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob,
if (lmb) if (lmb)
lmb_reserve(lmb, (ulong)blob, of_size); lmb_reserve(lmb, (ulong)blob, of_size);
fdt_initrd(blob, *initrd_start, *initrd_end);
if (!ft_verify_fdt(blob)) if (!ft_verify_fdt(blob))
goto err; goto err;

View File

@ -55,7 +55,17 @@ int fdt_chosen(void *fdt);
/** /**
* Add initrd information to the FDT before booting the OS. * 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 * Return: 0 if ok, or -FDT_ERR_... on error
*/ */
int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end); int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end);