aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-14 12:46:06 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-14 12:46:06 -0500
commit414f827c46973ba39320cfb43feb55a0eeb9b4e8 (patch)
tree45e860974ef698e71370a0ebdddcff4f14fbdf9e /init
parent86a71dbd3e81e8870d0f0e56b87875f57e58222b (diff)
parent126b1922367fbe5513daa675a2abd13ed3917f4e (diff)
Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6
* 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6: (94 commits) [PATCH] x86-64: Remove mk_pte_phys() [PATCH] i386: Fix broken CONFIG_COMPAT_VDSO on i386 [PATCH] i386: fix 32-bit ioctls on x64_32 [PATCH] x86: Unify pcspeaker platform device code between i386/x86-64 [PATCH] i386: Remove extern declaration from mm/discontig.c, put in header. [PATCH] i386: Rename cpu_gdt_descr and remove extern declaration from smpboot.c [PATCH] i386: Move mce_disabled to asm/mce.h [PATCH] i386: paravirt unhandled fallthrough [PATCH] x86_64: Wire up compat epoll_pwait [PATCH] x86: Don't require the vDSO for handling a.out signals [PATCH] i386: Fix Cyrix MediaGX detection [PATCH] i386: Fix warning in cpu initialization [PATCH] i386: Fix warning in microcode.c [PATCH] x86: Enable NMI watchdog for AMD Family 0x10 CPUs [PATCH] x86: Add new CPUID bits for AMD Family 10 CPUs in /proc/cpuinfo [PATCH] i386: Remove fastcall in paravirt.[ch] [PATCH] x86-64: Fix wrong gcc check in bitops.h [PATCH] x86-64: survive having no irq mapping for a vector [PATCH] i386: geode configuration fixes [PATCH] i386: add option to show more code in oops reports ...
Diffstat (limited to 'init')
-rw-r--r--init/main.c81
1 files changed, 45 insertions, 36 deletions
diff --git a/init/main.c b/init/main.c
index 649ab5443d43..2421e1544127 100644
--- a/init/main.c
+++ b/init/main.c
@@ -726,7 +726,49 @@ static void run_init_process(char *init_filename)
726 kernel_execve(init_filename, argv_init, envp_init); 726 kernel_execve(init_filename, argv_init, envp_init);
727} 727}
728 728
729static 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 */
732static 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
771static int __init init(void * unused)
730{ 772{
731 lock_kernel(); 773 lock_kernel();
732 /* 774 /*
@@ -774,39 +816,6 @@ static int init(void * unused)
774 * we're essentially up and running. Get rid of the 816 * we're essentially up and running. Get rid of the
775 * initmem segments and start the user-mode stuff.. 817 * initmem segments and start the user-mode stuff..
776 */ 818 */
777 free_initmem(); 819 init_post();
778 unlock_kernel(); 820 return 0;
779 mark_rodata_ro();
780 system_state = SYSTEM_RUNNING;
781 numa_default_policy();
782
783 if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
784 printk(KERN_WARNING "Warning: unable to open an initial console.\n");
785
786 (void) sys_dup(0);
787 (void) sys_dup(0);
788
789 if (ramdisk_execute_command) {
790 run_init_process(ramdisk_execute_command);
791 printk(KERN_WARNING "Failed to execute %s\n",
792 ramdisk_execute_command);
793 }
794
795 /*
796 * We try each of these until one succeeds.
797 *
798 * The Bourne shell can be used instead of init if we are
799 * trying to recover a really broken machine.
800 */
801 if (execute_command) {
802 run_init_process(execute_command);
803 printk(KERN_WARNING "Failed to execute %s. Attempting "
804 "defaults...\n", execute_command);
805 }
806 run_init_process("/sbin/init");
807 run_init_process("/etc/init");
808 run_init_process("/bin/init");
809 run_init_process("/bin/sh");
810
811 panic("No init found. Try passing init= option to kernel.");
812} 821}