diff --git a/src/arch/x64/mach-sandbox/startup.c b/src/arch/x64/mach-sandbox/startup.c index 9b7e8741e0..2650508dc9 100644 --- a/src/arch/x64/mach-sandbox/startup.c +++ b/src/arch/x64/mach-sandbox/startup.c @@ -3,12 +3,28 @@ extern int xboot_main(int argc, char * argv[]); -const char * auto_boot_command(void) +void do_autoboot(void) { struct sandbox_t * sandbox = sandbox_get(); + int delay = CONFIG_AUTO_BOOT_DELAY * 1000; + + do { + if(getchar() != EOF) + { + printf("\r\n"); + return; + } + mdelay(10); + delay -= 10; + if(delay < 0) + delay = 0; + printf("\rPress any key to stop autoboot:%3d.%03d%s", delay / 1000, delay % 1000, (delay == 0) ? "\r\n" : ""); + } while(delay > 0); + if(sandbox && sandbox->app) - return sandbox->app; - return CONFIG_AUTO_BOOT_COMMAND; + system(sandbox->app); + else + system(CONFIG_AUTO_BOOT_COMMAND); } int main(int argc, char * argv[]) diff --git a/src/include/init.h b/src/include/init.h index d2f7fae9f6..3c70941190 100644 --- a/src/include/init.h +++ b/src/include/init.h @@ -7,8 +7,8 @@ extern "C" { #include -void do_show_logo(void); -void do_auto_boot(void); +void do_showlogo(void); +void do_autoboot(void); #ifdef __cplusplus } diff --git a/src/init/init.c b/src/init/init.c index 84b6299887..021d0c0ae7 100644 --- a/src/init/init.c +++ b/src/init/init.c @@ -29,7 +29,7 @@ #include #include -void do_show_logo(void) +void do_showlogo(void) { struct device_t * pos, * n; cairo_surface_t * logo; @@ -68,13 +68,7 @@ void do_show_logo(void) cairo_surface_destroy(logo); } -static const char * __auto_boot_command(void) -{ - return CONFIG_AUTO_BOOT_COMMAND; -} -extern __typeof(__auto_boot_command) auto_boot_command __attribute__((weak, alias("__auto_boot_command"))); - -void do_auto_boot(void) +static void __do_autoboot(void) { int delay = CONFIG_AUTO_BOOT_DELAY * 1000; @@ -84,7 +78,6 @@ void do_auto_boot(void) printf("\r\n"); return; } - mdelay(10); delay -= 10; if(delay < 0) @@ -92,5 +85,6 @@ void do_auto_boot(void) printf("\rPress any key to stop autoboot:%3d.%03d%s", delay / 1000, delay % 1000, (delay == 0) ? "\r\n" : ""); } while(delay > 0); - system(auto_boot_command()); + system(CONFIG_AUTO_BOOT_COMMAND); } +extern __typeof(__do_autoboot) do_autoboot __attribute__((weak, alias("__do_autoboot"))); diff --git a/src/init/main.c b/src/init/main.c index 325da65fcb..a16cce2c42 100644 --- a/src/init/main.c +++ b/src/init/main.c @@ -50,10 +50,10 @@ int xboot_main(int argc, char * argv[]) do_initcalls(); /* Do show logo */ - do_show_logo(); + do_showlogo(); - /* Do run auto boot command */ - do_auto_boot(); + /* Do auto boot */ + do_autoboot(); /* Run loop */ while(1)