summaryrefslogtreecommitdiffstats
path: root/commands/bootm.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-09-23 11:15:46 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-09-24 09:03:18 +0200
commitb15c5eeecfbe4e4d1167b67a897d6c61dbae4251 (patch)
tree4fe11d458b5732eb716f5231c65c6bd9415486fd /commands/bootm.c
parent172fc40f617799023e56cb005f088a522ab6fe6f (diff)
downloadbarebox-b15c5eeecfbe4e4d1167b67a897d6c61dbae4251.tar.gz
barebox-b15c5eeecfbe4e4d1167b67a897d6c61dbae4251.tar.xz
bootm: separate bootm input data and internal data
We used to use struct image_data as the central data structure for bootm and also as the input data structure. This makes it unclear which of the fields are actually input data. This patch creates a struct bootm_data which is exclusively used for input data to make usage clearer. Also it moves the dispatching of multifile uImage pathnames to the core bootm code so that the core code gets more flexible and the command code simpler. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/bootm.c')
-rw-r--r--commands/bootm.c34
1 files changed, 4 insertions, 30 deletions
diff --git a/commands/bootm.c b/commands/bootm.c
index 005d5823b2..927c2fbc5e 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -46,27 +46,6 @@
#include <magicvar.h>
#include <asm-generic/memory_layout.h>
-static char *bootm_image_name_and_no(const char *name, int *no)
-{
- char *at, *ret;
-
- if (!name || !*name)
- return NULL;
-
- *no = 0;
-
- ret = xstrdup(name);
- at = strchr(ret, '@');
- if (!at)
- return ret;
-
- *at++ = 0;
-
- *no = simple_strtoul(at, NULL, 10);
-
- return ret;
-}
-
#define BOOTM_OPTS_COMMON "ca:e:vo:f"
#ifdef CONFIG_CMD_BOOTM_INITRD
@@ -78,12 +57,10 @@ static char *bootm_image_name_and_no(const char *name, int *no)
static int do_bootm(int argc, char *argv[])
{
int opt;
- struct image_data data;
+ struct bootm_data data = {};
int ret = 1;
const char *oftree = NULL, *initrd_file = NULL, *os_file = NULL;
- memset(&data, 0, sizeof(struct image_data));
-
data.initrd_address = UIMAGE_INVALID_ADDRESS;
data.os_address = UIMAGE_SOME_ADDRESS;
data.verify = 0;
@@ -143,18 +120,15 @@ static int do_bootm(int argc, char *argv[])
if (oftree && !*oftree)
oftree = NULL;
- data.os_file = bootm_image_name_and_no(os_file, &data.os_num);
- data.oftree_file = bootm_image_name_and_no(oftree, &data.oftree_num);
- data.initrd_file = bootm_image_name_and_no(initrd_file, &data.initrd_num);
+ data.os_file = os_file;
+ data.oftree_file = oftree;
+ data.initrd_file = initrd_file;
ret = bootm_boot(&data);
printf("handler failed with %s\n", strerror(-ret));
err_out:
- free(data.initrd_file);
- free(data.os_file);
-
return 1;
}