bootm: fix initrd handling
bootm_initrd tests for data->initrd, but this never becomes true because the setting of data->initrd is inside a if(bootm_initrd()). Fix this. Also, do not support the initrd options when initrd is disabled. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
55d88805ed
commit
deadc3dd7e
|
@ -50,18 +50,6 @@
|
||||||
|
|
||||||
static LIST_HEAD(handler_list);
|
static LIST_HEAD(handler_list);
|
||||||
|
|
||||||
#ifdef CONFIG_CMD_BOOTM_INITRD
|
|
||||||
static inline int bootm_initrd(struct image_data *data)
|
|
||||||
{
|
|
||||||
return data->initrd ? 1 : 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static inline int bootm_initrd(struct image_data *data)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int register_image_handler(struct image_handler *handler)
|
int register_image_handler(struct image_handler *handler)
|
||||||
{
|
{
|
||||||
list_add_tail(&handler->list, &handler_list);
|
list_add_tail(&handler->list, &handler_list);
|
||||||
|
@ -252,6 +240,14 @@ static void bootm_image_name_and_no(char *name, int *no)
|
||||||
*no = simple_strtoul(at, NULL, 10);
|
*no = simple_strtoul(at, NULL, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define BOOTM_OPTS_COMMON "ca:e:vo:f"
|
||||||
|
|
||||||
|
#ifdef CONFIG_CMD_BOOTM_INITRD
|
||||||
|
#define BOOTM_OPTS BOOTM_OPTS_COMMON "L:r:"
|
||||||
|
#else
|
||||||
|
#define BOOTM_OPTS BOOTM_OPTS_COMMON
|
||||||
|
#endif
|
||||||
|
|
||||||
static int do_bootm(int argc, char *argv[])
|
static int do_bootm(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
|
@ -269,7 +265,7 @@ static int do_bootm(int argc, char *argv[])
|
||||||
data.verify = 0;
|
data.verify = 0;
|
||||||
data.verbose = 0;
|
data.verbose = 0;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "cL:r:a:e:vo:f")) > 0) {
|
while ((opt = getopt(argc, argv, BOOTM_OPTS)) > 0) {
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'c':
|
case 'c':
|
||||||
data.verify = 1;
|
data.verify = 1;
|
||||||
|
@ -330,7 +326,7 @@ static int do_bootm(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bootm_initrd(&data)) {
|
if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD) && data.initrd_file) {
|
||||||
bootm_image_name_and_no(data.initrd_file, &data.initrd_num);
|
bootm_image_name_and_no(data.initrd_file, &data.initrd_num);
|
||||||
|
|
||||||
initrd_type = file_name_detect_type(data.initrd_file);
|
initrd_type = file_name_detect_type(data.initrd_file);
|
||||||
|
|
Loading…
Reference in New Issue