summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dearman <chris.dearman@imgtec.com>2014-09-24 23:23:01 +0400
committerMatt Redfearn <matt.redfearn@imgtec.com>2015-08-26 11:53:20 +0300
commit7c4909934860d76d23a966ec0a45d19a7f9276bb (patch)
tree76e9046d7c179b953c35b04ac61f03b91c9ebbfe
parent9b23a9375e8808b8907b749e054acadf49f83c05 (diff)
downloadCI20_u-boot-7c4909934860d76d23a966ec0a45d19a7f9276bb.tar.xz
Refactor linux command line parsing
This allows the bootcmd environment to be appended to the command line extracted from the Android boot image. Change-Id: Ieb383d957025fd2f0b493ca3d61c5785fceb9f98
-rw-r--r--arch/mips/lib/bootm.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index de52ef0b9..1065ee0ba 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -81,13 +81,9 @@ static void linux_cmdline_dump(void)
debug(" arg %03d: %s\n", i, linux_argv[i]);
}
-static void boot_cmdline_linux(bootm_headers_t *images)
+static void linux_cmdline_parse(const char *bootargs)
{
- const char *bootargs, *next, *quote;
-
- linux_cmdline_init();
-
- bootargs = getenv("bootargs");
+ const char *next, *quote;
if (!bootargs)
return;
@@ -119,7 +115,13 @@ static void boot_cmdline_linux(bootm_headers_t *images)
bootargs = next;
}
+}
+static void boot_cmdline_linux(bootm_headers_t * images, const char *baseargs)
+{
+ linux_cmdline_init();
+ linux_cmdline_parse(baseargs);
+ linux_cmdline_parse(getenv("bootargs"));
linux_cmdline_dump();
}
@@ -227,7 +229,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
return -1;
if (flag & BOOTM_STATE_OS_CMDLINE) {
- boot_cmdline_linux(images);
+ boot_cmdline_linux(images, NULL);
return 0;
}
@@ -241,7 +243,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
return 0;
}
- boot_cmdline_linux(images);
+ boot_cmdline_linux(images, NULL);
boot_prep_linux(images);
boot_jump_linux(images);
@@ -303,11 +305,8 @@ void do_boota_linux(bootm_headers_t * images,
memcpy(kernel_dst_addr, kernel_src_addr, fb_hdr->kernel_size);
memcpy(ramdisk_dst_addr, ramdisk_src_addr, fb_hdr->ramdisk_size);
- boot_cmdline_linux(NULL);
-
// Include any kernel command line options from boot.img
- const char *bcmdline = (const char *)fb_hdr->cmdline;
- linux_cmdline_set(bcmdline, strlen(bcmdline));
+ boot_cmdline_linux(images, (const char *)fb_hdr->cmdline);
// TODO: These extra lines are being added to support old
// kernels which expect these two parameters to be included