All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Sean Edmond <seanedmond@microsoft.com>,
	Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
	Mattijs Korpershoek <mkorpershoek@baylibre.com>,
	Safae Ouajih <souajih@baylibre.com>
Subject: [PATCH 5/7] boot: Move adding initrd earlier in image_setup_libfdt()
Date: Sun, 12 Nov 2023 08:27:48 -0700	[thread overview]
Message-ID: <20231112152754.130399-6-sjg@chromium.org> (raw)
In-Reply-To: <20231112152754.130399-1-sjg@chromium.org>

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>
---

 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


  parent reply	other threads:[~2023-11-12 15:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-12 15:27 [PATCH 0/7] fdt: Move towards using ofnode for devicetree fixups Simon Glass
2023-11-12 15:27 ` [PATCH 1/7] boot: Drop size parameter from image_setup_libfdt() Simon Glass
2023-11-12 18:22   ` Tom Rini
2023-12-13 20:39   ` Simon Glass
2023-11-12 15:27 ` [PATCH 2/7] fdt: Check for a valid fdt in oftree_ensure() Simon Glass
2023-11-12 15:27 ` [PATCH 3/7] fdt: Improve the comment for fdt_shrink_to_minimum() Simon Glass
2023-11-12 15:27 ` [PATCH 4/7] fdt: ppc: Drop extra size for ramdisk Simon Glass
2023-11-12 18:22   ` Tom Rini
2023-12-13 20:39   ` Simon Glass
2023-11-12 15:27 ` Simon Glass [this message]
2023-11-12 15:27 ` [PATCH 6/7] fdt: Drop the confusing casts in lmb_free() Simon Glass
2023-11-12 15:27 ` [PATCH 7/7] fdt: Move ft_verify_fdt() before the final fixups Simon Glass
2023-12-13 20:39 ` [PATCH 6/7] fdt: Drop the confusing casts in lmb_free() Simon Glass
2023-12-13 20:39 ` [PATCH 5/7] boot: Move adding initrd earlier in image_setup_libfdt() Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231112152754.130399-6-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=mkorpershoek@baylibre.com \
    --cc=seanedmond@microsoft.com \
    --cc=souajih@baylibre.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.