diff options
author | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2003-02-21 12:25:26 -0600 |
---|---|---|
committer | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2003-02-21 12:25:26 -0600 |
commit | 3807a041569c74f3985c3fdb5b5d6f08fbc17ce5 (patch) | |
tree | a376a9aad5b6574ca2c24ff06236be7dec6ed078 /init | |
parent | 1a471f376b955c9c1d5cf10d7e2e15b6ada7a8d8 (diff) | |
download | history-3807a041569c74f3985c3fdb5b5d6f08fbc17ce5.tar.gz |
do_mount: Move more of the initrd load logic into initrd_load()
This just moves a bit of logic out of prepare_namespace() into
initrd_load(), which means that we now don't reference handle_initrd()
anymore if CONFIG_BLK_DEV_INITRD is not set (we wouldn't call it anyway),
so we can put some bits of code under a common #ifdef CONFIG_BLK_DEV_INITRD.
Diffstat (limited to 'init')
-rw-r--r-- | init/do_mounts.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/init/do_mounts.c b/init/do_mounts.c index f6cf38c35c2c8e..96b1594e5591f5 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -622,14 +622,12 @@ static int __init do_linuxrc(void * shell) return execve(shell, argv, envp_init); } -#endif - static void __init handle_initrd(void) { -#ifdef CONFIG_BLK_DEV_INITRD int error; int i, pid; + real_root_dev = ROOT_DEV; create_dev("/dev/root.old", Root_RAM0, NULL); /* mount initrd on rootfs' /root */ mount_block_root("/dev/root.old", root_mountflags & ~MS_RDONLY); @@ -684,15 +682,21 @@ static void __init handle_initrd(void) } printk(!error ? "okay\n" : "failed\n"); } -#endif } -#ifdef CONFIG_BLK_DEV_INITRD static int __init initrd_load(void) { create_dev("/dev/ram", MKDEV(RAMDISK_MAJOR, 0), NULL); create_dev("/dev/initrd", MKDEV(RAMDISK_MAJOR, INITRD_MINOR), NULL); - return rd_load_image("/dev/initrd"); + /* Load the initrd data into /dev/ram0. Execute it as initrd unless + * /dev/ram0 is supposed to be our actual root device, in + * that case the ram disk is just set up here, and gets + * mounted in the normal path. */ + if (rd_load_image("/dev/initrd") && ROOT_DEV != Root_RAM0) { + handle_initrd(); + return 1; + } + return 0; } #else static inline int initrd_load(void) { return 0; } @@ -718,10 +722,6 @@ void __init prepare_namespace(void) is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR; -#ifdef CONFIG_BLK_DEV_INITRD - real_root_dev = ROOT_DEV; -#endif - create_dev("/dev/root", ROOT_DEV, NULL); /* This has to be before mounting root, because even readonly mount of reiserfs would replay @@ -729,10 +729,8 @@ void __init prepare_namespace(void) software_resume(); if (mount_initrd) { - if (initrd_load() && ROOT_DEV != Root_RAM0) { - handle_initrd(); + if (initrd_load()) goto out; - } } else if (is_floppy && rd_doload && rd_load_disk(0)) ROOT_DEV = Root_RAM0; mount_root(); |