diff options
Diffstat (limited to 'common/startup.c')
-rw-r--r-- | common/startup.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/common/startup.c b/common/startup.c index ea7ce6b8da..adc487363f 100644 --- a/common/startup.c +++ b/common/startup.c @@ -38,6 +38,7 @@ #include <linux/stat.h> #include <envfs.h> #include <magicvar.h> +#include <linux/reboot-mode.h> #include <asm/sections.h> #include <uncompress.h> #include <globalvar.h> @@ -310,6 +311,7 @@ static int run_init(void) DIR *dir; struct dirent *d; const char *initdir = "/env/init"; + const char *bmode; bool env_bin_init_exists; enum autoboot_state autoboot; struct stat s; @@ -350,6 +352,20 @@ static int run_init(void) closedir(dir); } + /* source matching script in /env/bmode/ */ + bmode = reboot_mode_get(); + if (bmode) { + char *scr, *path; + + scr = xasprintf("source /env/bmode/%s", bmode); + path = &scr[strlen("source ")]; + if (stat(path, &s) == 0) { + pr_info("Invoking '%s'...\n", path); + run_command(scr); + } + free(scr); + } + autoboot = do_autoboot_countdown(); console_ctrlc_allow(); @@ -436,14 +452,13 @@ void shutdown_barebox(void) pr_debug("exitcall-> %pS\n", *exitcall); (*exitcall)(); } + + console_flush(); } -BAREBOX_MAGICVAR_NAMED(autoboot_state, - global.autoboot, - "Autoboot state. Possible values: countdown (default), abort, menu, boot"); -BAREBOX_MAGICVAR_NAMED(global_autoboot_abort_key, - global.autoboot_abort_key, - "Which key allows to interrupt autoboot. Possible values: any, ctrl-c"); -BAREBOX_MAGICVAR_NAMED(global_autoboot_timeout, - global.autoboot_timeout, - "Timeout before autoboot starts in seconds"); +BAREBOX_MAGICVAR(global.autoboot, + "Autoboot state. Possible values: countdown (default), abort, menu, boot"); +BAREBOX_MAGICVAR(global.autoboot_abort_key, + "Which key allows to interrupt autoboot. Possible values: any, ctrl-c"); +BAREBOX_MAGICVAR(global.autoboot_timeout, + "Timeout before autoboot starts in seconds"); |