Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 194615 | Differences between
and this patch

Collapse All | Expand All

(-)linux-2.6.14.orig/fs/Kconfig (+12 lines)
Lines 805-810 Link Here
805
805
806
	  See <file:Documentation/filesystems/tmpfs.txt> for details.
806
	  See <file:Documentation/filesystems/tmpfs.txt> for details.
807
807
808
config EARLYUSERSPACE_ON_TMPFS
809
	bool "Unpack the early userspace onto tmpfs"
810
	depends TMPFS
811
	default y
812
	help
813
	  Use this to have your early userspace placed (decompressed)
814
	  onto tmpfs as opposed ramfs. This will allow you to
815
	  restrict the size of your root-filesystem and it will also
816
	  be swappable.
817
   
818
	  If unsure, say Y.
819
808
config HUGETLBFS
820
config HUGETLBFS
809
	bool "HugeTLB file system support"
821
	bool "HugeTLB file system support"
810
	depends X86 || IA64 || PPC64 || SPARC64 || SUPERH || X86_64 || BROKEN
822
	depends X86 || IA64 || PPC64 || SPARC64 || SUPERH || X86_64 || BROKEN
(-)linux-2.6.14.orig/init/initramfs.c (+47 lines)
Lines 6-11 Link Here
6
#include <linux/delay.h>
6
#include <linux/delay.h>
7
#include <linux/string.h>
7
#include <linux/string.h>
8
#include <linux/syscalls.h>
8
#include <linux/syscalls.h>
9
#include <asm/uaccess.h>
9
10
10
static __initdata char *message;
11
static __initdata char *message;
11
static void __init error(char *x)
12
static void __init error(char *x)
Lines 463-468 Link Here
463
	return message;
464
	return message;
464
}
465
}
465
466
467
/* If we want the rootfs on initramfs so we mount initramfs over the
468
 * rootfs before we unpack it. The little dance we do by creating a
469
 * pivot point and moving the root to that is in fact necessary
470
 * because lookups of "." don't resolve mountpoints.
471
 */
472
static inline void __init overmount_rootfs(void)
473
   {
474
#ifdef CONFIG_EARLYUSERSPACE_ON_TMPFS
475
    int init_tmpfs(void);
476
    int (*initfunc)(void) = init_tmpfs;
477
    mm_segment_t oldfs;
478
    char pivot[] = "/pivot";
479
   
480
    /* Explicitly go and init the overmount fs early (long-term
481
     * the need for this will probably go away. */
482
   
483
    if (initfunc())
484
    goto err;
485
   
486
    oldfs = get_fs();
487
    set_fs(KERNEL_DS);
488
   
489
    if (sys_mkdir(pivot, 0700) < 0)
490
    goto err;
491
    if (sys_mount("tmpfs", pivot, "tmpfs", 0, "size=90%"))
492
    goto err;
493
   
494
    /* Below here errors are unlikely and icky to deal with. */
495
    sys_chdir(pivot);
496
    sys_mount(".", "/", NULL, MS_MOVE, NULL);
497
    sys_chdir(".");
498
    sys_chroot(".");
499
    printk(KERN_INFO "Overmounted tmpfs\n");
500
    goto out;
501
   
502
    err:
503
    printk(KERN_ERR "Overmount error\n");
504
   
505
    out:
506
    set_fs(oldfs);
507
#endif /* CONFIG_EARLYUSERSPACE_ON_TMPFS */
508
}
509
466
extern char __initramfs_start[], __initramfs_end[];
510
extern char __initramfs_start[], __initramfs_end[];
467
#ifdef CONFIG_BLK_DEV_INITRD
511
#ifdef CONFIG_BLK_DEV_INITRD
468
#include <linux/initrd.h>
512
#include <linux/initrd.h>
Lines 482-487 Link Here
482
			initrd_end - initrd_start, 1);
526
			initrd_end - initrd_start, 1);
483
		if (!err) {
527
		if (!err) {
484
			printk(" it is\n");
528
			printk(" it is\n");
529
#ifdef CONFIG_EARLYUSERSPACE_ON_TMPFS
530
                        overmount_rootfs();
531
#endif /* CONFIG_EARLYUSERSPACE_ON_TMPFS */
485
			unpack_to_rootfs((char *)initrd_start,
532
			unpack_to_rootfs((char *)initrd_start,
486
				initrd_end - initrd_start, 0);
533
				initrd_end - initrd_start, 0);
487
			free_initrd_mem(initrd_start, initrd_end);
534
			free_initrd_mem(initrd_start, initrd_end);
(-)linux-2.6.14.orig/init/main.c (+5 lines)
Lines 701-706 Link Here
701
	if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
701
	if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
702
		ramdisk_execute_command = NULL;
702
		ramdisk_execute_command = NULL;
703
		prepare_namespace();
703
		prepare_namespace();
704
#ifdef CONFIG_EARLYUSERSPACE_ON_TMPFS
705
                int init_tmpfs(void);
706
                int (*initfunc)(void) = init_tmpfs;
707
                initfunc();
708
#endif /* CONFIG_EARLYUSERSPACE_ON_TMPFS */
704
	}
709
	}
705
710
706
	/*
711
	/*
(-)linux-2.6.14.orig/mm/shmem.c (-1 / +6 lines)
Lines 2136-2142 Link Here
2136
};
2136
};
2137
static struct vfsmount *shm_mnt;
2137
static struct vfsmount *shm_mnt;
2138
2138
2139
static int __init init_tmpfs(void)
2139
int __init init_tmpfs(void)
2140
{
2140
{
2141
	int error;
2141
	int error;
2142
2142
Lines 2169-2175 Link Here
2169
	shm_mnt = ERR_PTR(error);
2169
	shm_mnt = ERR_PTR(error);
2170
	return error;
2170
	return error;
2171
}
2171
}
2172
/* Don't do this if we are calling it early explicity */
2173
#ifndef CONFIG_EARLYUSERSPACE_ON_TMPFS
2174
/* If CONFIG_EARLYUSERSPACE_ON_TMPFS is set then we will interpose
2175
 * ramfs so this will get called explicitly and early */
2172
module_init(init_tmpfs)
2176
module_init(init_tmpfs)
2177
#endif /* !CONFIG_EARLYUSERSPACE_ON_TMPFS */
2173
2178
2174
/*
2179
/*
2175
 * shmem_file_setup - get an unlinked file living in tmpfs
2180
 * shmem_file_setup - get an unlinked file living in tmpfs

Return to bug 194615