[syslinux:elflink] ldlinux: Append BOOT_IMAGE= to kernel cmdline

syslinux-bot for Matt Fleming matt.fleming at intel.com
Thu Feb 7 03:45:05 PST 2013


Commit-ID:  281e6e2253e737675458e75624a5ba42f0a5f4d6
Gitweb:     http://www.syslinux.org/commit/281e6e2253e737675458e75624a5ba42f0a5f4d6
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Thu, 7 Feb 2013 11:28:58 +0000
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Thu, 7 Feb 2013 11:40:35 +0000

ldlinux: Append BOOT_IMAGE= to kernel cmdline

Some users rely on the syntax of the kernel cmdline from 4.xx and this
is currently different in 5.xx. Fix things to match the 4.xx syntax.

Cc: H. Peter Anvin <hpa at zytor.com>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/elflink/ldlinux/execute.c |  2 +-
 com32/elflink/ldlinux/kernel.c  | 17 +++++------------
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c
index 5c53b99..c6fa8d8 100644
--- a/com32/elflink/ldlinux/execute.c
+++ b/com32/elflink/ldlinux/execute.c
@@ -142,7 +142,7 @@ __export void execute(const char *cmdline, uint32_t type)
 	} else {
 		/* Need add one item for kernel load, as we don't use
 		* the assembly runkernel.inc any more */
-		new_linux_kernel((char *)kernel, (char *)cmdline);
+		new_linux_kernel((char *)kernel, (char *)args);
 	}
 
 	free((void *)kernel);
diff --git a/com32/elflink/ldlinux/kernel.c b/com32/elflink/ldlinux/kernel.c
index 920246f..f3ba37f 100644
--- a/com32/elflink/ldlinux/kernel.c
+++ b/com32/elflink/ldlinux/kernel.c
@@ -35,14 +35,10 @@ int new_linux_kernel(char *okernel, char *ocmdline)
 	else if (append)
 		args = append;
 
-	cmdline_len = strlen(kernel_name);
-	if (args) {
-		/* +1 for the space (' ') between kernel and args */
-		cmdline_len += strlen(args) + 1;
-	}
-
-	/* +1 for NUL termination */
-	cmdline_len++;
+	cmdline_len = strlen("BOOT_IMAGE=") + strlen(kernel_name);
+	cmdline_len += 1;	/* space between BOOT_IMAGE and args */
+	cmdline_len += strlen(args);
+	cmdline_len += 1;	/* NUL-termination */
 
 	cmdline = malloc(cmdline_len);
 	if (!cmdline) {
@@ -50,10 +46,7 @@ int new_linux_kernel(char *okernel, char *ocmdline)
 	    return 1;
 	}
 
-	if (args)
-		snprintf(cmdline, cmdline_len, "%s %s", kernel_name, args);
-	else
-		snprintf(cmdline, cmdline_len, "%s", kernel_name);
+	sprintf(cmdline, "BOOT_IMAGE=%s %s", kernel_name, args);
 
 	/* "keeppxe" handling */
 #if IS_PXELINUX


More information about the Syslinux-commits mailing list