Skip to content

Commit

Permalink
Make sure we populate the initroot filesystem late enough
Browse files Browse the repository at this point in the history
We should not initialize rootfs before all the core initializers have
run.  So do it as a separate stage just before starting the regular
driver initializers.

Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Linus Torvalds committed Dec 11, 2006
1 parent 8993780 commit 8d610dd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions include/asm-generic/vmlinux.lds.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
*(.initcall4s.init) \
*(.initcall5.init) \
*(.initcall5s.init) \
*(.initcallrootfs.init) \
*(.initcall6.init) \
*(.initcall6s.init) \
*(.initcall7.init) \
Expand Down
1 change: 1 addition & 0 deletions include/linux/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ extern void setup_arch(char **);
#define subsys_initcall_sync(fn) __define_initcall("4s",fn,4s)
#define fs_initcall(fn) __define_initcall("5",fn,5)
#define fs_initcall_sync(fn) __define_initcall("5s",fn,5s)
#define rootfs_initcall(fn) __define_initcall("rootfs",fn,rootfs)
#define device_initcall(fn) __define_initcall("6",fn,6)
#define device_initcall_sync(fn) __define_initcall("6s",fn,6s)
#define late_initcall(fn) __define_initcall("7",fn,7)
Expand Down
6 changes: 4 additions & 2 deletions init/initramfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ static void __init free_initrd(void)

#endif

void __init populate_rootfs(void)
static int __init populate_rootfs(void)
{
char *err = unpack_to_rootfs(__initramfs_start,
__initramfs_end - __initramfs_start, 0);
Expand All @@ -544,7 +544,7 @@ void __init populate_rootfs(void)
unpack_to_rootfs((char *)initrd_start,
initrd_end - initrd_start, 0);
free_initrd();
return;
return 0;
}
printk("it isn't (%s); looks like an initrd\n", err);
fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700);
Expand All @@ -565,4 +565,6 @@ void __init populate_rootfs(void)
#endif
}
#endif
return 0;
}
rootfs_initcall(populate_rootfs);
7 changes: 0 additions & 7 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ extern void pidmap_init(void);
extern void prio_tree_init(void);
extern void radix_tree_init(void);
extern void free_initmem(void);
extern void populate_rootfs(void);
extern void driver_init(void);
extern void prepare_namespace(void);
#ifdef CONFIG_ACPI
Expand Down Expand Up @@ -745,12 +744,6 @@ static int init(void * unused)

cpuset_init_smp();

/*
* Do this before initcalls, because some drivers want to access
* firmware files.
*/
populate_rootfs();

do_basic_setup();

/*
Expand Down

0 comments on commit 8d610dd

Please sign in to comment.