Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.14-rc3 /init/main.c

Filename:/init/main.c
Lines Added:33
Lines Deleted:8
Also changed in: (Previous) 2.6.14-rc2  2.6.14-rc1  2.6.13-git12  2.6.13-git11  2.6.13-git10  2.6.13-git9 
(Following) 2.6.14-rc4  2.6.14-rc5  2.6.14  2.6.14-git3  2.6.14-git13  2.6.14-git14 

Location
[  2.6.14-rc3
  [  init
     o  main.c

Patch

diff --git a/init/main.c b/init/main.c
--- a/init/main.c
+++ b/init/main.c
@@ -47,6 +47,7 @@
 #include <linux/rmap.h>
 #include <linux/mempolicy.h>
 #include <linux/key.h>
+#include <net/sock.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -80,7 +81,6 @@
 static int init(void *);
 
 extern void init_IRQ(void);
-extern void sock_init(void);
 extern void fork_init(unsigned long);
 extern void mca_init(void);
 extern void sbus_init(void);
@@ -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;
@@ -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
@@ -614,6 +627,7 @@ static void do_pre_smp_initcalls(void)
    migration_init();
 #endif
    spawn_ksoftirqd();
+   spawn_softlockup_task();
 }
 
 static void run_init_process(char *init_filename)
@@ -680,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
@@ -700,17 +718,24 @@ 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.
     *
     * The Bourne shell can be used instead of init if we are 
     * trying to recover a really broken machine.
     */
-
-   if (execute_command)
+   if (execute_command) {
       run_init_process(execute_command);
-
+      printk(KERN_WARNING "Failed to execute %s.  Attempting "
+               "defaults...\n", execute_command);
+   }
    run_init_process("/sbin/init");
    run_init_process("/etc/init");
    run_init_process("/bin/init");


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.