diff options
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 86 |
1 files changed, 47 insertions, 39 deletions
diff --git a/init/main.c b/init/main.c index 4e9e92bb2b89..2421e1544127 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -86,7 +86,6 @@ extern void init_IRQ(void); | |||
86 | extern void fork_init(unsigned long); | 86 | extern void fork_init(unsigned long); |
87 | extern void mca_init(void); | 87 | extern void mca_init(void); |
88 | extern void sbus_init(void); | 88 | extern void sbus_init(void); |
89 | extern void sysctl_init(void); | ||
90 | extern void signals_init(void); | 89 | extern void signals_init(void); |
91 | extern void pidhash_init(void); | 90 | extern void pidhash_init(void); |
92 | extern void pidmap_init(void); | 91 | extern void pidmap_init(void); |
@@ -702,8 +701,8 @@ static void __init do_basic_setup(void) | |||
702 | usermodehelper_init(); | 701 | usermodehelper_init(); |
703 | driver_init(); | 702 | driver_init(); |
704 | 703 | ||
705 | #ifdef CONFIG_SYSCTL | 704 | #ifdef CONFIG_PROC_FS |
706 | sysctl_init(); | 705 | init_irq_proc(); |
707 | #endif | 706 | #endif |
708 | 707 | ||
709 | do_initcalls(); | 708 | do_initcalls(); |
@@ -727,7 +726,49 @@ static void run_init_process(char *init_filename) | |||
727 | kernel_execve(init_filename, argv_init, envp_init); | 726 | kernel_execve(init_filename, argv_init, envp_init); |
728 | } | 727 | } |
729 | 728 | ||
730 | static int init(void * unused) | 729 | /* This is a non __init function. Force it to be noinline otherwise gcc |
730 | * makes it inline to init() and it becomes part of init.text section | ||
731 | */ | ||
732 | static int noinline init_post(void) | ||
733 | { | ||
734 | free_initmem(); | ||
735 | unlock_kernel(); | ||
736 | mark_rodata_ro(); | ||
737 | system_state = SYSTEM_RUNNING; | ||
738 | numa_default_policy(); | ||
739 | |||
740 | if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) | ||
741 | printk(KERN_WARNING "Warning: unable to open an initial console.\n"); | ||
742 | |||
743 | (void) sys_dup(0); | ||
744 | (void) sys_dup(0); | ||
745 | |||
746 | if (ramdisk_execute_command) { | ||
747 | run_init_process(ramdisk_execute_command); | ||
748 | printk(KERN_WARNING "Failed to execute %s\n", | ||
749 | ramdisk_execute_command); | ||
750 | } | ||
751 | |||
752 | /* | ||
753 | * We try each of these until one succeeds. | ||
754 | * | ||
755 | * The Bourne shell can be used instead of init if we are | ||
756 | * trying to recover a really broken machine. | ||
757 | */ | ||
758 | if (execute_command) { | ||
759 | run_init_process(execute_command); | ||
760 | printk(KERN_WARNING "Failed to execute %s. Attempting " | ||
761 | "defaults...\n", execute_command); | ||
762 | } | ||
763 | run_init_process("/sbin/init"); | ||
764 | run_init_process("/etc/init"); | ||
765 | run_init_process("/bin/init"); | ||
766 | run_init_process("/bin/sh"); | ||
767 | |||
768 | panic("No init found. Try passing init= option to kernel."); | ||
769 | } | ||
770 | |||
771 | static int __init init(void * unused) | ||
731 | { | 772 | { |
732 | lock_kernel(); | 773 | lock_kernel(); |
733 | /* | 774 | /* |
@@ -775,39 +816,6 @@ static int init(void * unused) | |||
775 | * we're essentially up and running. Get rid of the | 816 | * we're essentially up and running. Get rid of the |
776 | * initmem segments and start the user-mode stuff.. | 817 | * initmem segments and start the user-mode stuff.. |
777 | */ | 818 | */ |
778 | free_initmem(); | 819 | init_post(); |
779 | unlock_kernel(); | 820 | 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 | } | 821 | } |