From b7b35f53686f5ee0e35caf195adc97b88d393c71 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Tue, 6 Dec 2011 23:09:37 +0800 Subject: [PATCH 1/1] bootm: fix initrd multi-image support the -L option use get_fake_image_handle expect the uImage is mapped so move is after the uImage is mapped Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- commands/bootm.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/commands/bootm.c b/commands/bootm.c index d796914..c7ce42e 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -141,6 +141,7 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[]) struct image_handler *handler; struct image_data data; int ret = 1; + int initrd_num = 0; char options[53]; /* worst case: whole alphabet with colons */ memset(&data, 0, sizeof(struct image_data)); @@ -175,14 +176,12 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[]) printf("use initrd %s\n", optarg); /* check for multi image @ */ if (optarg[0] == '@') { - int num = simple_strtol(optarg + 1, NULL, 0); - - data.initrd = get_fake_image_handle(&data, num); + initrd_num = simple_strtol(optarg + 1, NULL, 0); } else { data.initrd = map_image(optarg, data.verify); + if (!data.initrd) + goto err_out; } - if (!data.initrd) - goto err_out; break; default: break; @@ -201,6 +200,12 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[]) os_header = &os_handle->header; + if (initrd_num) { + data.initrd = get_fake_image_handle(&data, initrd_num); + if (!data.initrd) + goto err_out; + } + if (image_get_arch(os_header) != IH_ARCH) { printf("Unsupported Architecture 0x%x\n", image_get_arch(os_header)); -- 1.7.7