mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Stefan Kerkmann <s.kerkmann@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Cc: Stefan Kerkmann <s.kerkmann@pengutronix.de>,
	 Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 2/2] doc: user: barebox: add chainloading of fit images
Date: Fri, 15 Dec 2023 14:43:54 +0100	[thread overview]
Message-ID: <20231215-doc-fit-images-for-chainloading-v2-2-2fa359eee535@pengutronix.de> (raw)
In-Reply-To: <20231215-doc-fit-images-for-chainloading-v2-0-2fa359eee535@pengutronix.de>

This documents an alternate method for chainloading Barebox from U-Boot
by packing the Barebox image and matching device tree into an FIT image.

Signed-off-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>
Acked-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Documentation/user/barebox.rst | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/Documentation/user/barebox.rst b/Documentation/user/barebox.rst
index f4e600bde0..ea4db28d08 100644
--- a/Documentation/user/barebox.rst
+++ b/Documentation/user/barebox.rst
@@ -215,6 +215,32 @@ like a Linux kernel that is passed an external device tree. For example:
   U-Boot: bootz $kernel_addr - $fdt_addr # On 32-bit ARM
   U-Boot: booti $kernel_addr - $fdt_addr # for other platforms
 
+Another option is to generate a FIT image containing the generic DT image and a
+matching device tree with ``mkimage``:
+
+.. code-block:: console
+  sh: mkimage --architecture arm \
+      --os linux \
+      --type kernel \
+      --fit auto \
+      --load-address $kernel_addr_r \
+      --compression none \
+      --image images/barebox-dt-2nd.img \
+      --device-tree arch/${ARCH}/dts/my-board.dtb \
+      barebox-dt-2nd.fit
+
+This FIT image can then be loaded by U-Boot and executed just like a regular
+Linux kernel:
+
+.. code-block:: console
+  U-Boot: tftp $fit_addr barebox-dt-2nd.fit
+  U-Boot: bootm $fit_addr
+
+Make sure that the address in ``$fit_addr`` is different from the
+``$kernel_addr_r`` passed to ``mkimage`` as the load address of the Kernel
+image. Otherwise U-Boot may attempt to overwrite the FIT image with the barebox
+image contained within.
+
 For non-DT enabled-bootloaders or other architectures, often the normal barebox
 binaries can also be used as they are designed to be startable second stage
 from another bootloader, where possible. For example, if you have U-Boot running

-- 
2.39.2




  parent reply	other threads:[~2023-12-15 13:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 13:43 [PATCH v2 0/2] doc: user: barebox: add method for fit image chainloading Stefan Kerkmann
2023-12-15 13:43 ` [PATCH v2 1/2] doc: user: barebox: bootz instead of bootm Stefan Kerkmann
2023-12-15 13:43 ` Stefan Kerkmann [this message]
2023-12-18  6:49 ` [PATCH v2 0/2] doc: user: barebox: add method for fit image chainloading Sascha Hauer

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=20231215-doc-fit-images-for-chainloading-v2-2-2fa359eee535@pengutronix.de \
    --to=s.kerkmann@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox