summaryrefslogtreecommitdiff
path: root/common/bootm.c
diff options
context:
space:
mode:
authorZubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>2016-09-09 09:18:58 +0100
committerTom Rini <trini@konsulko.com>2016-10-01 20:04:37 -0400
commitba07984068dc96a2234371545df043495dcbeadd (patch)
treecd4b1f2dd767040750f243d7c93843585b92e48a /common/bootm.c
parentb98278be7bd64f8726b388416947118f65077b2b (diff)
bootm: fix passing argc to standalone apps
This bug appears in b6396403 which makes u-boot unable to pass arguments via bootm to a standalone application without this patch. Steps to reproduce. Compile a u-boot. Use mkimage to package the standalone hello_world.bin file. e.g. For the MIPS Boston platform mkimage -n "hello" -A mips -O u-boot -C none -T standalone \ -a 0xffffffff80200000 -d hello_world.bin \ -ep 0xffffffff80200000 hello_out Then tftp hello_out and run it using boston # dhcp 192.168.154.45:hello_out ... boston # bootm $loadaddr 123 321 Without the patch the following output is observed. boston # bootm $loadaddr 123 321 Image Name: hello Image Type: MIPS U-Boot Standalone Program (uncompressed) Data Size: 1240 Bytes = 1.2 KiB Load Address: 80200000 Entry Point: 80200000 Verifying Checksum ... OK Loading Standalone Program ... OK Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 0 argv[0] = "0xffffffff88000000" With the patch, you see the following. boston # bootm $loadaddr 123 321 Image Name: hello Image Type: MIPS U-Boot Standalone Program (uncompressed) Data Size: 1240 Bytes = 1.2 KiB Load Address: 80200000 Entry Point: 80200000 Verifying Checksum ... OK Loading Standalone Program ... OK Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 3 argv[0] = "0xffffffff88000000" argv[1] = "123" argv[2] = "321" argv[3] = "<NULL>" Without the patch, the go command at the entry point seems to work. boston # go 0xffffffff80200000 123 321 Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 3 argv[0] = "0xffffffff80200000" argv[1] = "123" argv[2] = "321" argv[3] = "<NULL>" Hit any key to exit ... Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/bootm.c')
-rw-r--r--common/bootm.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/common/bootm.c b/common/bootm.c
index a4d22a6ec4..b2c09126ce 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -619,10 +619,8 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
if (!ret && (states & BOOTM_STATE_FINDOS))
ret = bootm_find_os(cmdtp, flag, argc, argv);
- if (!ret && (states & BOOTM_STATE_FINDOTHER)) {
+ if (!ret && (states & BOOTM_STATE_FINDOTHER))
ret = bootm_find_other(cmdtp, flag, argc, argv);
- argc = 0; /* consume the args */
- }
/* Load the OS */
if (!ret && (states & BOOTM_STATE_LOADOS)) {