patch-2.1.121 linux/init/main.c

Next file: linux/kernel/panic.c
Previous file: linux/include/linux/umsdos_fs.p
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.120/linux/init/main.c linux/init/main.c
@@ -17,7 +17,6 @@
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/tty.h>
-#include <linux/head.h>
 #include <linux/unistd.h>
 #include <linux/string.h>
 #include <linux/timer.h>
@@ -84,6 +83,11 @@
 extern void filescache_init(void);
 extern void signals_init(void);
 
+extern void device_setup(void);
+extern void binfmt_setup(void);
+extern void free_initmem(void);
+extern void filesystem_setup(void);
+
 #ifdef CONFIG_ARCH_ACORN
 extern void ecard_init(void);
 #endif
@@ -1109,6 +1113,14 @@
 
 	smp_init();
 
+	/*
+	 * Ok, the machine is now initialized. None of the devices
+	 * have been touched yet, but the CPU subsystem is up and
+	 * running, and memory management works.
+	 *
+	 * Now we can finally start doing some real work..
+	 */
+
 #if defined(CONFIG_MTRR)	/* Do this after SMP initialization */
 /*
  * We should probably create some architecture-dependent "fixup after
@@ -1182,7 +1194,7 @@
 }
 #endif
 
-static int init(void * unused)
+static void __init do_basic_setup(void)
 {
 #ifdef CONFIG_BLK_DEV_INITRD
 	int real_root_mountflags;
@@ -1211,7 +1223,18 @@
 	if (initrd_start && mount_initrd) root_mountflags &= ~MS_RDONLY;
 	else mount_initrd =0;
 #endif
-	setup(0);
+
+	/* Set up devices .. */
+	device_setup();
+
+	/* .. executable formats .. */
+	binfmt_setup();
+
+	/* .. filesystems .. */
+	filesystem_setup();
+
+	/* Mount the root filesystem.. */
+	mount_root();
 
 #ifdef CONFIG_UMSDOS_FS
 	{
@@ -1247,9 +1270,19 @@
 		}
 	}
 #endif
+}
+
+static int init(void * unused)
+{
+	do_basic_setup();
+
+	/*
+	 * Ok, we have completed the initial bootup, and
+	 * we're essentially up and running. Get rid of the
+	 * initmem segments and start the user-mode stuff..
+	 */
+	free_initmem();
 
-	setup(1);
-	
 	if (open("/dev/console", O_RDWR, 0) < 0)
 		printk("Warning: unable to open an initial console.\n");
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov