aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-03-27 14:42:51 -0700
committerH. Peter Anvin <hpa@zytor.com>2012-03-27 14:42:51 -0700
commitf4bb0ff748a3259427c5856714720570a7a5ebf6 (patch)
tree02f44b4c69ddc1118280f87881fb6c2f0e551d79
parente04ee714164d5d8d93ce1abed2bbb5c5fb36bf05 (diff)
downloadsyslinux-f4bb0ff748a3259427c5856714720570a7a5ebf6.tar.gz
syslinux-f4bb0ff748a3259427c5856714720570a7a5ebf6.tar.xz
syslinux-f4bb0ff748a3259427c5856714720570a7a5ebf6.zip
kernel: Support multiple initrds
Support loading multiple initrd images separated by commas. It still doesn't correctly handle a secondary initrd= argument overriding the first; not clear if that really was a good idea or if they would be considered additive arguments. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/elflink/ldlinux/kernel.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/com32/elflink/ldlinux/kernel.c b/com32/elflink/ldlinux/kernel.c
index 81659540..375dab04 100644
--- a/com32/elflink/ldlinux/kernel.c
+++ b/com32/elflink/ldlinux/kernel.c
@@ -101,22 +101,35 @@ int new_linux_kernel(char *okernel, char *ocmdline)
/* Find and load initramfs */
temp = strstr(cmdline, "initrd=");
if (temp) {
- i = 0;
-
/* Initialize the initramfs chain */
initramfs = initramfs_init();
if (!initramfs)
goto bail;
- temp += strlen("initrd=");
- while (*temp != ' ' && *temp)
- initrd_name[i++] = *temp++;
- initrd_name[i] = '\0';
+ temp += 6; /* strlen("initrd") */
+ do {
+ char *p = initrd_name;
- initramfs_load_archive(initramfs, initrd_name);
- }
+ temp++; /* Skip = or , */
+
+ while (*temp != ' ' && *temp != ',' && *temp)
+ *p++ = *temp++;
+ *p = '\0';
+
+ if (!opt_quiet)
+ printf("Loading %s...", initrd_name);
- //dprintf("loading initrd done");
+ if (initramfs_load_archive(initramfs, initrd_name)) {
+ if (opt_quiet)
+ printf("Loading %s ", initrd_name);
+ printf("failed!\n");
+ goto bail;
+ }
+
+ if (!opt_quiet)
+ printf("ok\n");
+ } while (*temp == ',');
+ }
/* This should not return... */
syslinux_boot_linux(kernel_data, kernel_len, initramfs, cmdline);