[syslinux:elflink] ldlinux: Record "default" and "ui" command lines
syslinux-bot for Matt Fleming
matt.fleming at linux.intel.com
Mon Mar 14 15:33:55 PDT 2011
Commit-ID: 5fd19f467ae4e8f5dc7298b56c63f5d9d7569b9d
Gitweb: http://syslinux.zytor.com/commit/5fd19f467ae4e8f5dc7298b56c63f5d9d7569b9d
Author: Matt Fleming <matt.fleming at linux.intel.com>
AuthorDate: Tue, 8 Mar 2011 17:07:13 +0000
Committer: Matt Fleming <matt.fleming at linux.intel.com>
CommitDate: Wed, 9 Mar 2011 14:32:36 +0000
ldlinux: Record "default" and "ui" command lines
The command line following the "default" and "ui" options may be a
kernel or com32 module to load and execute, so we need to record it
for later processing.
Signed-off-by: Matt Fleming <matt.fleming at linux.intel.com>
---
com32/elflink/ldlinux/config.h | 9 +++++++++
com32/elflink/ldlinux/readconfig.c | 22 +++++++++++++++++++---
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h
index 3125b27..17c7b28 100644
--- a/com32/elflink/ldlinux/config.h
+++ b/com32/elflink/ldlinux/config.h
@@ -12,6 +12,13 @@
#ifndef __CONFIG_H__
#define __CONFIG_H__
+/*
+ * These values correspond to the "default" and "ui" commands
+ * respectively. "ui" takes precendence over "default".
+ */
+#define LEVEL_DEFAULT 1
+#define LEVEL_UI 2
+
extern short uappendlen; //bytes in append= command
extern short ontimeoutlen; //bytes in ontimeout command
extern short onerrorlen; //bytes in onerror command
@@ -26,4 +33,6 @@ extern short vkernel; //have we seen any "label" statements?
extern short displaycon; //conio.inc
extern short nohalt; //idle.inc
+extern char *default_cmd; //"default" command line
+
#endif /* __CONFIG_H__ */
diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c
index f365b6f..ed498ff 100644
--- a/com32/elflink/ldlinux/readconfig.c
+++ b/com32/elflink/ldlinux/readconfig.c
@@ -59,6 +59,7 @@ short vkernel = 0; //have we seen any "label" statements?
short displaycon = 1; //conio.inc
short nohalt = 1; //idle.inc
+char *default_cmd = NULL; //"default" command line
/* Empty refstring */
const char *empty_string;
@@ -978,11 +979,26 @@ do_include:
else
ipappend = atoi(skipspace(p + 8));
} else if (looking_at(p, "default")) {
- /* default could be a kernel image or another label */
- refstr_put(globaldefault);
- globaldefault = refstrdup(skipspace(p + 7));
+ /* default could be a kernel image or another label */
+ refstr_put(globaldefault);
+ globaldefault = refstrdup(skipspace(p + 7));
+
+ /*
+ * On the chance that "default" is actually a kernel image
+ * and not a label, store a copy of it, but only if we
+ * haven't seen a "ui" command. "ui" commands take
+ * precendence over "default" commands.
+ */
+ if (defaultlevel < LEVEL_UI) {
+ defaultlevel = LEVEL_DEFAULT;
+ refstr_put(default_cmd);
+ default_cmd = refstrdup(globaldefault);
+ }
} else if (looking_at(p, "ui")) {
has_ui = 1;
+ defaultlevel = LEVEL_UI;
+ refstr_put(default_cmd);
+ default_cmd = refstrdup(skipspace(p + 2));
}
/*
More information about the Syslinux-commits
mailing list