[syslinux] [PATCH 15/19] ldlinux: Make the default execute type KT_KERNEL

Matt Fleming matt at console-pimps.org
Fri Mar 23 11:02:49 PDT 2012


From: Matt Fleming <matt.fleming at intel.com>

Default to trying to boot a linux kernel image, which was the
behaviour of the old asm image file loader.

Note that we don't need to go through __intcall() to load a kernel as
the dynamic linker will fixup any references to the kernel load
functions for us at runtime. Furthermore, modules invoking execute()
could be located anywhere in the 32-bit address space and may not be
able to represent their pointer arguments with SEG() and OFFS(), so
using the comboot API may not even work.

Signed-off-by: Matt Fleming <matt.fleming at intel.com>
---
 com32/elflink/ldlinux/execute.c |   25 +++++++------------------
 1 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c
index b3ed958..269b74d 100644
--- a/com32/elflink/ldlinux/execute.c
+++ b/com32/elflink/ldlinux/execute.c
@@ -86,10 +86,6 @@ void execute(const char *cmdline, enum kernel_type type)
 		/* new entry for elf format c32 */
 		lfree(kernel);
 		create_args_and_load(cmdline);
-	} else if (type == KT_KERNEL) {
-		/* Need add one item for kernel load, as we don't use
-		* the assembly runkernel.inc any more */
-		new_linux_kernel(kernel, cmdline);
 	} else if (type == KT_CONFIG) {
 		char *argv[] = { "ldlinux.c32", NULL };
 
@@ -101,22 +97,15 @@ void execute(const char *cmdline, enum kernel_type type)
 			mangle_name(config_cwd, args);
 
 		start_ldlinux("ldlinux.c32", 1, argv);
-	} else {
+	} else if (type == KT_LOCALBOOT) {
 		/* process the image need int 22 support */
-		if (type == KT_LOCALBOOT) {
-			ireg.eax.w[0] = 0x0014;	/* Local boot */
-			ireg.edx.w[0] = strtoul(kernel, NULL, 0);
-		} else {
-			ireg.eax.w[0] = 0x0016;	/* Run kernel image */
-			ireg.esi.w[0] = OFFS(kernel);
-			ireg.ds = SEG(kernel);
-			ireg.ebx.w[0] = OFFS(args);
-			ireg.es = SEG(args);
-			ireg.edx.l = type - KT_KERNEL;
-			/* ireg.ecx.l    = 0; *//* We do ipappend "manually" */
-		}
-
+		ireg.eax.w[0] = 0x0014;	/* Local boot */
+		ireg.edx.w[0] = strtoul(kernel, NULL, 0);
 		__intcall(0x22, &ireg, NULL);
+	} else {
+		/* Need add one item for kernel load, as we don't use
+		* the assembly runkernel.inc any more */
+		new_linux_kernel(kernel, cmdline);
 	}
 
 	lfree(kernel);
-- 
1.7.4.4




More information about the Syslinux mailing list