Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7372
b: refs/heads/master
c: ffdfc40
h: refs/heads/master
v: v3
  • Loading branch information
Olof Johansson authored and Linus Torvalds committed Sep 7, 2005
1 parent d86bc17 commit 92ae173
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2b579beec255d6589fabe51b60933d723630bcd4
refs/heads/master: ffdfc40976dda18d923cd001d44bf0ee55da1af4
5 changes: 5 additions & 0 deletions trunk/Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,11 @@ running once the system is up.
New name for the ramdisk parameter.
See Documentation/ramdisk.txt.

rdinit= [KNL]
Format: <full_path>
Run specified binary instead of /init from the ramdisk,
used for early userspace startup. See initrd.

reboot= [BUGS=IA-32,BUGS=ARM,BUGS=IA-64] Rebooting mode
Format: <reboot_mode>[,<reboot_mode2>[,...]]
See arch/*/kernel/reboot.c.
Expand Down
31 changes: 27 additions & 4 deletions trunk/init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ extern void softirq_init(void);
char saved_command_line[COMMAND_LINE_SIZE];

static char *execute_command;
static char *ramdisk_execute_command;

/* Setup configured maximum number of CPUs to activate */
static unsigned int max_cpus = NR_CPUS;
Expand Down Expand Up @@ -297,6 +298,18 @@ static int __init init_setup(char *str)
}
__setup("init=", init_setup);

static int __init rdinit_setup(char *str)
{
unsigned int i;

ramdisk_execute_command = str;
/* See "auto" comment in init_setup */
for (i = 1; i < MAX_INIT_ARGS; i++)
argv_init[i] = NULL;
return 1;
}
__setup("rdinit=", rdinit_setup);

extern void setup_arch(char **);

#ifndef CONFIG_SMP
Expand Down Expand Up @@ -681,10 +694,14 @@ static int init(void * unused)
* check if there is an early userspace init. If yes, let it do all
* the work
*/
if (sys_access((const char __user *) "/init", 0) == 0)
execute_command = "/init";
else

if (!ramdisk_execute_command)
ramdisk_execute_command = "/init";

if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
ramdisk_execute_command = NULL;
prepare_namespace();
}

/*
* Ok, we have completed the initial bootup, and
Expand All @@ -701,7 +718,13 @@ static int init(void * unused)

(void) sys_dup(0);
(void) sys_dup(0);


if (ramdisk_execute_command) {
run_init_process(ramdisk_execute_command);
printk(KERN_WARNING "Failed to execute %s\n",
ramdisk_execute_command);
}

/*
* We try each of these until one succeeds.
*
Expand Down

0 comments on commit 92ae173

Please sign in to comment.