[syslinux] please revert MENU CLEAR so to make it optional again

Matt Fleming matt at console-pimps.org
Tue Nov 27 07:00:58 PST 2012


On Tue, 2012-11-27 at 13:22 +0000, Matt Fleming wrote:
> On Mon, 2012-11-26 at 10:26 -0800, H. Peter Anvin wrote:
> > The logic was that we have an effective "MENU CLEAR" default in 4.06 for
> > vesamenu.c32, but that isn't actually true... we have it only as long as
> > the user is *not* using "quiet vga=current", which is what a lot of the
> > distributions like to run with.
> > 
> > So I think you're right, we probably should revert it.
> > 
> > *HOWEVER*, please be aware that that will not actually bring back the
> > 4.06 behavior of clearing the screen implicitly when vesamenu.c32 is in
> > use and "quiet vga=current" is not used.
> 
> OK folks, I'm going to revert this commit for Syslinux-5.00-pre11. We'll
> have to fix the issue it was supposed to solve a different way.

How about something like this? It resets the console to text mode
whenever we are about to execute a COM32 module, or we return from a
COM32 module, which seems to be inline with how 4.0x worked.

---

diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h
index 9b7ce4a..c551fb1 100644
--- a/com32/elflink/ldlinux/config.h
+++ b/com32/elflink/ldlinux/config.h
@@ -48,6 +48,7 @@ extern int new_linux_kernel(char *okernel, char *ocmdline);
 extern void pm_load_high(com32sys_t *regs);
 
 extern void ldlinux_enter_command(void);
+extern void ldlinux_console_init(void);
 extern const char *apply_extension(const char *kernel, const char *ext);
 
 #endif /* __CONFIG_H__ */
diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c
index e06192e..1039923 100644
--- a/com32/elflink/ldlinux/execute.c
+++ b/com32/elflink/ldlinux/execute.c
@@ -102,6 +102,12 @@ void execute(const char *cmdline, uint32_t type)
 	}
 
 	if (type == IMAGE_TYPE_COM32) {
+		/*
+		 * We may be called with the console in an unknown
+		 * state, so initialise it.
+		 */
+		ldlinux_console_init();
+
 		/* new entry for elf format c32 */
 		create_args_and_load((char *)cmdline);
 
@@ -112,6 +118,10 @@ void execute(const char *cmdline, uint32_t type)
 		 * e.g. from vesamenu.c32.
 		 */
 		unload_modules_since("ldlinux.c32");
+
+		/* Restore the console */
+		ldlinux_console_init();
+
 		ldlinux_enter_command();
 	} else if (type == IMAGE_TYPE_CONFIG) {
 		char *argv[] = { "ldlinux.c32", NULL };
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 4a09283..82d2ae6 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -270,6 +270,11 @@ static void __destructor close_console(void)
 		close(i);
 }
 
+void ldlinux_console_init(void)
+{
+	openconsole(&dev_stdcon_r, &dev_ansiserial_w);
+}
+
 int main(int argc __unused, char **argv __unused)
 {
 	const void *adv;
@@ -277,7 +282,7 @@ int main(int argc __unused, char **argv __unused)
 	size_t count = 0;
 	char *config_argv[2] = { NULL, NULL };
 
-	openconsole(&dev_stdcon_r, &dev_ansiserial_w);
+	ldlinux_console_init();
 
 	if (ConfigName[0])
 		config_argv[0] = ConfigName;

-- 
Matt Fleming, Intel Open Source Technology Center




More information about the Syslinux mailing list