diff options
Diffstat (limited to 'init')
-rw-r--r-- | init/Kconfig | 10 | ||||
-rw-r--r-- | init/main.c | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/init/Kconfig b/init/Kconfig index fdb4f52609c6..2d12d38cdd88 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -260,6 +260,16 @@ config KERNEL_UNCOMPRESSED endchoice +config DEFAULT_INIT + string "Default init path" + default "" + help + This option determines the default init for the system if no init= + option is passed on the kernel command line. If the requested path is + not present, we will still then move on to attempting further + locations (e.g. /sbin/init, etc). If this is empty, we will just use + the fallback list when init= is not passed. + config DEFAULT_HOSTNAME string "Default hostname" default "(none)" diff --git a/init/main.c b/init/main.c index df32f67214d2..76df62fc3e2c 100644 --- a/init/main.c +++ b/init/main.c @@ -1433,6 +1433,16 @@ static int __ref kernel_init(void *unused) panic("Requested init %s failed (error %d).", execute_command, ret); } + + if (CONFIG_DEFAULT_INIT[0] != '\0') { + ret = run_init_process(CONFIG_DEFAULT_INIT); + if (ret) + pr_err("Default init %s failed (error %d)\n", + CONFIG_DEFAULT_INIT, ret); + else + return 0; + } + if (!try_to_run_init_process("/sbin/init") || !try_to_run_init_process("/etc/init") || !try_to_run_init_process("/bin/init") || |