aboutsummaryrefslogtreecommitdiffstats
path: root/init/main.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2005-09-06 18:17:19 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 19:57:28 -0400
commitffdfc40976dda18d923cd001d44bf0ee55da1af4 (patch)
tree2503b81230c5b3ad0ff3926e1388267338fe24b8 /init/main.c
parent2b579beec255d6589fabe51b60933d723630bcd4 (diff)
[PATCH] Add rdinit parameter to pick early userspace init
Since early userspace was added, there's no way to override which init to run from it. Some people tack on an extra cpio archive with a link from /init depending on what they want to run, but that's sometimes impractical. Changing the "init=" to also override the early userspace isn't feasible, since it is still used to indicate what init to run from disk when early userspace has completed doing whatever it's doing (i.e. load filesystem modules and drivers). Instead, introduce "rdinit=" and make it override the default "/init" if specified. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c31
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);
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
@@ -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 *