[syslinux:elflink] ldlinux: Parse configuration files

syslinux-bot for Matt Fleming matt.fleming at linux.intel.com
Mon Mar 14 15:33:57 PDT 2011


Commit-ID:  5c907b4f4fbbe9ee565aa4fdfec6ae9be6d28580
Gitweb:     http://syslinux.zytor.com/commit/5c907b4f4fbbe9ee565aa4fdfec6ae9be6d28580
Author:     Matt Fleming <matt.fleming at linux.intel.com>
AuthorDate: Tue, 8 Mar 2011 19:25:37 +0000
Committer:  Matt Fleming <matt.fleming at linux.intel.com>
CommitDate: Wed, 9 Mar 2011 14:32:36 +0000

ldlinux: Parse configuration files

Use the configuration file parser provided by ldlinux to search for
and parse any configuration files. If a kernel or ui module is found
in the configuration file, it is executed once parsing completes.

Parsing and loading kernels is now entirely done in C!

The parser also builds the data structures for later use by the menu
system. Previously, after the asm config parser had parsed the config
file and found a kernel image to boot (or dropped the user at a
command prompt), the menu.c32 module had to open the config file and
re-parse it. Now, we only need to parse the file once.

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


---
 com32/elflink/ldlinux/ldlinux.c |   35 +++++++++++++++++++++++++++++++++++
 core/isolinux.asm               |    6 ------
 2 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index b348490..b94010e 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -26,10 +26,45 @@ static void enter_cmdline(void)
 	}
 }
 
+static void load_kernel(void)
+{
+	enum kernel_type type;
+
+	if (defaultlevel == LEVEL_UI)
+		type = KT_COM32;
+	else
+		type = KT_KERNEL;
+
+	execute(default_cmd, type);
+}
+
 static int ldlinux_main(int argc, char **argv)
 {
 	openconsole(&dev_rawcon_r, &dev_ansiserial_w);
 
+	parse_configs(NULL);
+
+	/* TODO: ADV */
+	/* TODO: Check KbdFlags? */
+
+	if (forceprompt)
+		goto cmdline;
+
+	/*
+	 * Auto boot
+	 */
+	if (defaultlevel || !noescape) {
+		if (defaultlevel) {
+			load_kernel();	/* Shouldn't return */
+		} else {
+			printf("No DEFAULT or UI configuration directive found!\n");
+
+			if (noescape)
+				kaboom();
+		}
+	}
+
+cmdline:
 	/* Should never return */
 	enter_cmdline();
 
diff --git a/core/isolinux.asm b/core/isolinux.asm
index ba1d156..8995ce8 100644
--- a/core/isolinux.asm
+++ b/core/isolinux.asm
@@ -1185,12 +1185,6 @@ ROOT_FS_OPS:
 		section .text16
 
 ;
-; Locate the configuration file
-;
-		;pm_call pm_load_config
-		;jz no_config_file
-
-;
 ; Now we have the config file open.  Parse the config file and
 ; run the user interface.
 ;



More information about the Syslinux-commits mailing list