From 0bb6e4c533211e70a4481c8d9128fd74aaa38c66 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 14 Jan 2016 10:54:42 +0100 Subject: bootm: introduce bootm_get_os_size 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 --- common/bootm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'common/bootm.c') diff --git a/common/bootm.c b/common/bootm.c index affab24831..a38d7e0326 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -19,6 +19,7 @@ #include #include #include +#include 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; -- cgit v1.2.3