[syslinux:elflink] menu: Supply the command type to execute()

syslinux-bot for Matt Fleming matt.fleming at intel.com
Thu Jul 19 08:48:03 PDT 2012


Commit-ID:  316f9636e3958ada609d506deca8db3aef395e54
Gitweb:     http://www.syslinux.org/commit/316f9636e3958ada609d506deca8db3aef395e54
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Tue, 3 Jul 2012 09:34:03 +0100
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Tue, 3 Jul 2012 09:44:35 +0100

menu: Supply the command type to execute()

The old execute() was much more forgiving when passing a COM32 module
as KT_NONE, as the old code for loading a kernel could also handle
COM32 modules. This isn't the case with new_linux_kernel(), and COM32
modules really need to take the create_args_and_load() path in
execute().

Without this change loading .c32 files from vesamenu.c32/menu.c32
fails.

Reported-by: Helmut Hullen <Hullen at t-online.de>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/elflink/ldlinux/ldlinux.c |    2 +-
 com32/include/menu.h            |    2 ++
 com32/menu/menumain.c           |   10 +++++++---
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 4ad5eb8..f56f2c0 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -45,7 +45,7 @@ static inline const char *find_command(const char *str)
 	return p;
 }
 
-static enum kernel_type parse_kernel_type(const char *kernel)
+enum kernel_type parse_kernel_type(const char *kernel)
 {
 	const struct file_ext *ext;
 	const char *p;
diff --git a/com32/include/menu.h b/com32/include/menu.h
index be2eaeb..a3e9cd6 100644
--- a/com32/include/menu.h
+++ b/com32/include/menu.h
@@ -94,6 +94,8 @@ enum kernel_type {
 
 extern const char *const kernel_types[];
 
+extern enum kernel_type parse_kernel_type(const char *kernel);
+
 /* Configurable integer parameters */
 enum parameter_number {
     P_WIDTH,
diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c
index a795cb2..53bc6c6 100644
--- a/com32/menu/menumain.c
+++ b/com32/menu/menumain.c
@@ -1161,9 +1161,13 @@ int main(int argc, char *argv[])
 	printf("\033[?25h\033[%d;1H\033[0m", cursorrow);
 
 	if (cmdline) {
-	    execute(cmdline, KT_NONE);
-	    if (cm->onerror)
-		execute(cm->onerror, KT_NONE);
+	    enum kernel_type type = parse_kernel_type(cmdline);
+
+	    execute(cmdline, type);
+	    if (cm->onerror) {
+		type = parse_kernel_type(cm->onerror);
+		execute(cm->onerror, type);
+	    }
 	} else {
 	    return 0;		/* Exit */
 	}


More information about the Syslinux-commits mailing list