aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/main.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/init/main.c b/init/main.c
index ff410063e4e1..f142d4035341 100644
--- a/init/main.c
+++ b/init/main.c
@@ -123,6 +123,7 @@ extern void softirq_init(void);
123char saved_command_line[COMMAND_LINE_SIZE]; 123char saved_command_line[COMMAND_LINE_SIZE];
124 124
125static char *execute_command; 125static char *execute_command;
126static char *ramdisk_execute_command;
126 127
127/* Setup configured maximum number of CPUs to activate */ 128/* Setup configured maximum number of CPUs to activate */
128static unsigned int max_cpus = NR_CPUS; 129static 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
301static 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
300extern void setup_arch(char **); 313extern void setup_arch(char **);
301 314
302#ifndef CONFIG_SMP 315#ifndef CONFIG_SMP
@@ -614,6 +627,7 @@ static void do_pre_smp_initcalls(void)
614 migration_init(); 627 migration_init();
615#endif 628#endif
616 spawn_ksoftirqd(); 629 spawn_ksoftirqd();
630 spawn_softlockup_task();
617} 631}
618 632
619static void run_init_process(char *init_filename) 633static void run_init_process(char *init_filename)
@@ -680,10 +694,14 @@ static int init(void * unused)
680 * 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
681 * the work 695 * the work
682 */ 696 */
683 if (sys_access((const char __user *) "/init", 0) == 0) 697
684 execute_command = "/init"; 698 if (!ramdisk_execute_command)
685 else 699 ramdisk_execute_command = "/init";
700
701 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
702 ramdisk_execute_command = NULL;
686 prepare_namespace(); 703 prepare_namespace();
704 }
687 705
688 /* 706 /*
689 * Ok, we have completed the initial bootup, and 707 * Ok, we have completed the initial bootup, and
@@ -700,17 +718,24 @@ static int init(void * unused)
700 718
701 (void) sys_dup(0); 719 (void) sys_dup(0);
702 (void) sys_dup(0); 720 (void) sys_dup(0);
703 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
704 /* 728 /*
705 * We try each of these until one succeeds. 729 * We try each of these until one succeeds.
706 * 730 *
707 * The Bourne shell can be used instead of init if we are 731 * The Bourne shell can be used instead of init if we are
708 * trying to recover a really broken machine. 732 * trying to recover a really broken machine.
709 */ 733 */
710 734 if (execute_command) {
711 if (execute_command)
712 run_init_process(execute_command); 735 run_init_process(execute_command);
713 736 printk(KERN_WARNING "Failed to execute %s. Attempting "
737 "defaults...\n", execute_command);
738 }
714 run_init_process("/sbin/init"); 739 run_init_process("/sbin/init");
715 run_init_process("/etc/init"); 740 run_init_process("/etc/init");
716 run_init_process("/bin/init"); 741 run_init_process("/bin/init");