diff options
Diffstat (limited to 'init')
-rw-r--r-- | init/main.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/init/main.c b/init/main.c index e4dbcbcd26cf..f142d4035341 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -123,6 +123,7 @@ extern void softirq_init(void); | |||
123 | char saved_command_line[COMMAND_LINE_SIZE]; | 123 | char saved_command_line[COMMAND_LINE_SIZE]; |
124 | 124 | ||
125 | static char *execute_command; | 125 | static char *execute_command; |
126 | static char *ramdisk_execute_command; | ||
126 | 127 | ||
127 | /* Setup configured maximum number of CPUs to activate */ | 128 | /* Setup configured maximum number of CPUs to activate */ |
128 | static unsigned int max_cpus = NR_CPUS; | 129 | static unsigned int max_cpus = NR_CPUS; |
@@ -297,6 +298,18 @@ static int __init init_setup(char *str) | |||
297 | } | 298 | } |
298 | __setup("init=", init_setup); | 299 | __setup("init=", init_setup); |
299 | 300 | ||
301 | static int __init rdinit_setup(char *str) | ||
302 | { | ||
303 | unsigned int i; | ||
304 | |||
305 | ramdisk_execute_command = str; | ||
306 | /* See "auto" comment in init_setup */ | ||
307 | for (i = 1; i < MAX_INIT_ARGS; i++) | ||
308 | argv_init[i] = NULL; | ||
309 | return 1; | ||
310 | } | ||
311 | __setup("rdinit=", rdinit_setup); | ||
312 | |||
300 | extern void setup_arch(char **); | 313 | extern void setup_arch(char **); |
301 | 314 | ||
302 | #ifndef CONFIG_SMP | 315 | #ifndef CONFIG_SMP |
@@ -681,10 +694,14 @@ static int init(void * unused) | |||
681 | * check if there is an early userspace init. If yes, let it do all | 694 | * check if there is an early userspace init. If yes, let it do all |
682 | * the work | 695 | * the work |
683 | */ | 696 | */ |
684 | if (sys_access((const char __user *) "/init", 0) == 0) | 697 | |
685 | execute_command = "/init"; | 698 | if (!ramdisk_execute_command) |
686 | else | 699 | ramdisk_execute_command = "/init"; |
700 | |||
701 | if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { | ||
702 | ramdisk_execute_command = NULL; | ||
687 | prepare_namespace(); | 703 | prepare_namespace(); |
704 | } | ||
688 | 705 | ||
689 | /* | 706 | /* |
690 | * Ok, we have completed the initial bootup, and | 707 | * Ok, we have completed the initial bootup, and |
@@ -701,7 +718,13 @@ static int init(void * unused) | |||
701 | 718 | ||
702 | (void) sys_dup(0); | 719 | (void) sys_dup(0); |
703 | (void) sys_dup(0); | 720 | (void) sys_dup(0); |
704 | 721 | ||
722 | if (ramdisk_execute_command) { | ||
723 | run_init_process(ramdisk_execute_command); | ||
724 | printk(KERN_WARNING "Failed to execute %s\n", | ||
725 | ramdisk_execute_command); | ||
726 | } | ||
727 | |||
705 | /* | 728 | /* |
706 | * We try each of these until one succeeds. | 729 | * We try each of these until one succeeds. |
707 | * | 730 | * |