summaryrefslogtreecommitdiffstats
path: root/common/bootm.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/bootm.c')
-rw-r--r--common/bootm.c19
1 files changed, 19 insertions, 0 deletions
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 <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;