[syslinux:firmware] ldlinux: Handle multiple arguments to initrd=

syslinux-bot for Matt Fleming matt.fleming at intel.com
Fri Nov 9 09:06:15 PST 2012


Commit-ID:  6414cda12d09d39b894e5d7f5af20fa71bfb9e04
Gitweb:     http://www.syslinux.org/commit/6414cda12d09d39b894e5d7f5af20fa71bfb9e04
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Wed, 1 Feb 2012 14:14:55 +0000
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Thu, 2 Feb 2012 16:21:00 +0000

ldlinux: Handle multiple arguments to initrd=

The linux COM32 module handles a comma-separated list of initrd files
to load but the ldlinux code does not. Copy the code from the COM32
module so kernels can be loaded with multiple initrds.

Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/elflink/ldlinux/kernel.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/com32/elflink/ldlinux/kernel.c b/com32/elflink/ldlinux/kernel.c
index 2438d11..bdcd3cb 100644
--- a/com32/elflink/ldlinux/kernel.c
+++ b/com32/elflink/ldlinux/kernel.c
@@ -106,14 +106,22 @@ int new_linux_kernel(char *okernel, char *ocmdline)
 	/* Find and load initramfs */
 	temp = strstr(cmdline, "initrd=");
 	if (temp) {
-		i = 0;
+		char *p;
 
 		temp += strlen("initrd=");
-		while (*temp != ' ' && *temp)
-			initrd_name[i++] = *temp++;
-		initrd_name[i] = '\0';
-
-		initramfs_load_archive(initramfs, initrd_name);
+		do {
+			p = strchr(temp, ',');
+			if (p)
+				*p = '\0';
+
+			if (initramfs_load_archive(initramfs, temp)) {
+				printf("failed!\n");
+				goto bail;
+			}
+
+			if (p)
+				*p++ = ',';
+		} while ((temp = p));
 	}
 
 	//dprintf("loading initrd done");


More information about the Syslinux-commits mailing list