diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-10-31 12:42:25 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2012-11-02 11:55:41 +0000 |
commit | 06f042df3c483c442f1150b862ef043711288f5e (patch) | |
tree | 2e915d14ebff8f94bbc4218599c7fecd5617ddf1 | |
parent | a06aa6db6177f412718d1d121b5cf83616c281e9 (diff) | |
download | syslinux-06f042df3c483c442f1150b862ef043711288f5e.tar.gz |
ldlinux: Fix logic if no DEFAULT or UI directive is found
Somewhere along the way the code that prints,
No DEFAULT or UI configuration directive found!
was broken, and now no longer prints at all. While we're fixing this
it's a good opportunity to rework the logic to be clearer. Now we only
print the message if a config file was found, since these directives
are obviously missing if there is no config file (a warning will be
printed about the lack of config file anyway).
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r-- | com32/elflink/ldlinux/config.h | 2 | ||||
-rw-r--r-- | com32/elflink/ldlinux/execute.c | 2 | ||||
-rw-r--r-- | com32/elflink/ldlinux/ldlinux.c | 56 |
3 files changed, 30 insertions, 30 deletions
diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h index ea4736e6..63e33b69 100644 --- a/com32/elflink/ldlinux/config.h +++ b/com32/elflink/ldlinux/config.h @@ -47,6 +47,6 @@ extern int new_linux_kernel(char *okernel, char *ocmdline); extern void pm_load_high(com32sys_t *regs); -extern void ldlinux_enter_command(bool prompt); +extern void ldlinux_enter_command(void); #endif /* __CONFIG_H__ */ diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c index e7969c2e..6ccde49d 100644 --- a/com32/elflink/ldlinux/execute.c +++ b/com32/elflink/ldlinux/execute.c @@ -102,7 +102,7 @@ void execute(const char *cmdline, uint32_t type) * e.g. from vesamenu.c32. */ unload_modules_since("ldlinux.c32"); - ldlinux_enter_command(!noescape); + 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 d9635956..59c55980 100644 --- a/com32/elflink/ldlinux/ldlinux.c +++ b/com32/elflink/ldlinux/ldlinux.c @@ -216,41 +216,36 @@ static void enter_cmdline(void) printf("\n"); /* return if user only press enter or we timed out */ - if (!cmdline || cmdline[0] == '\0') + if (!cmdline || cmdline[0] == '\0') { + if (ontimeoutlen) + load_kernel(ontimeout); return; + } load_kernel(cmdline); } } -void ldlinux_enter_command(bool prompt) +/* + * If this function returns you must call ldinux_enter_command() to + * preserve the 4.0x behaviour. + */ +void ldlinux_auto_boot(void) { - const char *cmdline = default_cmd; - - if (prompt) - goto cmdline; -auto_boot: - /* - * Auto boot - */ - if (defaultlevel || noescape) { - if (defaultlevel) { - load_kernel(cmdline); /* Shouldn't return */ - } else { + if (!defaultlevel) { + if (strlen(ConfigName)) printf("No DEFAULT or UI configuration directive found!\n"); + if (noescape) + kaboom(); + } else + load_kernel(default_cmd); +} - if (noescape) - kaboom(); - } - } - -cmdline: - /* Only returns if the user pressed enter or input timed out */ +void ldlinux_enter_command(void) +{ + if (noescape) + ldlinux_auto_boot(); enter_cmdline(); - - cmdline = ontimeoutlen ? ontimeout : default_cmd; - - goto auto_boot; } /* @@ -291,7 +286,7 @@ int main(int argc __unused, char **argv __unused) cmdline = dst = malloc(count + 1); if (!dst) { printf("Failed to allocate memory for ADV\n"); - ldlinux_enter_command(true); + ldlinux_enter_command(); } for (i = 0; i < count; i++) @@ -303,11 +298,16 @@ int main(int argc __unused, char **argv __unused) syslinux_adv_write(); load_kernel(cmdline); /* Shouldn't return */ - ldlinux_enter_command(true); + ldlinux_enter_command(); } /* TODO: Check KbdFlags? */ + if (!forceprompt) + ldlinux_auto_boot(); + + if (defaultlevel > 1) + ldlinux_auto_boot(); - ldlinux_enter_command(forceprompt); + ldlinux_enter_command(); return 0; } |