[PATCH] sysctl: reimplement the sysctl proc support
[pandora-kernel.git] / init / main.c
index e3f0bb2..649ab54 100644 (file)
@@ -50,9 +50,8 @@
 #include <linux/buffer_head.h>
 #include <linux/debug_locks.h>
 #include <linux/lockdep.h>
-#include <linux/utsrelease.h>
 #include <linux/pid_namespace.h>
-#include <linux/compile.h>
+#include <linux/device.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -87,14 +86,12 @@ extern void init_IRQ(void);
 extern void fork_init(unsigned long);
 extern void mca_init(void);
 extern void sbus_init(void);
-extern void sysctl_init(void);
 extern void signals_init(void);
 extern void pidhash_init(void);
 extern void pidmap_init(void);
 extern void prio_tree_init(void);
 extern void radix_tree_init(void);
 extern void free_initmem(void);
-extern void driver_init(void);
 extern void prepare_namespace(void);
 #ifdef CONFIG_ACPI
 extern void acpi_early_init(void);
@@ -123,8 +120,12 @@ extern void time_init(void);
 void (*late_time_init)(void);
 extern void softirq_init(void);
 
-/* Untouched command line (eg. for /proc) saved by arch-specific code. */
-char saved_command_line[COMMAND_LINE_SIZE];
+/* Untouched command line saved by arch-specific code. */
+char __initdata boot_command_line[COMMAND_LINE_SIZE];
+/* Untouched saved command line (eg. for /proc) */
+char *saved_command_line;
+/* Command line for parameter parsing */
+static char *static_command_line;
 
 static char *execute_command;
 static char *ramdisk_execute_command;
@@ -397,15 +398,24 @@ static void __init smp_init(void)
        /* Any cleanup work */
        printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus());
        smp_cpus_done(max_cpus);
-#if 0
-       /* Get other processors into their bootup holding patterns. */
-
-       smp_commence();
-#endif
 }
 
 #endif
 
+/*
+ * We need to store the untouched command line for future reference.
+ * We also need to store the touched command line since the parameter
+ * parsing is performed in place, and we should allow a component to
+ * store reference of name/value for future reference.
+ */
+static void __init setup_command_line(char *command_line)
+{
+       saved_command_line = alloc_bootmem(strlen (boot_command_line)+1);
+       static_command_line = alloc_bootmem(strlen (command_line)+1);
+       strcpy (saved_command_line, boot_command_line);
+       strcpy (static_command_line, command_line);
+}
+
 /*
  * We need to finalize in a non-__init function or else race conditions
  * between the root thread and the init thread may cause start_kernel to
@@ -460,7 +470,7 @@ void __init parse_early_param(void)
                return;
 
        /* All fall through to do_early_param. */
-       strlcpy(tmp_cmdline, saved_command_line, COMMAND_LINE_SIZE);
+       strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
        parse_args("early options", tmp_cmdline, NULL, 0, do_early_param);
        done = 1;
 }
@@ -482,12 +492,6 @@ void __init __attribute__((weak)) smp_setup_processor_id(void)
 {
 }
 
-static const char linux_banner[] =
-       "Linux version " UTS_RELEASE
-       " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
-       " (" LINUX_COMPILER ")"
-       " " UTS_VERSION "\n";
-
 asmlinkage void __init start_kernel(void)
 {
        char * command_line;
@@ -516,6 +520,7 @@ asmlinkage void __init start_kernel(void)
        printk(KERN_NOTICE);
        printk(linux_banner);
        setup_arch(&command_line);
+       setup_command_line(command_line);
        unwind_setup();
        setup_per_cpu_areas();
        smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
@@ -533,11 +538,16 @@ asmlinkage void __init start_kernel(void)
        preempt_disable();
        build_all_zonelists();
        page_alloc_init();
-       printk(KERN_NOTICE "Kernel command line: %s\n", saved_command_line);
+       printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
        parse_early_param();
-       parse_args("Booting kernel", command_line, __start___param,
+       parse_args("Booting kernel", static_command_line, __start___param,
                   __stop___param - __start___param,
                   &unknown_bootoption);
+       if (!irqs_disabled()) {
+               printk(KERN_WARNING "start_kernel(): bug: interrupts were "
+                               "enabled *very* early, fixing it\n");
+               local_irq_disable();
+       }
        sort_main_extable();
        trap_init();
        rcu_init();
@@ -691,14 +701,14 @@ static void __init do_basic_setup(void)
        usermodehelper_init();
        driver_init();
 
-#ifdef CONFIG_SYSCTL
-       sysctl_init();
+#ifdef CONFIG_PROC_FS
+       init_irq_proc();
 #endif
 
        do_initcalls();
 }
 
-static void do_pre_smp_initcalls(void)
+static void __init do_pre_smp_initcalls(void)
 {
        extern int spawn_ksoftirqd(void);
 #ifdef CONFIG_SMP