Эх сурвалжийг харах

[PATCH] BLK_DEV_INITRD: do not require BLK_DEV_RAM=y

Initramfs initrd images do not need a ramdisk device, so remove this
restriction in Kconfig.  BLK_DEV_RAM=n saves about 13k on i386.  Also
without ramdisk device there's no need for "dry run", so initramfs unpacks
much faster.

People using cramfs, squashfs, or gzipped ext2/minix initrd images are
probably smart enough not to turn off ramdisk support by accident.

Cc: Al Viro <viro@ftp.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Zdenek Pavlas 19 жил өмнө
parent
commit
340e48e662

+ 0 - 1
drivers/block/Kconfig

@@ -401,7 +401,6 @@ config BLK_DEV_RAM_SIZE
 
 
 config BLK_DEV_INITRD
 config BLK_DEV_INITRD
 	bool "Initial RAM disk (initrd) support"
 	bool "Initial RAM disk (initrd) support"
-	depends on BLK_DEV_RAM=y
 	help
 	help
 	  The initial RAM disk is a RAM disk that is loaded by the boot loader
 	  The initial RAM disk is a RAM disk that is loaded by the boot loader
 	  (loadlin or lilo) and that is mounted as root before the normal boot
 	  (loadlin or lilo) and that is mounted as root before the normal boot

+ 10 - 0
init/initramfs.c

@@ -506,6 +506,7 @@ void __init populate_rootfs(void)
 		panic(err);
 		panic(err);
 #ifdef CONFIG_BLK_DEV_INITRD
 #ifdef CONFIG_BLK_DEV_INITRD
 	if (initrd_start) {
 	if (initrd_start) {
+#ifdef CONFIG_BLK_DEV_RAM
 		int fd;
 		int fd;
 		printk(KERN_INFO "checking if image is initramfs...");
 		printk(KERN_INFO "checking if image is initramfs...");
 		err = unpack_to_rootfs((char *)initrd_start,
 		err = unpack_to_rootfs((char *)initrd_start,
@@ -525,6 +526,15 @@ void __init populate_rootfs(void)
 			sys_close(fd);
 			sys_close(fd);
 			free_initrd();
 			free_initrd();
 		}
 		}
+#else
+		printk(KERN_INFO "Unpacking initramfs...");
+		err = unpack_to_rootfs((char *)initrd_start,
+			initrd_end - initrd_start, 0);
+		if (err)
+			panic(err);
+		printk(" done\n");
+		free_initrd();
+#endif
 	}
 	}
 #endif
 #endif
 }
 }