diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 8 | ||||
-rw-r--r-- | common/startup.c | 13 |
2 files changed, 14 insertions, 7 deletions
diff --git a/common/Kconfig b/common/Kconfig index b60b78bb89..9d26abba99 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -37,9 +37,6 @@ config BLOCK config BLOCK_WRITE bool -config HAVE_NOSHELL - bool - config FILETYPE bool @@ -352,12 +349,11 @@ choice simple shell. No if/then, no return values from commands, no loops config SHELL_NONE - depends on HAVE_NOSHELL bool "no shell (noninteractive build)" help No shell at all. This means no shell is started and your board has - to provide a run_shell() function which is started at the end of - the barebox startup process. + to overwrite the barebox_main function pointer which is then called + at the end of the barebox startup process. endchoice config GLOB diff --git a/common/startup.c b/common/startup.c index 14409a217d..6309f53e9e 100644 --- a/common/startup.c +++ b/common/startup.c @@ -88,6 +88,8 @@ static int mount_root(void) fs_initcall(mount_root); #endif +int (*barebox_main)(void); + void start_barebox (void) { initcall_t *initcall; @@ -96,6 +98,9 @@ void start_barebox (void) struct stat s; #endif + if (!IS_ENABLED(CONFIG_SHELL_NONE)) + barebox_main = run_shell; + for (initcall = __barebox_initcalls_start; initcall < __barebox_initcalls_end; initcall++) { debug("initcall-> %pS\n", *initcall); @@ -126,9 +131,15 @@ void start_barebox (void) printf("not found\n"); } #endif + + if (!barebox_main) { + printf("No main function! aborting.\n"); + hang(); + } + /* main_loop() can return to retry autoboot, if so just run it again. */ for (;;) - run_shell(); + barebox_main(); /* NOTREACHED - no way out of command loop except booting */ } |