[syslinux] [PATCH 12/12] ldlinux: makes loading initramfs compatible with multidisk
Andre Ericson
de.ericson at gmail.com
Fri Aug 31 00:47:35 PDT 2012
Since you can specify more than one initramfs separated by a comma, it
broke multidisk syntax as something like (hd0,2) would be broken at the
comma resulting in "(hd0" and "2)". Any comma before the ')' are now
ignored for multidisk paths.
Signed-off-by: Andre Ericson <de.ericson at gmail.com>
---
com32/elflink/ldlinux/kernel.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/com32/elflink/ldlinux/kernel.c b/com32/elflink/ldlinux/kernel.c
index b8f9cb8..b035570 100644
--- a/com32/elflink/ldlinux/kernel.c
+++ b/com32/elflink/ldlinux/kernel.c
@@ -21,6 +21,7 @@ int new_linux_kernel(char *okernel, char *ocmdline)
void *kernel_data;
size_t kernel_len;
bool opt_quiet = false;
+ bool accept_comma = false; /* multidisk syntax workaround for initramfs */
char initrd_name[256];
char cmdline_buf[256], *cmdline;
@@ -107,12 +108,20 @@ int new_linux_kernel(char *okernel, char *ocmdline)
temp += 6; /* strlen("initrd") */
do {
+ accept_comma = false;
char *p = initrd_name;
temp++; /* Skip = or , */
- while (*temp != ' ' && *temp != ',' && *temp)
- *p++ = *temp++;
+ if (*temp == '(') /* multidisk path */
+ accept_comma = true;
+
+ /* should not stop at any comma before ')' if it's a multidisk path */
+ while (*temp != ' ' && (accept_comma || *temp != ',') && *temp) {
+ if (*temp == ')')
+ accept_comma = false;
+ *p++ = *temp++;
+ }
*p = '\0';
if (!opt_quiet)
--
1.7.11.3
More information about the Syslinux
mailing list