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/delay.h>
29 #include <linux/string.h>
30 #include <linux/syscalls.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 initrd_end - initrd_start, 1);
89 +#ifdef CONFIG_EARLYUSERSPACE_ON_TMPFS
91 +#endif /* CONFIG_EARLYUSERSPACE_ON_TMPFS */
92 unpack_to_rootfs((char *)initrd_start,
93 initrd_end - initrd_start, 0);
94 free_initrd_mem(initrd_start, initrd_end);
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 @@ -2136,7 +2136,7 @@
115 static struct vfsmount *shm_mnt;
117 -static int __init init_tmpfs(void)
118 +int __init init_tmpfs(void)
122 @@ -2169,7 +2169,12 @@
123 shm_mnt = ERR_PTR(error);
126 +/* Don't do this if we are calling it early explicity */
127 +#ifndef CONFIG_EARLYUSERSPACE_ON_TMPFS
128 +/* If CONFIG_EARLYUSERSPACE_ON_TMPFS is set then we will interpose
129 + * ramfs so this will get called explicitly and early */
130 module_init(init_tmpfs)
131 +#endif /* !CONFIG_EARLYUSERSPACE_ON_TMPFS */
134 * shmem_file_setup - get an unlinked file living in tmpfs