aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/do_mounts_initrd.c3
-rw-r--r--init/initramfs.c8
-rw-r--r--init/main.c16
3 files changed, 26 insertions, 1 deletions
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index 5e4ded51788e..dfe606a7dd61 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -57,6 +57,9 @@ static void __init handle_initrd(void)
57 sys_mkdir("/old", 0700); 57 sys_mkdir("/old", 0700);
58 sys_chdir("/old"); 58 sys_chdir("/old");
59 59
60 /* try loading default modules from initrd */
61 load_default_modules();
62
60 /* 63 /*
61 * In case that a resume from disk is carried out by linuxrc or one of 64 * In case that a resume from disk is carried out by linuxrc or one of
62 * its children, we need to tell the freezer not to wait for us. 65 * its children, we need to tell the freezer not to wait for us.
diff --git a/init/initramfs.c b/init/initramfs.c
index 84c6bf111300..a67ef9dbda9d 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -592,7 +592,7 @@ static int __init populate_rootfs(void)
592 initrd_end - initrd_start); 592 initrd_end - initrd_start);
593 if (!err) { 593 if (!err) {
594 free_initrd(); 594 free_initrd();
595 return 0; 595 goto done;
596 } else { 596 } else {
597 clean_rootfs(); 597 clean_rootfs();
598 unpack_to_rootfs(__initramfs_start, __initramfs_size); 598 unpack_to_rootfs(__initramfs_start, __initramfs_size);
@@ -607,6 +607,7 @@ static int __init populate_rootfs(void)
607 sys_close(fd); 607 sys_close(fd);
608 free_initrd(); 608 free_initrd();
609 } 609 }
610 done:
610#else 611#else
611 printk(KERN_INFO "Unpacking initramfs...\n"); 612 printk(KERN_INFO "Unpacking initramfs...\n");
612 err = unpack_to_rootfs((char *)initrd_start, 613 err = unpack_to_rootfs((char *)initrd_start,
@@ -615,6 +616,11 @@ static int __init populate_rootfs(void)
615 printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err); 616 printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
616 free_initrd(); 617 free_initrd();
617#endif 618#endif
619 /*
620 * Try loading default modules from initramfs. This gives
621 * us a chance to load before device_initcalls.
622 */
623 load_default_modules();
618 } 624 }
619 return 0; 625 return 0;
620} 626}
diff --git a/init/main.c b/init/main.c
index baf1f0f5c461..18efadb11cf6 100644
--- a/init/main.c
+++ b/init/main.c
@@ -70,6 +70,8 @@
70#include <linux/perf_event.h> 70#include <linux/perf_event.h>
71#include <linux/file.h> 71#include <linux/file.h>
72#include <linux/ptrace.h> 72#include <linux/ptrace.h>
73#include <linux/blkdev.h>
74#include <linux/elevator.h>
73 75
74#include <asm/io.h> 76#include <asm/io.h>
75#include <asm/bugs.h> 77#include <asm/bugs.h>
@@ -794,6 +796,17 @@ static void __init do_pre_smp_initcalls(void)
794 do_one_initcall(*fn); 796 do_one_initcall(*fn);
795} 797}
796 798
799/*
800 * This function requests modules which should be loaded by default and is
801 * called twice right after initrd is mounted and right before init is
802 * exec'd. If such modules are on either initrd or rootfs, they will be
803 * loaded before control is passed to userland.
804 */
805void __init load_default_modules(void)
806{
807 load_default_elevator_module();
808}
809
797static int run_init_process(const char *init_filename) 810static int run_init_process(const char *init_filename)
798{ 811{
799 argv_init[0] = init_filename; 812 argv_init[0] = init_filename;
@@ -898,4 +911,7 @@ static void __init kernel_init_freeable(void)
898 * we're essentially up and running. Get rid of the 911 * we're essentially up and running. Get rid of the
899 * initmem segments and start the user-mode stuff.. 912 * initmem segments and start the user-mode stuff..
900 */ 913 */
914
915 /* rootfs is available now, try loading default modules */
916 load_default_modules();
901} 917}