bootm: factor out initrd code from option parser
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
083b3bd52a
commit
3180d4b3e3
|
@ -121,6 +121,7 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[])
|
|||
struct image_handle *os_handle = NULL;
|
||||
struct image_handler *handler;
|
||||
struct image_data data;
|
||||
const char *initrdname = NULL;
|
||||
int ret = 1;
|
||||
|
||||
memset(&data, 0, sizeof(struct image_data));
|
||||
|
@ -136,17 +137,7 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[])
|
|||
data.initrd_address = simple_strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'r':
|
||||
printf("use initrd %s\n", optarg);
|
||||
/* check for multi image @<num> */
|
||||
if (optarg[0] == '@') {
|
||||
int num = simple_strtol(optarg + 1, NULL, 0);
|
||||
|
||||
data.initrd = get_fake_image_handle(&data, num);
|
||||
} else {
|
||||
data.initrd = map_image(optarg, data.verify);
|
||||
}
|
||||
if (!data.initrd)
|
||||
goto err_out;
|
||||
initrdname = optarg;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -171,6 +162,19 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[])
|
|||
goto err_out;
|
||||
}
|
||||
|
||||
if (initrdname) {
|
||||
/* check for multi image @<num> */
|
||||
if (initrdname[0] == '@') {
|
||||
int num = simple_strtol(optarg + 1, NULL, 0);
|
||||
|
||||
data.initrd = get_fake_image_handle(&data, num);
|
||||
} else {
|
||||
data.initrd = map_image(optarg, data.verify);
|
||||
}
|
||||
if (!data.initrd)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/*
|
||||
* We have reached the point of no return: we are going to
|
||||
* overwrite all exception vector code, so we cannot easily
|
||||
|
|
Loading…
Reference in New Issue