Give the option to use tmpfs for /tmp in sysinst instead of the older

mfs on i386 and amd64. Should be enabled on other platforms with reliable
tmpfs too.
This commit is contained in:
ahoka 2009-10-18 12:09:48 +00:00
parent 1ce7a503cf
commit ff77aac2d4
6 changed files with 35 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.25 2009/04/07 10:45:05 tsutsui Exp $ */
/* $NetBSD: md.h,v 1.26 2009/10/18 12:09:48 ahoka Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -62,6 +62,9 @@
/* have support for booting form UFS2 */
#define HAVE_UFS2_BOOT
/* allow using tmpfs for /tmp instead of mfs */
#define HAVE_TMPFS
/* have file system specific primary boot loader */
#define HAVE_BOOTXX_xFS
#define BOOTXXDIR "/usr/mdec"

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.66 2009/04/07 10:45:05 tsutsui Exp $ */
/* $NetBSD: md.h,v 1.67 2009/10/18 12:09:48 ahoka Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -63,6 +63,9 @@
/* have support for booting from UFS2 */
#define HAVE_UFS2_BOOT
/* allow using tmpfs for /tmp instead of mfs */
#define HAVE_TMPFS
/* have file system specific primary boot loader */
#define HAVE_BOOTXX_xFS
#define BOOTXXDIR "/usr/mdec"

View File

@ -1,4 +1,4 @@
/* $NetBSD: bsddisklabel.c,v 1.52 2009/05/14 16:23:38 sborrill Exp $ */
/* $NetBSD: bsddisklabel.c,v 1.53 2009/10/18 12:09:48 ahoka Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -61,9 +61,9 @@ static int check_partitions(void);
/* For the current state of this file blame abs@NetBSD.org */
/* Even though he wasn't the last to hack it, but he did admit doing so :-) */
#define PART_ANY -1
#define PART_EXTRA -2
#define PART_TMP_MFS -3
#define PART_ANY -1
#define PART_EXTRA -2
#define PART_TMP_RAMDISK -3
/* Defaults for things that might be defined in md.h */
#ifndef PART_ROOT
@ -290,7 +290,7 @@ set_ptn_size(menudesc *m, void *arg)
}
size = NUMSEC(size, mult, dlcylsize);
if (p->ptn_id == PART_TMP_MFS) {
if (p->ptn_id == PART_TMP_RAMDISK) {
p->size = size;
return 0;
}
@ -357,9 +357,13 @@ get_ptn_sizes(daddr_t part_start, daddr_t sectors, int no_swap)
#define PI_SWAP 1
{ PART_SWAP, { 's', 'w', 'a', 'p', '\0' },
DEFSWAPSIZE, DEFSWAPSIZE, 0, 0 },
{ PART_TMP_MFS,
{ PART_TMP_RAMDISK,
#ifdef HAVE_TMPFS
{ 't', 'm', 'p', ' ', '(', 't', 'm', 'p', 'f', 's', ')', '\0' },
#else
{ 't', 'm', 'p', ' ', '(', 'm', 'f', 's', ')', '\0' },
64, 0, 0, 0 },
#endif
64, 0, 0, 0 },
#define PI_USR 3
{ PART_USR, { '/', 'u', 's', 'r', '\0' }, DEFUSRSIZE,
0, 0, 0 },
@ -495,7 +499,7 @@ get_ptn_sizes(daddr_t part_start, daddr_t sectors, int no_swap)
break;
continue;
}
if (p->ptn_id == PART_TMP_MFS)
if (p->ptn_id == PART_TMP_RAMDISK)
continue;
p->size += pi.free_space % dlcylsize;
break;
@ -510,8 +514,8 @@ get_ptn_sizes(daddr_t part_start, daddr_t sectors, int no_swap)
size = p->limit;
}
i = p->ptn_id;
if (i == PART_TMP_MFS) {
tmp_mfs_size = size;
if (i == PART_TMP_RAMDISK) {
tmp_ramdisk_size = size;
size = 0;
continue;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.145 2009/09/19 14:57:27 abs Exp $ */
/* $NetBSD: defs.h,v 1.146 2009/10/18 12:09:48 ahoka Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -257,7 +257,7 @@ enum DLTR { PART_A, PART_B, PART_C, PART_D, PART_E, PART_F, PART_G, PART_H,
#define partition_name(x) ('a' + (x))
partinfo oldlabel[MAXPARTITIONS]; /* What we found on the disk */
partinfo bsdlabel[MAXPARTITIONS]; /* What we want it to look like */
int tmp_mfs_size;
daddr_t tmp_ramdisk_size;
#define DISKNAME_SIZE 16
char bsddiskname[DISKNAME_SIZE];

View File

@ -1,4 +1,4 @@
/* $NetBSD: disks.c,v 1.108 2009/10/03 12:00:00 martin Exp $ */
/* $NetBSD: disks.c,v 1.109 2009/10/18 12:09:48 ahoka Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -746,13 +746,18 @@ make_fstab(void)
dump_freq, fsck_pass);
}
if (tmp_mfs_size != 0) {
if (tmp_ramdisk_size != 0) {
#ifdef HAVE_TMPFS
scripting_fprintf(f, "tmpfs\t\t/tmp\ttmpfs\trw,-m=1777,-s=%d\n",
tmp_ramdisk_size * 512);
#else
if (swap_dev != -1)
scripting_fprintf(f, "/dev/%s%c\t\t/tmp\tmfs\trw,-s=%d\n",
diskdev, 'a' + swap_dev, tmp_mfs_size);
diskdev, 'a' + swap_dev, tmp_ramdisk_size);
else
scripting_fprintf(f, "swap\t\t/tmp\tmfs\trw,-s=%d\n",
tmp_mfs_size);
tmp_ramdisk_size);
#endif
}
/* Add /kern, /proc and /dev/pts to fstab and make mountpoint. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.53 2008/12/21 11:02:41 martin Exp $ */
/* $NetBSD: main.c,v 1.54 2009/10/18 12:09:48 ahoka Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -114,7 +114,7 @@ init(void)
sizemult = 1;
disktype = "unknown";
tmp_mfs_size = 0;
tmp_ramdisk_size = 0;
doessf = "";
clean_xfer_dir = 0;
mnt2_mounted = 0;