aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--com32/elflink/ldlinux/config.h1
-rw-r--r--com32/elflink/ldlinux/execute.c10
-rw-r--r--com32/elflink/ldlinux/ldlinux.c7
3 files changed, 17 insertions, 1 deletions
diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h
index 9b7ce4a4..c551fb19 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 e06192e6..10399230 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 4a092838..82d2ae6d 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;