diff options
author | Gabe Black <gabeblack@chromium.org> | 2011-11-22 03:00:13 -0800 |
---|---|---|
committer | Gabe Black <gabeblack@chromium.org> | 2011-11-22 22:15:51 -0800 |
commit | 69dbbeb9bf43529170c815acfc9d84f0d9c44317 (patch) | |
tree | a4b1bddc925abacb70a2d740eb907146a2c21360 /arch | |
parent | 7e2a1f22621606e2ae624a51090129ae05754620 (diff) |
Add support for specifying an initrd with the zboot command
This change finishes plumbing the initrd support built into the zboot
mechanism out to the command interface.
It also fixes a bug in the command declaration where the kernel size could
be passed as an optional second parameter but not enough arguments were
allowed.
BUG=chrome-os-partner:6715
TEST=Built and booted on a Lumpy with the U-Boot command line exposed. Used
the Linux kernel in the system partition and the initramfs used for recovery
to boot the system. Observed that the recovery scripts in the initramfs ran.
The hardest part about implementing this change was testing because it took
many attempts to build/find an initrd/initramfs and command line that would
actually work. I'm confident the problems I had were from not knowing how to
set up or use an initramfs properly, not from the U-Boot support itself.
Signed-off-by: Gabe Black <gabeblack@google.com>
Change-Id: Iccc5ff62e170e738dfb429a6b0ef9e27f0e7d8a9
Reviewed-on: https://gerrit.chromium.org/gerrit/12027
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/lib/zimage.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index e6ce69353c..5da2d33224 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -343,6 +343,8 @@ int do_zboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) void *load_address; char *s; ulong bzImage_size = 0; + ulong initrd_addr = 0; + ulong initrd_size = 0; disable_interrupts(); @@ -359,9 +361,15 @@ int do_zboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (s) bzImage_addr = (void *)simple_strtoul(s, NULL, 16); - if (argc >= 3) + if (argc >= 3) { /* argv[2] holds the size of the bzImage */ bzImage_size = simple_strtoul(argv[2], NULL, 16); + } + + if (argc >= 4) + initrd_addr = simple_strtoul(argv[3], NULL, 16); + if (argc >= 5) + initrd_size = simple_strtoul(argv[4], NULL, 16); /* Lets look for*/ base_ptr = load_zimage(bzImage_addr, bzImage_size, &load_address); @@ -371,7 +379,7 @@ int do_zboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return -1; } if (setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET, - 0, 0, 0)) { + 0, initrd_addr, initrd_size)) { printf("Setting up boot parameters failed ...\n"); return -1; } @@ -388,7 +396,7 @@ int do_zboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } U_BOOT_CMD( - zboot, 2, 0, do_zboot, + zboot, 5, 0, do_zboot, "Boot bzImage", "" ); |