summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-01-15 12:57:56 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-01-26 22:45:40 +0100
commitbc94fb379a46f9b4dabc982953a8d553c909bedb (patch)
tree7e1dff5e7d4f26f92bbf40ebb531a982d58dcde6 /common
parenta8531386ffdd3f0327bcd22a4b1447477453ad26 (diff)
downloadbarebox-bc94fb379a46f9b4dabc982953a8d553c909bedb.tar.gz
barebox-bc94fb379a46f9b4dabc982953a8d553c909bedb.tar.xz
bootm: Initialize bootm_data defaults in single place
Both the bootm and the boot code initialize the struct bootm_data with defaults from the bootm global variables. Create a common function for doing this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/bootm.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/bootm.c b/common/bootm.c
index e399a6acdb..4409a8be27 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -47,6 +47,17 @@ static struct image_handler *bootm_find_handler(enum filetype filetype,
return NULL;
}
+void bootm_data_init_defaults(struct bootm_data *data)
+{
+ data->initrd_address = UIMAGE_INVALID_ADDRESS;
+ data->os_address = UIMAGE_SOME_ADDRESS;
+ data->oftree_file = getenv_nonempty("global.bootm.oftree");
+ data->os_file = getenv_nonempty("global.bootm.image");
+ getenv_ul("global.bootm.image.loadaddr", &data->os_address);
+ getenv_ul("global.bootm.initrd.loadaddr", &data->initrd_address);
+ data->initrd_file = getenv_nonempty("global.bootm.initrd");
+}
+
/*
* bootm_load_os() - load OS to RAM
*