From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 03/13] bootm: introduce bootm_get_os_size
Date: Fri, 15 Jan 2016 16:07:08 +0100 [thread overview]
Message-ID: <1452870438-29656-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1452870438-29656-1-git-send-email-s.hauer@pengutronix.de>
ARM do_bootm_linux is not only called with uImages but also with
raw images, so we can't use uimage_get_size() here. Introduce
bootm_get_os_size() which handles the different image types.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/lib/bootm.c | 2 +-
common/bootm.c | 19 +++++++++++++++++++
include/boot.h | 1 +
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 2439c36..0855907 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -135,7 +135,7 @@ static int do_bootm_linux(struct image_data *data)
* relocate itself before decompression.
*/
load_address = mem_start + PAGE_ALIGN(
- uimage_get_size(data->os, data->os_num) * 4);
+ bootm_get_os_size(data) * 4);
if (bootm_verbose(data))
printf("no OS load address, defaulting to 0x%08lx\n",
load_address);
diff --git a/common/bootm.c b/common/bootm.c
index affab24..a38d7e0 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -19,6 +19,7 @@
#include <libfile.h>
#include <globalvar.h>
#include <init.h>
+#include <linux/stat.h>
static LIST_HEAD(handler_list);
@@ -185,6 +186,24 @@ int bootm_load_devicetree(struct image_data *data, unsigned long load_address)
return 0;
}
+int bootm_get_os_size(struct image_data *data)
+{
+ int ret;
+
+ if (data->os)
+ return uimage_get_size(data->os, data->os_num);
+
+ if (data->os_file) {
+ struct stat s;
+ ret = stat(data->os_file, &s);
+ if (ret)
+ return ret;
+ return s.st_size;
+ }
+
+ return -EINVAL;
+}
+
static int bootm_open_os_uimage(struct image_data *data)
{
int ret;
diff --git a/include/boot.h b/include/boot.h
index bdd5477..b172c05 100644
--- a/include/boot.h
+++ b/include/boot.h
@@ -112,6 +112,7 @@ static inline int linux_bootargs_overwrite(const char *bootargs)
int bootm_load_os(struct image_data *data, unsigned long load_address);
int bootm_load_initrd(struct image_data *data, unsigned long load_address);
int bootm_load_devicetree(struct image_data *data, unsigned long load_address);
+int bootm_get_os_size(struct image_data *data);
#define UIMAGE_SOME_ADDRESS (UIMAGE_INVALID_ADDRESS - 1)
--
2.6.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2016-01-15 15:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-15 15:07 [PATCH v3] FIT support Sascha Hauer
2016-01-15 15:07 ` [PATCH 01/13] ARM: zImage: add missing free() in appended device tree code Sascha Hauer
2016-01-15 15:07 ` [PATCH 02/13] bootm: Do not call uimage_close twice Sascha Hauer
2016-01-15 15:07 ` Sascha Hauer [this message]
2016-01-15 15:07 ` [PATCH 04/13] bootm: use names instead of numbers for image parts Sascha Hauer
2016-01-15 15:07 ` [PATCH 05/13] ARM: bootm: Use kernel handler to start barebox image Sascha Hauer
2016-01-15 15:07 ` [PATCH 06/13] bootm: Push dryrun to handlers Sascha Hauer
2016-01-15 15:07 ` [PATCH 07/13] bootm: move initrd code together Sascha Hauer
2016-01-15 15:07 ` [PATCH 08/13] bootm: move oftree " Sascha Hauer
2016-01-15 15:07 ` [PATCH 09/13] bootm: Initialize bootm_data defaults in single place Sascha Hauer
2016-01-15 15:07 ` [PATCH 10/13] crypto: add digest_alloc_by_algo() Sascha Hauer
2016-01-15 15:07 ` [PATCH 11/13] crypto: add RSA support Sascha Hauer
2016-01-15 15:07 ` [PATCH 12/13] bootm: make verifying/hashing configurable Sascha Hauer
2016-01-15 15:07 ` [PATCH 13/13] bootm: add initial FIT support Sascha Hauer
2016-01-15 15:37 ` Holger Schurig
2016-01-18 7:31 ` Sascha Hauer
2016-01-15 15:50 ` [PATCH v3] " Yegor Yefremov
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=1452870438-29656-4-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@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