sandbox: Don't try distro_bootcmd by default
For the distro_bootcmds to succeed on the sandbox a bit of setup is
required (e.g. network configured or host image bound), so running them
by default isn't that useful.
Add a -b/--boot command to the sandbox binary, which triggers the
distro_bootcmds to run after the other command-line commands.
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Acked-by: Simon Glass <sjg@chromium.org>
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index ec01040..b23d08b 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -77,18 +77,32 @@
struct sandbox_state *state = state_get_current();
/* Execute command if required */
- if (state->cmd) {
- int retval;
+ if (state->cmd || state->run_distro_boot) {
+ int retval = 0;
cli_init();
- retval = run_command_list(state->cmd, -1, 0);
+ if (state->cmd)
+ retval = run_command_list(state->cmd, -1, 0);
+
+ if (state->run_distro_boot)
+ retval = cli_simple_run_command("run distro_bootcmd",
+ 0);
+
if (!state->interactive)
os_exit(retval);
}
+ return 0;
+}
+
+static int sandbox_cmdline_cb_boot(struct sandbox_state *state,
+ const char *arg)
+{
+ state->run_distro_boot = true;
return 0;
}
+SANDBOX_CMDLINE_OPT_SHORT(boot, 'b', 0, "Run distro boot commands");
static int sandbox_cmdline_cb_command(struct sandbox_state *state,
const char *arg)