From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] spl: ubi: Add support for loading simple fitImage
Date: Tue, 28 May 2019 03:49:14 +0200 [thread overview]
Message-ID: <20190528014915.6202-2-marex@denx.de> (raw)
In-Reply-To: <20190528014915.6202-1-marex@denx.de>
Add code to load simple fitImage from the kernel volume, the args
volume is unnecessary.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Ladislav Michl <ladis@linux-mips.org>
Cc: Tom Rini <trini@konsulko.com>
---
common/spl/spl_ubi.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/common/spl/spl_ubi.c b/common/spl/spl_ubi.c
index 67e5fadd7c..6addd46ece 100644
--- a/common/spl/spl_ubi.c
+++ b/common/spl/spl_ubi.c
@@ -11,6 +11,14 @@
#include <ubispl.h>
#include <spl.h>
+static ulong spl_ubi_load_read(struct spl_load_info *load, ulong sector,
+ ulong count, void *buf)
+{
+ if (buf != (void *)CONFIG_SPL_LOAD_FIT_ADDRESS + sector)
+ memcpy(buf, (void *)(CONFIG_SYS_LOAD_ADDR + sector), count);
+ return count;
+}
+
int spl_ubi_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
@@ -54,7 +62,19 @@ int spl_ubi_load_image(struct spl_image_info *spl_image,
ret = ubispl_load_volumes(&info, volumes, 2);
if (!ret) {
header = (struct image_header *)volumes[0].load_addr;
- spl_parse_image_header(spl_image, header);
+
+ if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
+ image_get_magic(header) == FDT_MAGIC) {
+ struct spl_load_info load;
+
+ debug("Found FIT\n");
+ load.bl_len = 1;
+ load.read = spl_ubi_load_read;
+ spl_load_simple_fit(spl_image, &load, 0, header);
+ } else {
+ spl_parse_image_header(spl_image, header);
+ }
+
puts("Linux loaded.\n");
goto out;
}
--
2.20.1
next prev parent reply other threads:[~2019-05-28 1:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 1:49 [U-Boot] [PATCH 1/3] spl: ram: Do not memcpy() identical buffers Marek Vasut
2019-05-28 1:49 ` Marek Vasut [this message]
2019-07-12 18:31 ` [U-Boot] [PATCH 2/3] spl: ubi: Add support for loading simple fitImage Tom Rini
2019-05-28 1:49 ` [U-Boot] [PATCH 3/3] spl: fit: Place OS_BOOT DTB at CONFIG_SYS_SPL_ARGS_ADDR if defined Marek Vasut
2019-07-12 14:34 ` Tom Rini
2019-05-28 2:06 ` [U-Boot] [PATCH 1/3] spl: ram: Do not memcpy() identical buffers Tom Rini
2019-05-28 2:07 ` Marek Vasut
2019-05-28 2:42 ` Tom Rini
2019-05-28 2:44 ` Marek Vasut
2019-05-28 3:04 ` Tom Rini
2019-05-28 3:24 ` Marek Vasut
2019-05-28 11:19 ` Tom Rini
2019-05-28 14:18 ` J. William Campbell
2019-05-28 17:52 ` Marek Vasut
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=20190528014915.6202-2-marex@denx.de \
--to=marex@denx.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox