1 diff -ur linux-2.6.14.orig/fs/Kconfig linux-2.6.14/fs/Kconfig
2 --- linux-2.6.14.orig/fs/Kconfig 2005-09-11 03:19:07.000000000 +0000
3 +++ linux-2.6.14/fs/Kconfig 2005-09-11 03:19:42.000000000 +0000
6 See <file:Documentation/filesystems/tmpfs.txt> for details.
8 +config EARLYUSERSPACE_ON_TMPFS
9 + bool "Unpack the early userspace onto tmpfs"
13 + Use this to have your early userspace placed (decompressed)
14 + onto tmpfs as opposed ramfs. This will allow you to
15 + restrict the size of your root-filesystem and it will also
21 bool "HugeTLB file system support"
22 depends X86 || IA64 || PPC64 || SPARC64 || SUPERH || X86_64 || BROKEN
23 Only in linux-2.6.14/fs: Kconfig.orig
24 diff -ur linux-2.6.14.orig/init/initramfs.c linux-2.6.14/init/initramfs.c
25 --- linux-2.6.14.orig/init/initramfs.c 2005-08-28 23:41:01.000000000 +0000
26 +++ linux-2.6.14/init/initramfs.c 2005-09-11 03:19:42.000000000 +0000
28 #include <linux/string.h>
29 #include <linux/syscalls.h>
30 #include <linux/utime.h>
31 +#include <asm/uaccess.h>
33 static __initdata char *message;
34 static void __init error(char *x)
39 +/* If we want the rootfs on initramfs so we mount initramfs over the
40 + * rootfs before we unpack it. The little dance we do by creating a
41 + * pivot point and moving the root to that is in fact necessary
42 + * because lookups of "." don't resolve mountpoints.
44 +static inline void __init overmount_rootfs(void)
46 +#ifdef CONFIG_EARLYUSERSPACE_ON_TMPFS
47 + int init_tmpfs(void);
48 + int (*initfunc)(void) = init_tmpfs;
50 + char pivot[] = "/pivot";
52 + /* Explicitly go and init the overmount fs early (long-term
53 + * the need for this will probably go away. */
61 + if (sys_mkdir(pivot, 0700) < 0)
63 + if (sys_mount("tmpfs", pivot, "tmpfs", 0, "size=95%"))
66 + /* Below here errors are unlikely and icky to deal with. */
68 + sys_mount(".", "/", NULL, MS_MOVE, NULL);
71 + printk(KERN_INFO "Overmounted tmpfs\n");
75 + printk(KERN_ERR "Overmount error\n");
79 +#endif /* CONFIG_EARLYUSERSPACE_ON_TMPFS */
82 extern char __initramfs_start[], __initramfs_end[];
83 #ifdef CONFIG_BLK_DEV_INITRD
84 #include <linux/initrd.h>
86 #ifdef CONFIG_BLK_DEV_RAM
88 printk(KERN_INFO "Trying to unpack rootfs image as initramfs...\n");
89 +#ifdef CONFIG_EARLYUSERSPACE_ON_TMPFS
91 +#endif /* CONFIG_EARLYUSERSPACE_ON_TMPFS */
92 err = unpack_to_rootfs((char *)initrd_start,
93 initrd_end - initrd_start);
95 diff -ur linux-2.6.14.orig/init/main.c linux-2.6.14/init/main.c
96 --- linux-2.6.14.orig/init/main.c 2005-09-11 03:19:07.000000000 +0000
97 +++ linux-2.6.14/init/main.c 2005-09-11 03:22:43.000000000 +0000
99 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
100 ramdisk_execute_command = NULL;
102 +#ifdef CONFIG_EARLYUSERSPACE_ON_TMPFS
103 + int init_tmpfs(void);
104 + int (*initfunc)(void) = init_tmpfs;
106 +#endif /* CONFIG_EARLYUSERSPACE_ON_TMPFS */
110 diff -ur linux-2.6.14.orig/mm/shmem.c linux-2.6.14/mm/shmem.c
111 --- linux-2.6.14.orig/mm/shmem.c 2005-09-11 03:19:07.000000000 +0000
112 +++ linux-2.6.14/mm/shmem.c 2005-09-11 03:19:42.000000000 +0000
113 @@ -2504,7 +2504,7 @@
114 .kill_sb = kill_litter_super,
117 -static int __init init_tmpfs(void)
118 +int __init init_tmpfs(void)
122 @@ -2672,4 +2672,9 @@
126 -module_init(init_tmpfs)
127 +/* Don't do this if we are calling it early explicity */
128 +#ifndef CONFIG_EARLYUSERSPACE_ON_TMPFS
129 +/* If CONFIG_EARLYUSERSPACE_ON_TMPFS is set then we will interpose
130 + * ramfs so this will get called explicitly and early */
131 + module_init(init_tmpfs)
132 +#endif /* !CONFIG_EARLYUSERSPACE_ON_TMPFS */