diff options
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 88 |
1 files changed, 49 insertions, 39 deletions
diff --git a/init/main.c b/init/main.c index 4e9e92bb2b89..953500b02ac4 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/cpu.h> | 40 | #include <linux/cpu.h> |
41 | #include <linux/cpuset.h> | 41 | #include <linux/cpuset.h> |
42 | #include <linux/efi.h> | 42 | #include <linux/efi.h> |
43 | #include <linux/tick.h> | ||
43 | #include <linux/taskstats_kern.h> | 44 | #include <linux/taskstats_kern.h> |
44 | #include <linux/delayacct.h> | 45 | #include <linux/delayacct.h> |
45 | #include <linux/unistd.h> | 46 | #include <linux/unistd.h> |
@@ -86,7 +87,6 @@ extern void init_IRQ(void); | |||
86 | extern void fork_init(unsigned long); | 87 | extern void fork_init(unsigned long); |
87 | extern void mca_init(void); | 88 | extern void mca_init(void); |
88 | extern void sbus_init(void); | 89 | extern void sbus_init(void); |
89 | extern void sysctl_init(void); | ||
90 | extern void signals_init(void); | 90 | extern void signals_init(void); |
91 | extern void pidhash_init(void); | 91 | extern void pidhash_init(void); |
92 | extern void pidmap_init(void); | 92 | extern void pidmap_init(void); |
@@ -516,6 +516,7 @@ asmlinkage void __init start_kernel(void) | |||
516 | * enable them | 516 | * enable them |
517 | */ | 517 | */ |
518 | lock_kernel(); | 518 | lock_kernel(); |
519 | tick_init(); | ||
519 | boot_cpu_init(); | 520 | boot_cpu_init(); |
520 | page_address_init(); | 521 | page_address_init(); |
521 | printk(KERN_NOTICE); | 522 | printk(KERN_NOTICE); |
@@ -702,8 +703,8 @@ static void __init do_basic_setup(void) | |||
702 | usermodehelper_init(); | 703 | usermodehelper_init(); |
703 | driver_init(); | 704 | driver_init(); |
704 | 705 | ||
705 | #ifdef CONFIG_SYSCTL | 706 | #ifdef CONFIG_PROC_FS |
706 | sysctl_init(); | 707 | init_irq_proc(); |
707 | #endif | 708 | #endif |
708 | 709 | ||
709 | do_initcalls(); | 710 | do_initcalls(); |
@@ -727,7 +728,49 @@ static void run_init_process(char *init_filename) | |||
727 | kernel_execve(init_filename, argv_init, envp_init); | 728 | kernel_execve(init_filename, argv_init, envp_init); |
728 | } | 729 | } |
729 | 730 | ||
730 | static int init(void * unused) | 731 | /* This is a non __init function. Force it to be noinline otherwise gcc |
732 | * makes it inline to init() and it becomes part of init.text section | ||
733 | */ | ||
734 | static int noinline init_post(void) | ||
735 | { | ||
736 | free_initmem(); | ||
737 | unlock_kernel(); | ||
738 | mark_rodata_ro(); | ||
739 | system_state = SYSTEM_RUNNING; | ||
740 | numa_default_policy(); | ||
741 | |||
742 | if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) | ||
743 | printk(KERN_WARNING "Warning: unable to open an initial console.\n"); | ||
744 | |||
745 | (void) sys_dup(0); | ||
746 | (void) sys_dup(0); | ||
747 | |||
748 | if (ramdisk_execute_command) { | ||
749 | run_init_process(ramdisk_execute_command); | ||
750 | printk(KERN_WARNING "Failed to execute %s\n", | ||
751 | ramdisk_execute_command); | ||
752 | } | ||
753 | |||
754 | /* | ||
755 | * We try each of these until one succeeds. | ||
756 | * | ||
757 | * The Bourne shell can be used instead of init if we are | ||
758 | * trying to recover a really broken machine. | ||
759 | */ | ||
760 | if (execute_command) { | ||
761 | run_init_process(execute_command); | ||
762 | printk(KERN_WARNING "Failed to execute %s. Attempting " | ||
763 | "defaults...\n", execute_command); | ||
764 | } | ||
765 | run_init_process("/sbin/init"); | ||
766 | run_init_process("/etc/init"); | ||
767 | run_init_process("/bin/init"); | ||
768 | run_init_process("/bin/sh"); | ||
769 | |||
770 | panic("No init found. Try passing init= option to kernel."); | ||
771 | } | ||
772 | |||
773 | static int __init init(void * unused) | ||
731 | { | 774 | { |
732 | lock_kernel(); | 775 | lock_kernel(); |
733 | /* | 776 | /* |
@@ -775,39 +818,6 @@ static int init(void * unused) | |||
775 | * we're essentially up and running. Get rid of the | 818 | * we're essentially up and running. Get rid of the |
776 | * initmem segments and start the user-mode stuff.. | 819 | * initmem segments and start the user-mode stuff.. |
777 | */ | 820 | */ |
778 | free_initmem(); | 821 | init_post(); |
779 | unlock_kernel(); | 822 | return 0; |
780 | mark_rodata_ro(); | ||
781 | system_state = SYSTEM_RUNNING; | ||
782 | numa_default_policy(); | ||
783 | |||
784 | if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) | ||
785 | printk(KERN_WARNING "Warning: unable to open an initial console.\n"); | ||
786 | |||
787 | (void) sys_dup(0); | ||
788 | (void) sys_dup(0); | ||
789 | |||
790 | if (ramdisk_execute_command) { | ||
791 | run_init_process(ramdisk_execute_command); | ||
792 | printk(KERN_WARNING "Failed to execute %s\n", | ||
793 | ramdisk_execute_command); | ||
794 | } | ||
795 | |||
796 | /* | ||
797 | * We try each of these until one succeeds. | ||
798 | * | ||
799 | * The Bourne shell can be used instead of init if we are | ||
800 | * trying to recover a really broken machine. | ||
801 | */ | ||
802 | if (execute_command) { | ||
803 | run_init_process(execute_command); | ||
804 | printk(KERN_WARNING "Failed to execute %s. Attempting " | ||
805 | "defaults...\n", execute_command); | ||
806 | } | ||
807 | run_init_process("/sbin/init"); | ||
808 | run_init_process("/etc/init"); | ||
809 | run_init_process("/bin/init"); | ||
810 | run_init_process("/bin/sh"); | ||
811 | |||
812 | panic("No init found. Try passing init= option to kernel."); | ||
813 | } | 823 | } |