summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-10-12 01:18:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-10-12 01:18:07 +0000
commit70a1902d7725a18650bd68dd2d63c1e4b95dcee1 (patch)
tree38c677aa5b962995a62d93d3dafd6d1af766af48
parent24e918b04736223c98128a7e9b14e80517500ddc (diff)
first cut, copied from sun3 stuff
-rw-r--r--distrib/mvme68k/Makefile5
-rw-r--r--distrib/mvme68k/Makefile.inc10
-rw-r--r--distrib/mvme68k/common/Make.crunch20
-rw-r--r--distrib/mvme68k/common/Make.fsimage42
-rw-r--r--distrib/mvme68k/common/Make.static11
-rw-r--r--distrib/mvme68k/common/Makefile.inc31
-rw-r--r--distrib/mvme68k/common/RunList.awk44
-rw-r--r--distrib/mvme68k/common/RunList.sh14
-rw-r--r--distrib/mvme68k/common/install.md262
-rw-r--r--distrib/mvme68k/common/install.sh1211
-rw-r--r--distrib/mvme68k/common/mini_bin.list40
-rw-r--r--distrib/mvme68k/common/mini_sbin.list39
-rw-r--r--distrib/mvme68k/common/mini_usr.conf30
-rw-r--r--distrib/mvme68k/common/mini_usr.list38
-rw-r--r--distrib/mvme68k/common/mini_xx.list26
-rw-r--r--distrib/mvme68k/common/mini_xx.mk30
-rw-r--r--distrib/mvme68k/common/miniroot.list47
-rw-r--r--distrib/mvme68k/common/miniroot.tree101
-rw-r--r--distrib/mvme68k/common/mr.disktab32
-rw-r--r--distrib/mvme68k/common/mr.etc.rc9
-rw-r--r--distrib/mvme68k/common/mr.profile55
-rw-r--r--distrib/mvme68k/common/mr.remount34
-rw-r--r--distrib/mvme68k/common/mr.termcap91
-rw-r--r--distrib/mvme68k/common/ramdisk.list21
-rw-r--r--distrib/mvme68k/common/ramdisk.tree39
-rw-r--r--distrib/mvme68k/common/rd.disktab2
-rw-r--r--distrib/mvme68k/common/rd.fstab2
-rw-r--r--distrib/mvme68k/common/rd.passwd1
-rw-r--r--distrib/mvme68k/common/rd.protocols6
-rw-r--r--distrib/mvme68k/common/rd.services56
-rw-r--r--distrib/mvme68k/common/rd.sshrc4
-rw-r--r--distrib/mvme68k/common/rd.welcome23
-rw-r--r--distrib/mvme68k/common/rd_bin.conf82
-rw-r--r--distrib/mvme68k/common/rd_bin.list44
-rw-r--r--distrib/mvme68k/common/rdsetroot.c230
-rw-r--r--distrib/mvme68k/miniroot/Makefile72
-rw-r--r--distrib/mvme68k/ramdisk/Findrefs12
-rw-r--r--distrib/mvme68k/ramdisk/Makefile70
-rw-r--r--distrib/mvme68k/ramdisk/Showsyms9
39 files changed, 2895 insertions, 0 deletions
diff --git a/distrib/mvme68k/Makefile b/distrib/mvme68k/Makefile
new file mode 100644
index 00000000000..0a317598577
--- /dev/null
+++ b/distrib/mvme68k/Makefile
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile,v 1.2 1995/10/12 21:16:53 gwr Exp $
+
+SUBDIR= miniroot ramdisk
+
+.include <bsd.subdir.mk>
diff --git a/distrib/mvme68k/Makefile.inc b/distrib/mvme68k/Makefile.inc
new file mode 100644
index 00000000000..aee5154066f
--- /dev/null
+++ b/distrib/mvme68k/Makefile.inc
@@ -0,0 +1,10 @@
+# $NetBSD: Makefile.inc,v 1.2.6.1 1996/08/29 03:10:06 gwr Exp $
+
+# Revision is 1.2
+REV= 12
+
+LDSTATIC= -static
+
+# Hack needed to find kernel images...
+BSDSRCDIR?= /usr/src
+SRCSYSDIR?= ${BSDSRCDIR}/sys
diff --git a/distrib/mvme68k/common/Make.crunch b/distrib/mvme68k/common/Make.crunch
new file mode 100644
index 00000000000..ffbe2f1b0ed
--- /dev/null
+++ b/distrib/mvme68k/common/Make.crunch
@@ -0,0 +1,20 @@
+# $NetBSD: Make.crunch,v 1.3 1995/11/21 21:18:48 gwr Exp $
+#
+# This is included by subdirectories building a crunched binary.
+# Assume the following are already defined: TOP, CBIN
+
+CBIN?= xxx-crunched
+CRUNCHCONF= ${TOP}/common/${CBIN}.conf
+
+CLEANFILES+= ${CBIN} ${CBIN}.c ${CBIN}.cache ${CBIN}.mk ${CBIN}.syms
+CLEANFILES+= *.lo *_stub.o *_stub.c
+
+# Keep a copy that is not stripped so I can debug...
+${CBIN}: ${CBIN}.mk ${CBIN}.cache ${CBIN}.c
+ make -f ${CBIN}.mk all STRIP=true
+ cp -p ${CBIN} ${CBIN}.syms
+ strip ${CBIN}
+
+${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CRUNCHCONF}
+ crunchgen -D ${BSDSRCDIR} -L ${DESTDIR}/usr/lib ${CRUNCHCONF}
+
diff --git a/distrib/mvme68k/common/Make.fsimage b/distrib/mvme68k/common/Make.fsimage
new file mode 100644
index 00000000000..53c19d6d192
--- /dev/null
+++ b/distrib/mvme68k/common/Make.fsimage
@@ -0,0 +1,42 @@
+#
+# $NetBSD: Make.fsimage,v 1.2 1995/10/13 16:38:26 gwr Exp $
+#
+
+# TOP is assumed to be defined by Makefile including this one.
+# These will be defined by it too:
+
+IMAGE?= xxx-${REV}
+CBIN?= xxx-crunched
+
+TREE?= ${.CURDIR}/${CBIN}.tree
+LISTS?= ${.CURDIR}/${CBIN}.list
+
+MOUNT_POINT?= /mnt
+DISKTYPE?= xxx-disktype
+BDEV?= /dev/rd0
+CDEV?= /dev/rd0
+
+IMAGE_DEPS?= ${CBIN}
+CLEANFILES+= ${IMAGE}.fs
+
+# These are all the parameters for the root fs:
+NBLKS?= 512
+# args: old fmt, minfree, opt, ...
+NEWFSARGS?= -O -m 0 -o space
+
+do_mount:
+ -newfs ${NEWFSARGS} -s ${NBLKS} ${CDEV} ${DISKTYPE}
+ mount ${BDEV} ${MOUNT_POINT}
+
+do_files:
+ mtree -def ${TREE} -p ${MOUNT_POINT}/ -u
+ TOPDIR=${TOP} CURDIR=${.CURDIR} \
+ OBJDIR=${.OBJDIR} TARGDIR=${MOUNT_POINT} \
+ sh ${TOP}/common/RunList.sh ${LISTS}
+
+do_umount:
+ @echo ""
+ @df -i ${MOUNT_POINT}
+ @echo ""
+ -umount ${MOUNT_POINT}
+
diff --git a/distrib/mvme68k/common/Make.static b/distrib/mvme68k/common/Make.static
new file mode 100644
index 00000000000..afab996c833
--- /dev/null
+++ b/distrib/mvme68k/common/Make.static
@@ -0,0 +1,11 @@
+#
+# $NetBSD: Make.static,v 1.1 1995/11/21 21:18:51 gwr Exp $
+#
+# This is logically appended to some other makefile, i.e.
+# using: make -f Makefile -f $(OUTDIR)/Make.static ...
+STRIP_CMD=strip
+
+${OUTDIR}/${PROG} : ${OBJS} ${LIBC} ${DPADD}
+ ${CC} -static ${LDFLAGS} -o ${OUTDIR}/${PROG} ${OBJS} ${LDADD}
+ ${STRIP_CMD} ${OUTDIR}/${PROG}
+
diff --git a/distrib/mvme68k/common/Makefile.inc b/distrib/mvme68k/common/Makefile.inc
new file mode 100644
index 00000000000..69eb1490626
--- /dev/null
+++ b/distrib/mvme68k/common/Makefile.inc
@@ -0,0 +1,31 @@
+#
+# $NetBSD: Makefile.inc,v 1.1.1.1 1995/10/08 23:07:45 gwr Exp $
+#
+
+# TOP is assumed to be defined by Makefile including this one.
+
+CBIN?= instbin
+COMMONDIR= ${TOP}/common
+
+MOUNT_POINT?= /mnt
+BDEV?= /dev/rd0
+DISKTYPE?= xxx-disktype
+IMAGE?= xxx-${REV}.fs
+MDEC= ${DESTDIR}/usr/mdec
+
+LISTS= ${.CURDIR}/list
+MTREE= ${.CURDIR}/mtree.conf
+
+fsimage:
+ newfs -O -m 0 -o space -i 3052 -c 60 ${BDEV} ${DISKTYPE}
+ mount ${BDEV} ${MOUNT_POINT}
+ mtree -def ${MTREE} -p ${MOUNT_POINT}/ -u
+ TOPDIR=${TOP} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} \
+ TARGDIR=${MOUNT_POINT} sh ${TOP}/Runlist.sh ${LISTS}
+ @echo ""
+ @df -i ${MOUNT_POINT}
+ @echo ""
+ -umount ${MOUNT_POINT}
+
+.include <bsd.obj.mk>
+.include <bsd.subdir.mk>
diff --git a/distrib/mvme68k/common/RunList.awk b/distrib/mvme68k/common/RunList.awk
new file mode 100644
index 00000000000..cdda1047921
--- /dev/null
+++ b/distrib/mvme68k/common/RunList.awk
@@ -0,0 +1,44 @@
+# $NetBSD: RunList.awk,v 1.1.1.1.6.1 1996/08/29 03:10:58 gwr Exp $
+
+BEGIN {
+ printf("cd ${CURDIR}\n");
+ printf("\n");
+}
+/^$/ || /^#/ {
+ print $0;
+ next;
+}
+$1 == "COPY" {
+ printf("echo '%s'\n", $0);
+ printf("cp %s ${TARGDIR}/%s\n", $2, $3);
+ next;
+}
+$1 == "LINK" {
+ printf("echo '%s'\n", $0);
+ printf("(cd ${TARGDIR}; ln %s %s)\n", $2, $3);
+ next;
+}
+$1 == "SYMLINK" {
+ printf("echo '%s'\n", $0);
+ printf("(cd ${TARGDIR}; rm -f %s; ln -s %s %s)\n", $3, $2, $3);
+ next;
+}
+$1 == "SPECIAL" {
+ printf("echo '%s'\n", $0);
+ printf("(cd ${TARGDIR};");
+ for (i = 2; i <= NF; i++)
+ printf(" %s", $i);
+ printf(")\n");
+ next;
+}
+{
+ printf("echo '%s'\n", $0);
+ printf("echo 'Unknown keyword \"%s\" at line %d of input.'\n", $1, NR);
+ printf("exit 1\n");
+ exit 1;
+}
+END {
+ printf("\n");
+ printf("exit 0\n");
+ exit 0;
+}
diff --git a/distrib/mvme68k/common/RunList.sh b/distrib/mvme68k/common/RunList.sh
new file mode 100644
index 00000000000..380cd2512bd
--- /dev/null
+++ b/distrib/mvme68k/common/RunList.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# $NetBSD: RunList.sh,v 1.1.1.1 1995/10/08 23:07:47 gwr Exp $
+
+if [ "X$1" = "X-d" ]; then
+ SHELLCMD=cat
+ shift
+else
+ SHELLCMD="sh -e"
+fi
+
+cat "$@" |
+awk -f ${TOPDIR}/common/RunList.awk |
+${SHELLCMD}
diff --git a/distrib/mvme68k/common/install.md b/distrib/mvme68k/common/install.md
new file mode 100644
index 00000000000..bacf9d71ee9
--- /dev/null
+++ b/distrib/mvme68k/common/install.md
@@ -0,0 +1,262 @@
+# $NetBSD: install.md,v 1.2.2.1 1996/08/29 03:33:48 gwr Exp $
+#
+#
+# Copyright (c) 1996 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jason R. Thorpe.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# machine dependent section of installation/upgrade script.
+#
+
+# Machine-dependent install sets
+# MDSETS="xbin xman xinc xcon" XXX
+MDSETS=""
+
+md_set_term() {
+ if [ ! -z "$TERM" ]; then
+ return
+ fi
+ echo -n "Specify terminal type [sun]: "
+ getresp "sun"
+ TERM="$resp"
+ export TERM
+}
+
+__mount_kernfs() {
+ # Make sure kernfs is mounted.
+ if [ ! -d /kern -o ! -e /kern/msgbuf ]; then
+ mkdir /kern > /dev/null 2>&1
+ /sbin/mount_kernfs /kern /kern >/dev/null 2>&1
+ fi
+}
+
+md_makerootwritable() {
+ # Just remount the root device read-write.
+ if [ ! -e /tmp/.root_writable ]; then
+ __mount_kernfs
+ echo "Remounting root read-write..."
+ mount -u /kern/rootdev /
+ cp /dev/null /tmp/.root_writable
+ fi
+}
+
+md_get_diskdevs() {
+ # return available disk devices
+ __mount_kernfs
+ sed -n -e '/^sd[0-9] /s/ .*//p' \
+ -e '/^xd[0-9] /s/ .*//p' \
+ -e '/^xy[0-9] /s/ .*//p' \
+ < /kern/msgbuf | sort -u
+}
+
+md_get_cddevs() {
+ # return available CDROM devices
+ __mount_kernfs
+ sed -n -e '/^cd[0-9] /s/ .*//p' \
+ < /kern/msgbuf | sort -u
+}
+
+md_get_ifdevs() {
+ # return available network devices
+ __mount_kernfs
+ sed -n -e '/^ie[0-9] /s/ .*//p' \
+ -e '/^le[0-9] /s/ .*//p' \
+ < /kern/msgbuf | sort -u
+}
+
+md_get_partition_range() {
+ # return an expression describing the valid partition id's
+ echo '[a-h]'
+}
+
+md_installboot() {
+ # install the boot block on disk $1
+ echo "Installing boot block..."
+ ( cd /usr/mdec ;\
+ cp -p ./ufsboot /mnt/ufsboot ;\
+ sync ; sleep 1 ; sync ;\
+ ./installboot -v /mnt/ufsboot bootxx /dev/r${1}a )
+ echo "done."
+}
+
+md_native_fstype() {
+}
+
+md_native_fsopts() {
+}
+
+md_checkfordisklabel() {
+ # $1 is the disk to check
+ local rval
+
+ disklabel $1 > /dev/null 2> /tmp/checkfordisklabel
+ if grep "no disk label" /tmp/checkfordisklabel; then
+ rval=1
+ elif grep "disk label corrupted" /tmp/checkfordisklabel; then
+ rval=2
+ else
+ rval=0
+ fi
+
+ rm -f /tmp/checkfordisklabel
+ return $rval
+}
+
+md_prep_disklabel()
+{
+ local _disk
+
+ _disk=$1
+ md_checkfordisklabel $_disk
+ case $? in
+ 0)
+ echo -n "Do you wish to edit the disklabel on $_disk? [y]"
+ ;;
+ 1)
+ echo "WARNING: Disk $_disk has no label"
+ echo -n "Do you want to create one with the disklabel editor? [y]"
+ ;;
+ 2)
+ echo "WARNING: Label on disk $_disk is corrupted"
+ echo -n "Do you want to try and repair the damage using the disklabel editor? [y]"
+ ;;
+ esac
+
+ getresp "y"
+ case "$resp" in
+ y*|Y*) ;;
+ *) return ;;
+ esac
+
+ # display example
+ cat << \__md_prep_disklabel_1
+
+Here is an example of what the partition information will look like once
+you have entered the disklabel editor. Disk partition sizes and offsets
+are in sector (most likely 512 bytes) units. Make sure these size/offset
+pairs are on cylinder boundaries (the number of sector per cylinder is
+given in the `sectors/cylinder' entry, which is not shown here).
+
+Do not change any parameters except the partition layout and the label name.
+It's probably also wisest not to touch the `8 partitions:' line, even
+in case you have defined less than eight partitions.
+
+[Example]
+8 partitions:
+# size offset fstype [fsize bsize cpg]
+ a: 50176 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 111)
+ b: 64512 50176 swap # (Cyl. 112 - 255)
+ c: 640192 0 unknown # (Cyl. 0 - 1428)
+ d: 525504 114688 4.2BSD 1024 8192 16 # (Cyl. 256 - 1428)
+[End of example]
+
+__md_prep_disklabel_1
+ echo -n "Press [Enter] to continue "
+ getresp ""
+ edlabel /dev/r${_disk}c
+}
+
+md_copy_kernel() {
+ echo -n "Copying kernel..."
+ cp -p /netbsd /mnt/netbsd
+ echo "done."
+}
+
+md_welcome_banner() {
+ if [ "$MODE" = "install" ]; then
+ echo ""
+ echo "Welcome to the NetBSD/sun3 ${VERSION} installation program."
+ cat << \__welcome_banner_1
+
+This program is designed to help you put NetBSD on your disk,
+in a simple and rational way. You'll be asked several questions,
+and it would probably be useful to have your disk's hardware
+manual, the installation notes, and a calculator handy.
+__welcome_banner_1
+
+ else
+ echo ""
+ echo "Welcome to the NetBSD/sun3 ${VERSION} upgrade program."
+ cat << \__welcome_banner_2
+
+This program is designed to help you upgrade your NetBSD system in a
+simple and rational way.
+
+As a reminder, installing the `etc' binary set is NOT recommended.
+Once the rest of your system has been upgraded, you should manually
+merge any changes to files in the `etc' set into those files which
+already exist on your system.
+__welcome_banner_2
+ fi
+
+cat << \__welcome_banner_3
+
+As with anything which modifies your disk's contents, this
+program can cause SIGNIFICANT data loss, and you are advised
+to make sure your data is backed up before beginning the
+installation process.
+
+Default answers are displayed in brackets after the questions.
+You can hit Control-C at any time to quit, but if you do so at a
+prompt, you may have to hit return. Also, quitting in the middle of
+installation may leave your system in an inconsistent state.
+
+__welcome_banner_3
+}
+
+md_not_going_to_install() {
+ cat << \__not_going_to_install_1
+
+OK, then. Enter `halt' at the prompt to halt the machine. Once the
+machine has halted, power-cycle the system to load new boot code.
+
+__not_going_to_install_1
+}
+
+md_congrats() {
+ local what;
+ if [ "$MODE" = "install" ]; then
+ what="installed";
+ else
+ what="upgraded";
+ fi
+ cat << __congratulations_1
+
+CONGRATULATIONS! You have successfully $what NetBSD!
+To boot the installed system, enter halt at the command prompt. Once the
+system has halted, reset the machine and boot from the disk.
+
+__congratulations_1
+}
diff --git a/distrib/mvme68k/common/install.sh b/distrib/mvme68k/common/install.sh
new file mode 100644
index 00000000000..e68025f3332
--- /dev/null
+++ b/distrib/mvme68k/common/install.sh
@@ -0,0 +1,1211 @@
+#!/bin/sh
+# $OpenBSD: install.sh,v 1.1 1996/10/12 01:17:38 deraadt Exp $
+# $NetBSD: install.sh,v 1.5 1996/02/28 00:52:38 thorpej Exp $
+#
+# Copyright (c) 1996 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jason R. Thorpe.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+# OpenBSD installation script.
+# In a perfect world, this would be a nice C program, with a reasonable
+# user interface.
+
+VERSION=1.1
+export VERSION # XXX needed in subshell
+ROOTDISK="" # filled in below
+FILESYSTEMS="/tmp/.filesystems" # used thoughout
+FQDN="" # domain name
+
+trap "umount /tmp > /dev/null 2>&1" 0
+
+getresp() {
+ read resp
+ if [ "X$resp" = "X" ]; then
+ resp=$1
+ fi
+}
+
+isin() {
+# test the first argument against the remaining ones, return succes on a match
+ _a=$1; shift
+ while [ $# != 0 ]; do
+ if [ "$_a" = "$1" ]; then return 0; fi
+ shift
+ done
+ return 1
+}
+
+rmel() {
+# remove first argument from list formed by the remaining arguments
+ _a=$1; shift
+ while [ $# != 0 ]; do
+ if [ "$_a" != "$1" ]; then
+ echo "$1";
+ fi
+ shift
+ done
+}
+
+twiddle() {
+# spin the propeller so we don't get bored
+ while : ; do
+ sleep 1; echo -n "/";
+ sleep 1; echo -n "-";
+ sleep 1; echo -n "\\";
+ sleep 1; echo -n "|";
+ done > /dev/tty & echo $!
+}
+
+#
+# machine dependent section
+#
+
+can_read_dev() {
+ dd if=/dev/$1 of=/dev/null count=1 > /dev/null 2>&1
+}
+
+# List of all disks supported by the miniroot:
+ALLDISKS="sd0 sd2 xd0 xd1 xy0 xy1"
+md_get_diskdevs() {
+ # return available disk devices
+ for dev in $ALLDISKS
+ do
+ can_read_dev r${dev}c && echo $dev
+ done
+}
+
+md_get_cddevs() {
+ # return available CD-ROM devices
+ for dev in cd0 cd1
+ do
+ can_read_dev r${dev}c && echo $dev
+ done
+}
+
+md_get_ifdevs() {
+ # return available network interfaces
+ for dev in le0 ie0 ie1
+ do
+ (ifconfig $dev >/dev/null 2>&1) && echo $dev
+ done
+}
+
+md_installboot() {
+ # $1 is the root disk
+ echo -n "Installing boot block..."
+ cd /usr/mdec
+ cp -p ./ufsboot /mnt/ufsboot
+ sync ; sleep 1 ; sync
+ ./installboot /mnt/ufsboot bootxx /dev/r${1}a
+ echo "done."
+}
+
+md_checkfordisklabel() {
+ # $1 is the disk to check
+ disklabel $1 > /dev/null 2> /tmp/checkfordisklabel
+ if grep "no disk label" /tmp/checkfordisklabel; then
+ rval="1"
+ elif grep "disk label corrupted" /tmp/checkfordisklabel; then
+ rval="2"
+ else
+ rval="0"
+ fi
+
+ rm -f /tmp/checkfordisklabel
+}
+
+md_labeldisk() {
+ # $1 is the disk to label
+ disklabel -e $1
+}
+
+# Note, while they might not seem machine-dependent, the
+# welcome banner and the punt message may contain information
+# and/or instructions specific to the type of machine.
+md_welcome_banner() {
+echo "
+Welcome to the OpenBSD/sun3 ${VERSION} installation program.
+" ; cat << \__welcome_banner_1
+
+This program is designed to help you install OpenBSD on your system in a
+simple and rational way. You'll be asked several questions, and it will
+be useful to have the installation notes and a calculator at hand.
+
+As with anything which modifies your disk's contents, this program can
+cause SIGNIFICANT data loss, and you are advised to make sure all your
+disks are backed up before beginning the installation process.
+
+Default answers are displyed in brackets after the questions.
+You can hit Control-C at any time to quit, but if you do so at a
+prompt, you may have to hit return. Also, quitting in the middle of
+installation may leave your system in an inconsistent state.
+
+__welcome_banner_1
+}
+
+md_not_going_to_install() {
+cat << \__not_going_to_install_1
+
+OK, then. Enter 'halt' or 'reboot' at the prompt,
+or proceed with manual installation commands.
+
+__not_going_to_install_1
+}
+
+md_congrats() {
+cat << \__congratulations_1
+
+CONGRATULATIONS! You have successfully installed OpenBSD! To boot the
+installed system, enter 'reboot' at the command prompt.
+
+__congratulations_1
+}
+
+# Note: I don't use the MFS hack. Just remount root instead.
+md_remount() {
+ # Make sure root was remounted (creates /etc/fstab)
+ if [ ! -f /etc/fstab ]
+ then
+ # This is normally done by .profile
+ sh /.remount
+ fi
+}
+
+# end of machine dependent section
+
+getrootdisk() {
+ cat << \__getrootdisk_1
+
+The installation program needs to know which disk will be
+the root disk of the system about to be installed.
+
+Available disks are:
+
+__getrootdisk_1
+ _DKDEVS=`md_get_diskdevs`
+ echo "$_DKDEVS"
+ echo ""
+ echo -n "Which disk is the root disk? "
+ getresp ""
+ if isin $resp $_DKDEVS ; then
+ ROOTDISK="$resp"
+ else
+ echo ""
+ echo "The disk $resp does not exist."
+ ROOTDISK=""
+ fi
+}
+
+labelmoredisks() {
+ cat << \__labelmoredisks_1
+
+You may label the following disks:
+
+__labelmoredisks_1
+ echo "$_DKDEVS"
+ echo ""
+ echo -n "Label which disk? [done] "
+ getresp "done"
+ case "$resp" in
+ "done")
+ ;;
+
+ *)
+ if echo "$_DKDEVS" | grep "^$resp" > /dev/null ; then
+ md_labeldisk $resp
+ else
+ echo ""
+ echo "The disk $resp does not exist."
+ fi
+ ;;
+ esac
+}
+
+addhostent() {
+ # $1 - IP address
+ # $2 - symbolic name
+
+ # Create an entry in the hosts table.
+ # If the IP address already exists, replace it.
+ grep -v "^$1 " /etc/hosts > /tmp/hosts
+ echo "$1 $2 $2.$FQDN" >> /tmp/hosts
+
+ # Use it now.
+ cp /tmp/hosts /etc/hosts
+}
+
+addifconfig() {
+ # $1 - interface name
+ # $2 - interface symbolic name
+ # $3 - interface IP address
+ # $4 - interface netmask
+
+ # Create a hostname.* file for the interface.
+ echo "inet $2 $4" > /tmp/hostname.$1
+
+ addhostent $3 $2
+}
+
+configurenetwork() {
+ cat << \__configurenetwork_1
+
+You may configure the following network interfaces:
+
+__configurenetwork_1
+
+ _IFS=`md_get_ifdevs`
+ echo $_IFS
+ echo ""
+ echo -n "Configure which interface? [done] "
+ getresp "done"
+ case "$resp" in
+ done)
+ ;;
+
+ *)
+ if isin $resp $_IFS ; then
+ _interface_name=$resp
+
+ # Keep in the list in case it's misconfigured
+ # and the user want's to re-do it.
+
+ # Get IP address
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "IP address? "
+ getresp ""
+ _interface_ip=$resp
+ done
+
+ # Get symbolic name
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "Symbolic (host) name? "
+ getresp ""
+ _interface_symname=$resp
+ done
+
+ # Get netmask
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "Netmask? "
+ getresp ""
+ _interface_mask=$resp
+ done
+
+ # Configure the interface. If it
+ # succeeds, add it to the permanent
+ # network configuration info.
+ ifconfig ${_interface_name} down
+ if ifconfig ${_interface_name} inet \
+ ${_interface_ip} \
+ netmask ${_interface_mask} up ; then
+ addifconfig \
+ ${_interface_name} \
+ ${_interface_symname} \
+ ${_interface_ip} \
+ ${_interface_mask}
+ fi
+ else
+ echo ""
+ echo "The interface $resp does not exist."
+ fi
+ ;;
+ esac
+}
+
+install_ftp() {
+ # Get several parameters from the user, and create
+ # a shell script that directs the appropriate
+ # commands into ftp.
+ cat << \__install_ftp_1
+
+This is an automated ftp-based installation process. You will be asked
+several questions. The correct set of commands will be placed in a script
+that will be fed to ftp(1).
+
+__install_ftp_1
+ # Get server IP address
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "Server IP? [${_ftp_server_ip}] "
+ getresp "${_ftp_server_ip}"
+ _ftp_server_ip=$resp
+ done
+
+ # Get server directory
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "Server directory? [${_ftp_server_dir}] "
+ getresp "${_ftp_server_dir}"
+ _ftp_server_dir=$resp
+ done
+
+ # Get login name
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "Login? [${_ftp_server_login}] "
+ getresp "${_ftp_server_login}"
+ _ftp_server_login=$resp
+ done
+
+ # Get password
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "Password? [${_ftp_server_password}] "
+ getresp "${_ftp_server_password}"
+ _ftp_server_password=$resp
+ done
+
+ # Get list of files for mget.
+ cat << \__install_ftp_2
+
+You will now be asked for files to extract. Enter one file at a time.
+When you are done entering files, enter 'done'.
+
+__install_ftp_2
+ echo "#!/bin/sh" > /tmp/ftp-script.sh
+ echo "cd /mnt" >> /tmp/ftp-script.sh
+ echo "ftp -i -n $_ftp_server_ip << \__end_commands" >> \
+ /tmp/ftp-script.sh
+ echo "user $_ftp_server_login $_ftp_server_password" >> \
+ /tmp/ftp-script.sh
+ echo "bin" >> /tmp/ftp-script.sh
+ echo "cd $_ftp_server_dir" >> /tmp/ftp-script.sh
+
+ resp="" # force one interation
+ while [ "X${resp}" != X"done" ]; do
+ echo -n "File? [done] "
+ getresp "done"
+ if [ "X${resp}" = X"done" ]; then
+ break
+ fi
+
+ _ftp_file=`echo ${resp} | awk '{print $1}'`
+ echo "get ${_ftp_file} |\"tar -xzvpf -\"" >> \
+ /tmp/ftp-script.sh
+ done
+
+ echo "quit" >> /tmp/ftp-script.sh
+ echo "__end_commands" >> /tmp/ftp-script.sh
+
+ sh /tmp/ftp-script.sh
+ rm -f /tmp/ftp-script.sh
+ echo "Extraction complete."
+}
+
+install_common_nfs_cdrom() {
+ # $1 - directory containing file
+
+ # Get the name of the file.
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "File name? "
+ getresp ""
+ done
+ _common_filename="/mnt2/$1/$resp"
+
+ # Ensure file exists
+ if [ ! -f $_common_filename ]; then
+ echo "File $_common_filename does not exist. Check to make"
+ echo "sure you entered the information properly."
+ return
+ fi
+
+ # Extract file
+ cat $_common_filename | (cd /mnt; tar -xzvpf -)
+ echo "Extraction complete."
+}
+
+install_cdrom() {
+ # Get the cdrom device info
+ cat << \__install_cdrom_1
+
+The following CD-ROM devices are installed on your system; please select
+the CD-ROM device containing the installation media:
+
+__install_cdrom_1
+ _CDDEVS=`md_get_cddevs`
+ echo "$_CDDEVS"
+ echo ""
+ echo -n "Which is the CD-ROM with the installation media? [abort] "
+ getresp "abort"
+ case "$resp" in
+ abort)
+ echo "Aborting."
+ return
+ ;;
+
+ *)
+ if isin $resp $_CDDEVS ; then
+ _cdrom_drive=$resp
+ else
+ echo ""
+ echo "The CD-ROM $resp does not exist."
+ echo "Aborting."
+ return
+ fi
+ ;;
+ esac
+
+ # Get partition
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "Partition? [c] "
+ getresp "c"
+ case "$resp" in
+ [a-h])
+ _cdrom_partition=$resp
+ ;;
+
+ *)
+ echo "Invalid response: $resp"
+ resp="" # force loop to repeat
+ ;;
+ esac
+ done
+
+ # Ask for filesystem type
+ cat << \__install_cdrom_2
+
+There are two CD-ROM filesystem types currently supported by this program:
+ 1) ISO-9660 (cd9660)
+ 2) Berkeley Fast Filesystem (ffs)
+
+__install_cdrom_2
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "Which filesystem type? [cd9660] "
+ getresp "cd9660"
+ case "$resp" in
+ cd9660|ffs)
+ _cdrom_filesystem=$resp
+ ;;
+
+ *)
+ echo "Invalid response: $resp"
+ resp="" # force loop to repeat
+ ;;
+ esac
+ done
+
+ # Mount the CD-ROM
+ if ! mount -t ${_cdrom_filesystem} -o ro \
+ /dev/${_cdrom_drive}${_cdrom_partition} /mnt2 ; then
+ echo "Cannot mount CD-ROM drive. Aborting."
+ return
+ fi
+
+ # Get the directory where the file lives
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo "Enter the directory relative to the mount point that"
+ echo -n "contains the file. [${_cdrom_directory}] "
+ getresp "${_cdrom_directory}"
+ done
+ _cdrom_directory=$resp
+
+ install_common_nfs_cdrom ${_cdrom_directory}
+ umount -f /mnt2 > /dev/null 2>&1
+}
+
+install_nfs() {
+ # Get the IP address of the server
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "Server IP address? [${_nfs_server_ip}] "
+ getresp "${_nfs_server_ip}"
+ done
+ _nfs_server_ip=$resp
+
+ # Get server path to mount
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "Filesystem on server to mount? [${_nfs_server_path}] "
+ getresp "${_nfs_server_path}"
+ done
+ _nfs_server_path=$resp
+
+ # Determine use of TCP
+ echo -n "Use TCP transport (only works with capable NFS server)? [n] "
+ getresp "n"
+ case "$resp" in
+ y*|Y*)
+ _nfs_tcp="-T"
+ ;;
+
+ *)
+ _nfs_tcp=""
+ ;;
+ esac
+
+ # Mount the server
+ if ! mount_nfs $_nfs_tcp ${_nfs_server_ip}:${_nfs_server_path} \
+ /mnt2 ; then
+ echo "Cannot mount NFS server. Aborting."
+ return
+ fi
+
+ # Get the directory where the file lives
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo "Enter the directory relative to the mount point that"
+ echo -n "contains the file. [${_nfs_directory}] "
+ getresp "${_nfs_directory}"
+ done
+ _nfs_directory=$resp
+
+ install_common_nfs_cdrom ${_nfs_directory}
+ umount -f /mnt2 > /dev/null 2>&1
+}
+
+install_tape() {
+ # Get the name of the tape from the user.
+ cat << \__install_tape_1
+
+The installation program needs to know which tape device to use. Make
+sure you use a "no rewind on close" device.
+
+__install_tape_1
+ _tape=`basename $TAPE`
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "Name of tape device? [${_tape}]"
+ getresp "${_tape}"
+ done
+ _tape=`basename $resp`
+ TAPE="/dev/${_tape}"
+ if [ ! -c $TAPE ]; then
+ echo "$TAPE does not exist or is not a character special file."
+ echo "Aborting."
+ return
+ fi
+ export TAPE
+
+ # Rewind the tape device
+ echo -n "Rewinding tape..."
+ if ! mt rewind ; then
+ echo "$TAPE may not be attached to the system or may not be"
+ echo "a tape device. Aborting."
+ return
+ fi
+ echo "done."
+
+ # Get the file number
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ echo -n "File number? "
+ getresp ""
+ case "$resp" in
+ [1-9]*)
+ _nskip=`expr $resp - 1`
+ ;;
+
+ *)
+ echo "Invalid file number ${resp}."
+ resp="" # fore loop to repeat
+ ;;
+ esac
+ done
+
+ # Skip to correct file.
+ echo -n "Skipping to source file..."
+ if [ "X${_nskip}" != X"0" ]; then
+ if ! mt fsf $_nskip ; then
+ echo "Could not skip $_nskip files. Aborting."
+ return
+ fi
+ fi
+ echo "done."
+
+ cat << \__install_tape_2
+
+There are 2 different ways the file can be stored on tape:
+
+ 1) an image of a gzipped tar file
+ 2) a standard tar image
+
+__install_tape_2
+ resp="" # force one iteration
+ while [ "X${resp}" = X"" ]; do
+ getresp "1"
+ case "$resp" in
+ 1)
+ (
+ cd /mnt
+ dd if=$TAPE | tar -xzvpf -
+ )
+ ;;
+
+ 2)
+ (
+ cd /mnt
+ dd if=$TAPE | tar -xzvpf -
+ )
+ ;;
+
+ *)
+ echo "Invalid response: $resp."
+ resp="" # force loop to repeat
+ ;;
+ esac
+ done
+ echo "Extraction complete."
+}
+
+get_timezone() {
+cat << \__get_timezone_1
+
+Select a time zone:
+
+__get_timezone_1
+ ls /mnt/usr/share/zoneinfo # XXX
+ echo ""
+ if [ X"$TZ" = "X" ]; then
+ TZ=`ls -l /etc/timezone 2>/dev/null | awk -F/ '{print $NF}'`
+ fi
+ echo -n "What timezone are you in [$TZ]? "
+ getresp "$TZ"
+ case "$resp" in
+ "")
+ echo "Timezone defaults to GMT"
+ TZ="GMT"
+ ;;
+ *)
+ TZ="$resp"
+ ;;
+ esac
+ export TZ
+}
+
+#
+# End of functions.
+# Begin working
+#
+
+# Good {morning,afternoon,evening,night}.
+md_welcome_banner
+echo -n "Proceed with installation? [n] "
+getresp "n"
+case "$resp" in
+ y*|Y*)
+ echo "Cool! Let's get to it..."
+ ;;
+ *)
+ md_not_going_to_install
+ exit
+ ;;
+esac
+
+# Make our root read/write (or at least parts of it).
+md_remount
+
+while [ "X${ROOTDISK}" = "X" ]; do
+ getrootdisk
+done
+
+# Make sure there's a disklabel there. If there isn't, puke after
+# disklabel prints the error message.
+md_checkfordisklabel ${ROOTDISK}
+case "$resp" in
+ 1)
+ cat << \__disklabel_not_present_1
+
+FATAL ERROR: There is no disklabel present on the root disk! You must
+label the disk using the RAMDISK kernel before continuing.
+
+__disklabel_not_present_1
+ exit
+ ;;
+
+ 2)
+ cat << \__disklabel_corrupted_1
+
+FATAL ERROR: The disklabel on the root disk is corrupted! You must
+re-label the disk using the RAMDISK kernel before continuing.
+
+__disklabel_corrupted_1
+ exit
+ ;;
+
+ *)
+ ;;
+esac
+
+# Give the user the opportinuty to edit the root disklabel.
+cat << \__disklabel_notice_1
+
+You have already placed a disklabel onto the target root disk.
+However, due to the limitations of the standalone program used
+you may want to edit that label to change partition type information.
+You will be given the opporunity to do that now. Note that you may
+not change the size or location of any presently open partition.
+
+__disklabel_notice_1
+echo -n "Do you wish to edit the root disklabel? [y] "
+getresp "y"
+case "$resp" in
+ y*|Y*)
+ disklabel -e ${ROOTDISK}
+ ;;
+
+ *)
+ ;;
+esac
+
+cat << \__disklabel_notice_2
+
+You will now be given the opportunity to place disklabels on any additional
+disks on your system.
+__disklabel_notice_2
+
+_DKDEVS=`rmel ${ROOTDISK} ${_DKDEVS}`
+resp="X" # force at least one iteration
+while [ "X$resp" != X"done" ]; do
+ labelmoredisks
+done
+
+# Assume partition 'a' of $ROOTDISK is for the root filesystem. Loop and
+# get the rest.
+# XXX ASSUMES THAT THE USER DOESN'T PROVIDE BOGUS INPUT.
+cat << \__get_filesystems_1
+
+You will now have the opportunity to enter filesystem information.
+You will be prompted for device name and mount point (full path,
+including the leading '/' character).
+
+Note that these do not have to be in any particular order. You will
+be given the opportunity to edit the resulting 'fstab' file before
+any of the filesystems are mounted. At that time you will be able
+to resolve any filesystem order dependencies.
+
+__get_filesystems_1
+
+echo "The following will be used for the root filesystem:"
+echo " ${ROOTDISK}a /"
+
+echo "${ROOTDISK}a /" > ${FILESYSTEMS}
+
+resp="X" # force at least one iteration
+while [ "X$resp" != X"done" ]; do
+ echo ""
+ echo -n "Device name? [done] "
+ getresp "done"
+ case "$resp" in
+ done)
+ ;;
+
+ *)
+ _device_name=`basename $resp`
+
+ # force at least one iteration
+ _first_char="X"
+ while [ "X${_first_char}" != X"/" ]; do
+ echo -n "Mount point? "
+ getresp ""
+ _mount_point=$resp
+ if [ "X${_mount_point}" = X"/" ]; then
+ # Invalid response; no multiple roots
+ _first_char="X"
+ else
+ _first_char=`echo ${_mount_point} | \
+ cut -c 1`
+ fi
+ done
+ echo "${_device_name} ${_mount_point}" >> \
+ ${FILESYSTEMS}
+ resp="X" # force loop to repeat
+ ;;
+ esac
+done
+
+echo ""
+echo "You have configured the following devices and mount points:"
+echo ""
+cat ${FILESYSTEMS}
+echo ""
+echo "Filesystems will now be created on these devices. If you made any"
+echo -n "mistakes, you may edit this now. Edit? [n] "
+getresp "n"
+case "$resp" in
+ y*|Y*)
+ vi ${FILESYSTEMS}
+ ;;
+ *)
+ ;;
+esac
+
+# Loop though the file, place filesystems on each device.
+while read dev mnt
+do
+ echo -n "Create filesystem on $dev? [y] "
+ getresp "n" < /dev/tty
+ case "$resp" in
+ y*|Y*)
+ newfs /dev/r${dev}
+ ;;
+ *)
+ echo "skipped $dev"
+ ;;
+ esac
+done < ${FILESYSTEMS}
+
+# Get network configuration information, and store it for placement in the
+# root filesystem later.
+cat << \__network_config_1
+You will now be given the opportunity to configure the network. This will
+be useful if you need to transfer the installation sets via FTP or NFS.
+Even if you choose not to transfer installation sets that way, this
+information will be preserved and copied into the new root filesystem.
+
+Note, enter all symbolic host names WITHOUT the domain name appended.
+I.e. use 'hostname' NOT 'hostname.domain.name'.
+
+__network_config_1
+echo -n "Configure the network? [y] "
+getresp "y"
+case "$resp" in
+ y*|Y*)
+ echo -n "Enter system hostname: "
+ resp="" # force at least one iteration
+ while [ "X${resp}" = X"" ]; do
+ getresp ""
+ done
+ hostname $resp
+ echo $resp > /tmp/myname
+
+ echo -n "Enter DNS domain name: "
+ resp="" # force at least one iteration
+ while [ "X${resp}" = X"" ]; do
+ getresp ""
+ done
+ FQDN=$resp
+
+ resp="" # force at least one iteration
+ while [ "X${resp}" != X"done" ]; do
+ configurenetwork
+ done
+
+ echo -n "Enter IP address of default route: [none] "
+ getresp "none"
+ if [ "X${resp}" != X"none" ]; then
+ route delete default > /dev/null 2>&1
+ if route add default $resp > /dev/null ; then
+ echo $resp > /tmp/mygate
+ fi
+ fi
+
+ echo -n "Enter IP address of primary nameserver: [none] "
+ getresp "none"
+ if [ "X${resp}" != X"none" ]; then
+ echo "domain $FQDN" > /tmp/resolv.conf
+ echo "nameserver $resp" >> /tmp/resolv.conf
+ echo "search $FQDN" >> /tmp/resolv.conf
+
+ echo -n "Would you like to use the nameserver now? [y] "
+ getresp "y"
+ case "$resp" in
+ y*|Y*)
+ cp /tmp/resolv.conf \
+ /etc/resolv.conf
+ ;;
+
+ *)
+ ;;
+ esac
+ fi
+
+ echo ""
+ echo "The host table is as follows:"
+ echo ""
+ cat /etc/hosts
+ echo ""
+ echo "You may want to edit the host table in the event that"
+ echo "you need to mount an NFS server."
+ echo -n "Would you like to edit the host table? [n] "
+ getresp "n"
+ case "$resp" in
+ y*|Y*)
+ vi /etc/hosts
+ ;;
+
+ *)
+ ;;
+ esac
+
+ cat << \__network_config_2
+
+You will now be given the opportunity to escape to the command shell to
+do any additional network configuration you may need. This may include
+adding additional routes, if needed. In addition, you might take this
+opportunity to redo the default route in the event that it failed above.
+If you do change the default route, and wish for that change to carry over
+to the installed system, execute the following command at the shell
+prompt:
+
+ echo <ip_address_of_gateway> > /tmp/mygate
+
+where <ip_address_of_gateway> is the IP address of the default router.
+
+__network_config_2
+ echo -n "Escape to shell? [n] "
+ getresp "n"
+ case "$resp" in
+ y*|Y*)
+ echo "Type 'exit' to return to install."
+ sh
+ ;;
+
+ *)
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+esac
+
+# Now that the network has been configured, it is safe to configure the
+# fstab.
+awk '{
+ if ($2 == "/")
+ printf("/dev/%s %s ffs rw 1 1\n", $1, $2)
+ else
+ printf("/dev/%s %s ffs rw 1 2\n", $1, $2)
+}' < ${FILESYSTEMS} > /tmp/fstab
+
+echo "The fstab is configured as follows:"
+echo ""
+cat /tmp/fstab
+cat << \__fstab_config_1
+
+You may wish to edit the fstab. For example, you may need to resolve
+dependencies in the order which the filesystems are mounted. You may
+also wish to take this opportunity to place NFS mounts in the fstab.
+This would be especially useful if you plan to keep '/usr' on an NFS
+server.
+
+__fstab_config_1
+echo -n "Edit the fstab? [n] "
+getresp "n"
+case "$resp" in
+ y*|Y*)
+ vi /tmp/fstab
+ ;;
+
+ *)
+ ;;
+esac
+
+# Now that the 'real' fstab is configured, create a temporary fstab
+# which we'll use for mounting and unmounting all of the target
+# filesystems relative to /mnt. Save the original (our root).
+[ -f /etc/fstab.save ] || cp /etc/fstab /etc/fstab.save
+cp /etc/fstab.save /etc/fstab
+awk '{
+ if ($2 == "/")
+ printf("%s /mnt %s %s %s %s\n", $1, $3, $4, $5, $6)
+ else
+ printf("%s /mnt%s %s %s %s %s\n", $1, $2, $3, $4, $5, $6)
+}' < /tmp/fstab >> /etc/fstab
+
+echo ""
+
+# Must mount filesystems manually, one at a time, so we can make sure the
+# mount points exist.
+(
+ while read _dev _mp _fstype _opt junk
+ do
+ # If not the root filesystem, make sure the mount
+ # point is present.
+ if [ "X${_mp}" != X"/mnt" ]; then
+ mkdir -p $_mp
+ fi
+
+ # Mount the filesystem. If the mount fails, exit
+ # with an error condition to tell the outer
+ # layer to bail.
+ if ! mount -v -t $_fstype -o $_opt $_dev $_mp ; then
+ # error message displayed by mount
+ exit 1
+ fi
+ done
+) < /etc/fstab
+
+if [ "X${?}" != X"0" ]; then
+ cat << \__mount_filesystems_1
+
+FATAL ERROR: Cannot mount filesystems. Double-check your configuration
+and restart the installation process.
+
+__mount_filesystems_1
+ exit
+fi
+
+# Ask the user which media to load the distribution from.
+cat << \__install_sets_1
+
+It is now time to extract the installation sets onto the disk.
+Make sure The sets are either on a local device (i.e. tape, CD-ROM)
+or on a network server.
+
+__install_sets_1
+if [ -f /base.tar.gz ]; then
+ echo -n "Install from sets in the current root filesystem? [y] "
+ getresp "y"
+ case "$resp" in
+ y*|Y*)
+ for _f in /*.tar.gz; do
+ echo -n "Install $_f ? [y]"
+ getresp "y"
+ case "$resp" in
+ y*|Y*)
+ cat $_f | (cd /mnt; tar -xzvpf -)
+ _yup="TRUE"
+ ;;
+ *)
+ ;;
+ esac
+ echo "Extraction complete."
+ done
+ ;;
+ *)
+ _yup="FALSE"
+ ;;
+ esac
+else
+ _yup="FALSE"
+fi
+
+# Go on prodding for alternate locations
+resp="" # force at least one iteration
+while [ "X${resp}" = X"" ]; do
+ # If _yup is not FALSE, it means that we extracted sets above.
+ # If that's the case, bypass the menu the first time.
+ if [ X"$_yup" = X"FALSE" ]; then
+ echo -n "Install from (f)tp, (t)ape, (C)D-ROM, or (N)FS? [f] "
+ getresp "f"
+ case "$resp" in
+ f*|F*)
+ install_ftp
+ ;;
+
+ t*|T*)
+ install_tape
+ ;;
+
+ c*|C*)
+ install_cdrom
+ ;;
+
+ n*|N*)
+ install_nfs
+ ;;
+
+ *)
+ echo "Invalid response: $resp"
+ resp=""
+ ;;
+ esac
+ else
+ _yup="FALSE" # So we'll ask next time
+ fi
+
+ # Give the user the opportunity to extract more sets. They don't
+ # necessarily have to come from the same media.
+ echo ""
+ echo -n "Extract more sets? [n] "
+ getresp "n"
+ case "$resp" in
+ y*|Y*)
+ # Force loop to repeat
+ resp=""
+ ;;
+
+ *)
+ ;;
+ esac
+done
+
+# Get timezone info
+get_timezone
+
+# Copy in configuration information and make devices in target root.
+(
+ cd /tmp
+ cp /etc/hosts hosts
+ for file in fstab hostname.* hosts myname mygate resolv.conf; do
+ if [ -f $file ]; then
+ echo -n "Copying $file..."
+ cp $file /mnt/etc/$file
+ echo "done."
+ fi
+ done
+
+ echo -n "Installing timezone link..."
+ rm -f /mnt/etc/localtime
+ ln -s /usr/share/zoneinfo/$TZ /mnt/etc/localtime
+ echo "done."
+
+ echo -n "Making devices..."
+ pid=`twiddle`
+ cd /mnt/dev
+ sh MAKEDEV all
+ kill $pid
+ echo "done."
+
+ echo -n "Copying kernel..."
+ cp /bsd /mnt/bsd
+ echo "done."
+
+ md_installboot ${ROOTDISK}
+)
+
+# Unmount all filesystems and check their integrity.
+echo -n "Syncing disks..."
+pid=`twiddle`
+sync; sleep 4; sync; sleep 2; sync; sleep 2
+kill $pid
+echo "done."
+
+echo "Unmounting filesystems..."
+umount -va
+
+echo "Checking filesystem integrity..."
+fsck -pf
+
+# Pat on the back.
+md_congrats
+
+# ALL DONE!
+exit 0
diff --git a/distrib/mvme68k/common/mini_bin.list b/distrib/mvme68k/common/mini_bin.list
new file mode 100644
index 00000000000..a234f07665d
--- /dev/null
+++ b/distrib/mvme68k/common/mini_bin.list
@@ -0,0 +1,40 @@
+#
+# $NetBSD: mini_bin.list,v 1.2 1995/11/21 21:18:56 gwr Exp $
+#
+
+# miniroot files from /bin:
+
+# Note: /bin/rcp is handled in mini_usr.list (crunched with rsh)
+# Everything else here is just copied from ${DESTDIR}
+
+COPY ${DESTDIR}/bin/cat bin
+COPY ${DESTDIR}/bin/chmod bin
+COPY ${DESTDIR}/bin/cp bin
+COPY ${DESTDIR}/bin/date bin
+COPY ${DESTDIR}/bin/dd bin
+COPY ${DESTDIR}/bin/df bin
+COPY ${DESTDIR}/bin/echo bin
+COPY ${DESTDIR}/bin/ed bin
+COPY ${DESTDIR}/bin/expr bin
+COPY ${DESTDIR}/bin/hostname bin
+COPY ${DESTDIR}/bin/kill bin
+COPY ${DESTDIR}/bin/ln bin
+COPY ${DESTDIR}/bin/ls bin
+COPY ${DESTDIR}/bin/mkdir bin
+COPY ${DESTDIR}/bin/mt bin
+COPY ${DESTDIR}/bin/mv bin
+COPY ${DESTDIR}/bin/pax bin
+COPY ${DESTDIR}/bin/ps bin
+COPY ${DESTDIR}/bin/pwd bin
+# COPY ${DESTDIR}/bin/rcp # See mini_usr.list
+COPY ${DESTDIR}/bin/rm bin
+
+COPY ${DESTDIR}/bin/rmdir bin
+COPY ${DESTDIR}/bin/sh bin
+COPY ${DESTDIR}/bin/sleep bin
+COPY ${DESTDIR}/bin/stty bin
+COPY ${DESTDIR}/bin/sync bin
+
+COPY ${DESTDIR}/bin/test bin
+LINK bin/test bin/[
+
diff --git a/distrib/mvme68k/common/mini_sbin.list b/distrib/mvme68k/common/mini_sbin.list
new file mode 100644
index 00000000000..53b768169ab
--- /dev/null
+++ b/distrib/mvme68k/common/mini_sbin.list
@@ -0,0 +1,39 @@
+#
+# $NetBSD: mini_sbin.list,v 1.2 1995/11/21 21:18:57 gwr Exp $
+#
+
+# XXX - Need these? ping,
+
+# miniroot files from /sbin:
+
+COPY ${DESTDIR}/sbin/disklabel sbin
+COPY ${DESTDIR}/sbin/dmesg sbin
+
+COPY ${DESTDIR}/sbin/edlabel sbin
+
+COPY ${DESTDIR}/sbin/fsck sbin
+COPY ${DESTDIR}/sbin/ifconfig sbin
+COPY ${DESTDIR}/sbin/init sbin
+COPY ${DESTDIR}/sbin/mknod sbin
+
+COPY ${DESTDIR}/sbin/mount sbin
+COPY ${DESTDIR}/sbin/mount_cd9660 sbin
+COPY ${DESTDIR}/sbin/mount_ffs sbin
+LINK sbin/mount_ffs sbin/mount_ufs
+
+COPY ${DESTDIR}/sbin/mount_kernfs sbin
+COPY ${DESTDIR}/sbin/mount_nfs sbin
+COPY ${DESTDIR}/sbin/newfs sbin
+COPY ${DESTDIR}/sbin/ping sbin
+COPY ${DESTDIR}/sbin/reboot sbin
+LINK sbin/reboot sbin/halt
+
+COPY ${DESTDIR}/sbin/restore sbin
+LINK sbin/restore sbin/rrestore
+
+COPY ${DESTDIR}/sbin/route sbin
+COPY ${DESTDIR}/sbin/shutdown sbin
+COPY ${DESTDIR}/sbin/slattach sbin
+COPY ${DESTDIR}/sbin/swapon sbin
+COPY ${DESTDIR}/sbin/umount sbin
+
diff --git a/distrib/mvme68k/common/mini_usr.conf b/distrib/mvme68k/common/mini_usr.conf
new file mode 100644
index 00000000000..19d71c28dc3
--- /dev/null
+++ b/distrib/mvme68k/common/mini_usr.conf
@@ -0,0 +1,30 @@
+#
+# $NetBSD: mini_usr.conf,v 1.2.6.1 1996/08/29 03:12:10 gwr Exp $
+#
+# common/mini_usr.conf
+#
+# The only real purpose of this crunched binary is to
+# provide statically linked versions of some programs
+# that would normally reside in usr/bin or usr/sbin.
+# A few related ones are thrown in to save space:
+# chgrp, rcp
+#
+# Many others were kept separate, somewhat arbitrarily,
+# but mostly things that are somewhat large, or that are
+# normally used separately, or have weird make rules...
+
+srcdirs bin
+progs rcp
+
+srcdirs usr.sbin
+progs bad144 chown chroot eeprom rdate update
+
+srcdirs usr.bin
+progs basename chflags cksum cmp cut ftp
+progs rsh sed strings tftp
+
+srcdirs gnu/usr.bin
+progs sort
+
+ln chown chgrp
+
diff --git a/distrib/mvme68k/common/mini_usr.list b/distrib/mvme68k/common/mini_usr.list
new file mode 100644
index 00000000000..1c3a2e6b417
--- /dev/null
+++ b/distrib/mvme68k/common/mini_usr.list
@@ -0,0 +1,38 @@
+#
+# $NetBSD: mini_usr.list,v 1.2.6.1 1996/08/29 03:12:45 gwr Exp $
+#
+
+# copy the crunched binary, link to it, and kill it
+
+COPY ${OBJDIR}/mini_usr mini_usr
+
+# Note: On the miniroot, /usr is part of the root fs,
+# so we can just make a link for /bin/rcp
+LINK mini_usr bin/rcp
+
+# usr/sbin:
+
+LINK mini_usr usr/sbin/bad144
+LINK mini_usr usr/sbin/chown
+LINK mini_usr usr/sbin/chroot
+LINK mini_usr usr/sbin/eeprom
+LINK mini_usr usr/sbin/rdate
+LINK mini_usr usr/sbin/update
+
+# usr/bin:
+
+LINK mini_usr usr/bin/basename
+LINK mini_usr usr/bin/chflags
+LINK mini_usr usr/bin/chgrp
+LINK mini_usr usr/bin/cksum
+LINK mini_usr usr/bin/cmp
+LINK mini_usr usr/bin/cut
+LINK mini_usr usr/bin/ftp
+LINK mini_usr usr/bin/rsh
+LINK mini_usr usr/bin/sed
+LINK mini_usr usr/bin/sort
+LINK mini_usr usr/bin/strings
+LINK mini_usr usr/bin/tftp
+
+SPECIAL rm mini_usr
+
diff --git a/distrib/mvme68k/common/mini_xx.list b/distrib/mvme68k/common/mini_xx.list
new file mode 100644
index 00000000000..5e893891123
--- /dev/null
+++ b/distrib/mvme68k/common/mini_xx.list
@@ -0,0 +1,26 @@
+#
+# $NetBSD: mini_xx.list,v 1.1.6.1 1996/08/29 03:14:53 gwr Exp $
+# Build -static versions of some programs.
+#
+
+# These were re-linked with -static locally:
+
+COPY ${OBJDIR}/grep usr/bin
+LINK usr/bin/grep usr/bin/egrep
+LINK usr/bin/grep usr/bin/fgrep
+
+COPY ${OBJDIR}/less usr/bin
+LINK usr/bin/less usr/bin/more
+
+COPY ${OBJDIR}/tip usr/bin
+
+COPY ${OBJDIR}/vi usr/bin
+
+# These are normally -static so just copy:
+
+COPY ${DESTDIR}/usr/bin/tar usr/bin
+
+COPY ${DESTDIR}/usr/bin/gzip usr/bin
+LINK usr/bin/gzip usr/bin/gunzip
+LINK usr/bin/gzip usr/bin/gzcat
+
diff --git a/distrib/mvme68k/common/mini_xx.mk b/distrib/mvme68k/common/mini_xx.mk
new file mode 100644
index 00000000000..6d430d07737
--- /dev/null
+++ b/distrib/mvme68k/common/mini_xx.mk
@@ -0,0 +1,30 @@
+#
+# $NetBSD: mini_xx.mk,v 1.1.6.1 1996/08/29 03:17:15 gwr Exp $
+# Hacks for re-linking some programs -static
+#
+
+MINI_XX = grep less tip vi
+mini_xx : ${MINI_XX}
+
+clean_xx:
+ -rm -f ${MINI_XX}
+
+grep :
+ cd ${BSDSRCDIR}/gnu/usr.bin/grep ;\
+ $(MAKE) -f Makefile -f ${TOP}/common/Make.static \
+ OUTDIR=${.CURDIR} ${.CURDIR}/grep
+
+less :
+ cd ${BSDSRCDIR}/usr.bin/less/less ;\
+ $(MAKE) -f Makefile -f ${TOP}/common/Make.static \
+ OUTDIR=${.CURDIR} ${.CURDIR}/less
+
+tip :
+ cd ${BSDSRCDIR}/usr.bin/tip ;\
+ $(MAKE) -f Makefile -f ${TOP}/common/Make.static \
+ OUTDIR=${.CURDIR} ${.CURDIR}/tip
+
+vi :
+ cd ${BSDSRCDIR}/usr.bin/vi/build ;\
+ $(MAKE) -f Makefile -f ${TOP}/common/Make.static \
+ OUTDIR=${.CURDIR} ${.CURDIR}/vi
diff --git a/distrib/mvme68k/common/miniroot.list b/distrib/mvme68k/common/miniroot.list
new file mode 100644
index 00000000000..2b6e7f42114
--- /dev/null
+++ b/distrib/mvme68k/common/miniroot.list
@@ -0,0 +1,47 @@
+# $NetBSD: miniroot.list,v 1.2.6.1 1996/08/29 03:19:32 gwr Exp $
+
+# These are scripts:
+COPY ${DESTDIR}/usr/bin/false bin
+COPY ${DESTDIR}/usr/bin/true bin
+
+# From usr/mdec:
+COPY ${DESTDIR}/usr/mdec/bootxx usr/mdec
+COPY ${DESTDIR}/usr/mdec/installboot usr/mdec
+COPY ${DESTDIR}/usr/mdec/netboot usr/mdec
+COPY ${DESTDIR}/usr/mdec/tapeboot usr/mdec
+COPY ${DESTDIR}/usr/mdec/ufsboot usr/mdec
+LINK usr/mdec/ufsboot ufsboot
+
+# various files that we need in /etc for the install
+COPY ${DESTDIR}/etc/group etc
+COPY ${DESTDIR}/etc/master.passwd etc
+COPY ${DESTDIR}/etc/passwd etc
+COPY ${DESTDIR}/etc/protocols etc
+COPY ${DESTDIR}/etc/pwd.db etc
+COPY ${DESTDIR}/etc/services etc
+COPY ${DESTDIR}/etc/spwd.db etc
+
+# some /etc files get special handling (for MFS /tmp yuck)
+COPY ${DESTDIR}/etc/disktab etc/disktab.shadow
+SYMLINK /tmp/disktab.shadow etc/disktab
+SYMLINK /tmp/fstab.shadow etc/fstab
+SYMLINK /tmp/resolv.conf.shadow etc/resolv.conf
+SYMLINK /tmp/hosts etc/hosts
+
+# copy the MAKEDEV script and make some devices
+COPY ${DESTDIR}/dev/MAKEDEV dev
+COPY ${DESTDIR}/dev/MAKEDEV.local dev
+SPECIAL cd dev; sh MAKEDEV all
+
+# copy the miniroot installation tools
+COPY ${TOPDIR}/common/mr.profile .profile
+COPY ${TOPDIR}/common/mr.termcap usr/share/misc/termcap
+
+COPY ${TOPDIR}/common/install.md install.md
+COPY ${OBJDIR}/install.sub install.sub
+SPECIAL chmod 644 install.md install.sub
+
+COPY ${TOPDIR}/../miniroot/install.sh install
+COPY ${TOPDIR}/../miniroot/upgrade.sh upgrade
+SPECIAL chmod 755 install upgrade
+
diff --git a/distrib/mvme68k/common/miniroot.tree b/distrib/mvme68k/common/miniroot.tree
new file mode 100644
index 00000000000..beb75ee2027
--- /dev/null
+++ b/distrib/mvme68k/common/miniroot.tree
@@ -0,0 +1,101 @@
+#
+# $NetBSD: miniroot.tree,v 1.2.6.1 1996/08/29 03:20:18 gwr Exp $
+#
+
+/set type=dir uname=root gname=wheel mode=0755
+# .
+.
+
+# ./bin
+bin
+# ./bin
+..
+
+# ./dev
+dev
+# ./dev
+..
+
+# ./etc
+etc
+# ./etc
+..
+
+# ./kern
+kern
+# ./kern
+..
+
+# ./mnt
+mnt
+# ./mnt
+..
+
+# ./mnt2
+mnt2
+# ./mnt2
+..
+
+# ./proc
+proc
+# ./proc
+..
+
+# ./sbin
+sbin
+# ./sbin
+..
+
+# ./tmp
+tmp
+# ./tmp
+..
+
+# ./usr
+usr
+
+# ./usr/bin
+bin
+# ./usr/bin
+..
+
+# ./usr/mdec
+mdec
+# ./usr/mdec
+..
+
+# ./usr/sbin
+sbin
+# ./usr/sbin
+..
+
+# ./usr/share
+share
+
+# ./usr/share/misc
+misc
+# ./usr/share/misc
+..
+
+# ./usr/share
+..
+
+# ./usr
+..
+
+# ./var
+var
+
+# ./var/tmp
+tmp mode=01777
+
+# ./var/tmp/vi.recover
+vi.recover mode=01777
+# ./var/tmp/vi.recover
+..
+
+# ./var/tmp
+..
+
+# ./var
+..
diff --git a/distrib/mvme68k/common/mr.disktab b/distrib/mvme68k/common/mr.disktab
new file mode 100644
index 00000000000..91768474fad
--- /dev/null
+++ b/distrib/mvme68k/common/mr.disktab
@@ -0,0 +1,32 @@
+#
+# $NetBSD: mr.disktab,v 1.1.1.1 1995/10/08 23:07:47 gwr Exp $
+#
+# Disk geometry and partition layout tables.
+# Key:
+# dt controller type
+# ty type of disk (fixed, removeable, simulated)
+# d[0-4] drive-type-dependent parameters
+# ns #sectors/track
+# nt #tracks/cylinder
+# nc #cylinders/disk
+# sc #sectors/cylinder, nc*nt default
+# su #sectors/unit, sc*nc default
+# se sector size, DEV_BSIZE default
+# rm rpm, 3600 default
+# sf supports bad144-style bad sector forwarding
+# sk sector skew per track, default 0
+# cs sector skew per cylinder, default 0
+# hs headswitch time, default 0
+# ts one-cylinder seek time, default 0
+# il sector interleave (n:1), 1 default
+# bs boot block size, default BBSIZE
+# sb superblock size, default SBSIZE
+# o[a-h] partition offsets in sectors
+# p[a-h] partition sizes in sectors
+# b[a-h] partition block sizes in bytes
+# f[a-h] partition fragment sizes in bytes
+# t[a-h] partition types (filesystem, swap, etc)
+#
+# All partition sizes reserve space for bad sector tables.
+# (5 cylinders needed for maintenance + replacement sectors)
+#
diff --git a/distrib/mvme68k/common/mr.etc.rc b/distrib/mvme68k/common/mr.etc.rc
new file mode 100644
index 00000000000..272302f54b3
--- /dev/null
+++ b/distrib/mvme68k/common/mr.etc.rc
@@ -0,0 +1,9 @@
+#!/bin/sh
+# $NetBSD: mr.etc.rc,v 1.2 1995/10/13 16:38:27 gwr Exp $
+
+# This is run by /sbin/init as:
+# /bin/sh /etc/rc
+# Just force init to go single-user...
+
+echo "/etc/rc: miniroot forces single-user mode..."
+exit 1
diff --git a/distrib/mvme68k/common/mr.profile b/distrib/mvme68k/common/mr.profile
new file mode 100644
index 00000000000..87f94f9897a
--- /dev/null
+++ b/distrib/mvme68k/common/mr.profile
@@ -0,0 +1,55 @@
+#
+# $NetBSD: mr.profile,v 1.2.6.1 1996/08/29 03:21:13 gwr Exp $
+#
+# Copyright (c) 1995 Jason R. Thorpe
+# Copyright (c) 1994 Christopher G. Demetriou
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by Christopher G. Demetriou.
+# 4. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:/
+export PATH
+TERM=ansi
+export TERM
+
+umask 022
+
+# set up some sane defaults
+echo intr '^C' kill '^U' erase '^?' werase '^W' newcrt
+stty intr '^C' kill '^U' erase '^?' werase '^W' newcrt
+
+# run update, so that installed software is written as it goes.
+update
+
+# get the terminal type?
+# (nah, ansi is good enough)
+
+# run the installation script.
+echo 'To install NetBSD, enter the command: install'
+echo 'Otherwise, enter the command: halt'
+# /install XXX - Not yet...
+
diff --git a/distrib/mvme68k/common/mr.remount b/distrib/mvme68k/common/mr.remount
new file mode 100644
index 00000000000..1cb747484da
--- /dev/null
+++ b/distrib/mvme68k/common/mr.remount
@@ -0,0 +1,34 @@
+#!/bin/sh
+# $NetBSD: mr.remount,v 1.1 1995/11/01 23:53:29 gwr Exp $
+#
+# Find out what the root is mounted on,
+# remount the root read/write, then
+# create a valid /etc/fstab for it.
+#
+# Uses: dmesg, grep, mount
+
+# Given a sequence of lines like: "root on sd0b"
+# print the last part of the last line: "sd0b"
+findroot() {
+ name='??'
+ while read a b c d
+ do
+ name="$c"
+ done
+ echo "$name"
+}
+
+if [ -f /etc/fstab ]
+then
+ echo "root already mounted read/write"
+ exit 1
+fi
+
+echo "Determining current root device..."
+root=`/sbin/dmesg |grep '^root on ' |findroot`
+
+echo "Remounting root device $root"
+/sbin/mount -u "/dev/$root" /
+
+echo "/dev/$root / ufs rw 1 1" > /etc/fstab
+exit 0
diff --git a/distrib/mvme68k/common/mr.termcap b/distrib/mvme68k/common/mr.termcap
new file mode 100644
index 00000000000..360e98bcfc7
--- /dev/null
+++ b/distrib/mvme68k/common/mr.termcap
@@ -0,0 +1,91 @@
+#
+# $NetBSD: mr.termcap,v 1.1.1.1 1995/10/08 23:07:47 gwr Exp $
+#
+
+#
+# Customized for installation on Sun machines.
+#
+
+dumb:\
+ :am:\
+ :co#80:\
+ :bl=^G:cr=^M:do=^J:sf=^J:
+unknown:\
+ :gn:\
+ :tc=dumb:
+other|none of the above, but not exactly unknown:\
+ :am:gn:\
+ :co#80:\
+ :cl=^M^J:do=^J:ho=^M:
+
+arpanet|bussiplexer|dialup|ethernet|network|net|patch|plugboard|switch|network switch or dialup:\
+ :tc=unknown:
+lpr|printer|print|printing|line printer:\
+ :hc:os:\
+ :co#132:li#66:\
+ :bl=^G:cr=^M:do=^J:ff=^L:le=^H:sf=^J:
+
+#### ANSI terminals and terminal emulators
+#
+# See near the end of this file for details on ANSI conformance.
+# Don't mess with these entries! Lots of other entries depend on them!
+#
+
+# (ansi: changed ":pt:" to ":it#8:" -- esr)
+ansi|any ansi terminal with pessimistic assumptions:\
+ :am:bs:\
+ :co#80:it#8:li#24:\
+ :ce=\E[K:cl=\E[;H\E[2J:cm=\E[%i%d;%dH:do=\E[B:\
+ :ho=\E[H:le=\E[D:nd=\E[C:up=\E[A:
+#
+vt100|dec-vt100|vt100-am|vt100am|dec vt100:\
+ :bl=^G:cr=^M:it#8:\
+ :do=^J:co#80:li#24:cl=50\E[;H\E[2J:sf=2*\ED:\
+ :le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:cb=3\E[1K:\
+ :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
+ :md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H:\
+ :if=/usr/share/tabset/vt100:\
+ :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\
+ :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
+ :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=2*\EM:vt#3:xn:\
+ :sc=\E7:rc=\E8:cs=\E[%i%d;%dr:
+#
+sun|Sun Microsystems Workstation console:\
+ :am:bs:km:mi:ms:pt:\
+ :co#80:it#8:li#34:\
+ :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:IC=\E[%d@:al=\E[L:\
+ :bl=^G:cd=\E[J:ce=\E[K:cl=^L:cm=\E[%i%d;%dH:cr=^M:\
+ :dc=\E[P:dl=\E[M:do=\E[B:ei=:ic=\E[@:im=:is=\E[1r:\
+ :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kd=\E[B:kh=\E[H:\
+ :kl=\E[D:kr=\E[C:ku=\E[A:le=^H:nd=\E[C:rs=\E[1r:\
+ :se=\E[m:sf=^J:so=\E[7m:ta=^I:up=\E[A:
+#
+xterm|vs100|xterm terminal emulator (X11R6 Window System):\
+ :am:bs:km:mi:ms:pt:xn:xo:\
+ :co#80:it#8:li#65:\
+ :@7=\E[[:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:F1=\E[23~:\
+ :F2=\E[24~:IC=\E[%d@:LE=\E[%dD:UP=\E[%dA:\
+ :ac=++\054\054..00II--``aaffgghhjjkkllmmnnooqqssttuuvvwwxx~~:\
+ :ae=\E(B:al=\E[L:as=\E(0:bl=^G:cd=\E[J:ce=\E[K:\
+ :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\
+ :ct=\E[3k:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:ho=\E[H:\
+ :ic=\E[@:im=\E[4h:\
+ :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l:\
+ :k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\
+ :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\
+ :kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=^H:kd=\EOB:\
+ :ke=\E[?1l\E>:kh=\E[@:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\
+ :ku=\EOA:le=^H:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:\
+ :r2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<:\
+ :rc=\E8:sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:ta=^I:\
+ :te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:u6=\E[%d;%dR:\
+ :u7=\E[6n:u8=\E[?1;2c:u9=\E[c:ue=\E[m:up=\E[A:\
+ :us=\E[4m:
+xterm24|vs100-24|xterm terminal emulator (24 lines) (X11R6 window system):\
+ :co#80:li#24:\
+ :tc=xterm:
+xterm25|vs100-25|xterm terminal emulator (25 lines) (X11R6 window system):\
+ :co#80:li#24:\
+ :tc=xterm:
+xterms|vs100s|xterm terminal emulator (small) (X11R6 window system):\
+ :tc=xterm24:
diff --git a/distrib/mvme68k/common/ramdisk.list b/distrib/mvme68k/common/ramdisk.list
new file mode 100644
index 00000000000..3d8e29ec80a
--- /dev/null
+++ b/distrib/mvme68k/common/ramdisk.list
@@ -0,0 +1,21 @@
+# $NetBSD: ramdisk.list,v 1.1.1.1 1995/10/08 23:07:46 gwr Exp $
+
+# copy the MAKEDEV script and make some devices
+COPY ${DESTDIR}/dev/MAKEDEV dev/MAKEDEV
+SPECIAL cd dev; sh MAKEDEV std rd0 sd0 sd2 st0
+SPECIAL /bin/rm dev/MAKEDEV
+SPECIAL mkfifo dev/pipe
+SPECIAL ln -s . usr
+
+# various files that we need in /etc for the install
+
+COPY ${TOPDIR}/common/rd.disktab etc/disktab
+COPY ${TOPDIR}/common/rd.fstab etc/fstab
+COPY ${TOPDIR}/common/rd.protocols etc/protocols
+COPY ${TOPDIR}/common/rd.services etc/services
+COPY ${TOPDIR}/common/rd.passwd etc/passwd
+
+# and the RC file
+COPY ${TOPDIR}/common/rd.sshrc .sshrc
+COPY ${TOPDIR}/common/rd.welcome .welcome
+
diff --git a/distrib/mvme68k/common/ramdisk.tree b/distrib/mvme68k/common/ramdisk.tree
new file mode 100644
index 00000000000..a242e6aa48b
--- /dev/null
+++ b/distrib/mvme68k/common/ramdisk.tree
@@ -0,0 +1,39 @@
+#
+# $NetBSD: ramdisk.tree,v 1.1.1.1 1995/10/08 23:07:48 gwr Exp $
+#
+
+/set type=dir uname=root gname=wheel mode=0755
+# .
+.
+
+# ./bin
+bin
+# ./bin
+..
+
+# ./dev
+dev
+# ./dev
+..
+
+# ./etc
+etc
+# ./etc
+..
+
+# ./mnt
+mnt
+# ./mnt
+..
+
+# ./sbin
+sbin
+# ./sbin
+..
+
+# ./tmp
+tmp
+# ./tmp
+..
+
+# ./usr will be a link to root
diff --git a/distrib/mvme68k/common/rd.disktab b/distrib/mvme68k/common/rd.disktab
new file mode 100644
index 00000000000..76067644074
--- /dev/null
+++ b/distrib/mvme68k/common/rd.disktab
@@ -0,0 +1,2 @@
+# $NetBSD: rd.disktab,v 1.2 1995/10/13 16:38:29 gwr Exp $
+# The ramdisk has no need for disktab (yet)
diff --git a/distrib/mvme68k/common/rd.fstab b/distrib/mvme68k/common/rd.fstab
new file mode 100644
index 00000000000..78bfa72a8b0
--- /dev/null
+++ b/distrib/mvme68k/common/rd.fstab
@@ -0,0 +1,2 @@
+# $NetBSD: rd.fstab,v 1.2 1995/10/13 16:38:31 gwr Exp $
+/dev/rd0 / ufs rw 1 1
diff --git a/distrib/mvme68k/common/rd.passwd b/distrib/mvme68k/common/rd.passwd
new file mode 100644
index 00000000000..b524734954a
--- /dev/null
+++ b/distrib/mvme68k/common/rd.passwd
@@ -0,0 +1 @@
+root::0:0:NetBSD RAM-disk root:/root:/bin/sh
diff --git a/distrib/mvme68k/common/rd.protocols b/distrib/mvme68k/common/rd.protocols
new file mode 100644
index 00000000000..0a0432edded
--- /dev/null
+++ b/distrib/mvme68k/common/rd.protocols
@@ -0,0 +1,6 @@
+#
+# etc/protocols (ramdisk version)
+# $NetBSD: rd.protocols,v 1.1.1.1 1995/10/08 23:07:49 gwr Exp $
+#
+ip 0 IP
+icmp 1 ICMP
diff --git a/distrib/mvme68k/common/rd.services b/distrib/mvme68k/common/rd.services
new file mode 100644
index 00000000000..15e200020c7
--- /dev/null
+++ b/distrib/mvme68k/common/rd.services
@@ -0,0 +1,56 @@
+#
+# etc/services (ramdisk version)
+# $NetBSD: rd.services,v 1.1.1.1 1995/10/08 23:07:49 gwr Exp $
+#
+tcpmux 1/tcp
+echo 7/tcp
+echo 7/udp
+discard 9/tcp sink null
+discard 9/udp sink null
+systat 11/tcp users
+daytime 13/tcp
+daytime 13/udp
+netstat 15/tcp
+chargen 19/tcp ttytst source
+chargen 19/udp ttytst source
+ftp-data 20/tcp
+ftp 21/tcp
+telnet 23/tcp
+smtp 25/tcp mail
+time 37/tcp timserver
+time 37/udp timserver
+nameserver 42/tcp name # IEN 116
+whois 43/tcp nicname
+domain 53/tcp nameserver
+domain 53/udp nameserver
+bootps 67/udp
+bootpc 68/udp
+tftp 69/udp
+#
+rje 77/tcp netrjs
+finger 79/tcp
+link 87/tcp ttylink
+kerberos 88/tcp krb5 # Kerberos v5
+kerberos 88/udp
+supdup 95/tcp
+# 100 - reserved
+hostnames 101/tcp hostname
+iso-tsap 102/tcp tsap
+#
+sunrpc 111/tcp
+sunrpc 111/udp
+
+#
+# UNIX specific services
+#
+exec 512/tcp
+biff 512/udp comsat
+login 513/tcp
+who 513/udp whod
+shell 514/tcp cmd
+syslog 514/udp
+printer 515/tcp spooler
+talk 517/udp
+ntalk 518/udp
+route 520/udp router routed
+
diff --git a/distrib/mvme68k/common/rd.sshrc b/distrib/mvme68k/common/rd.sshrc
new file mode 100644
index 00000000000..1964fc43814
--- /dev/null
+++ b/distrib/mvme68k/common/rd.sshrc
@@ -0,0 +1,4 @@
+# .sshrc
+# $NetBSD: rd.sshrc,v 1.2 1995/10/13 16:38:34 gwr Exp $
+path /sbin:/bin
+run cat /.welcome
diff --git a/distrib/mvme68k/common/rd.welcome b/distrib/mvme68k/common/rd.welcome
new file mode 100644
index 00000000000..9c1cf8fa3b2
--- /dev/null
+++ b/distrib/mvme68k/common/rd.welcome
@@ -0,0 +1,23 @@
+
+ Welcome to the NetBSD/sun3 RAMDISK root!
+
+This environment is designed to do only three things:
+1: Partititon your disk (use the command: edlabel /dev/rsd0c)
+2: Copy a miniroot image into the swap partition (/dev/rsd0b)
+3: Reboot (using the swap partition, i.e. /dev/sd?b).
+
+Copying the miniroot can be done several ways, allowing
+the source of the miniroot image to be on any of these:
+ boot tape, NFS server, TFTP server, rsh server
+
+The easiest is loading from tape, which is done as follows:
+ mt -f /dev/nrst0 rewind
+ mt -f /dev/nrst0 fsf 2
+ dd bs=32k if=/dev/nrst0 of=/dev/rsd0b
+(For help with other methods, please see the install notes.)
+
+To reboot using the swap partition, first use "halt",
+then at the PROM monitor prompt use a command like:
+ b sd(,,1) -s
+
+To view this message again, type: cat /.welcome
diff --git a/distrib/mvme68k/common/rd_bin.conf b/distrib/mvme68k/common/rd_bin.conf
new file mode 100644
index 00000000000..1c86ed05741
--- /dev/null
+++ b/distrib/mvme68k/common/rd_bin.conf
@@ -0,0 +1,82 @@
+#
+# $NetBSD: rd_bin.conf,v 1.2 1995/11/21 21:19:10 gwr Exp $
+#
+# common/rd_bin.conf - unified binary for the ramdisk.
+#
+# The ramdisk root has to stay small enough so the kernel
+# can be loaded in less than one megabyte of ram, including
+# uninitialized data (bss). Otherwise it will not work on
+# the Sun3/50. This is not too hard, because the ONLY
+# tools needed in this root are those that one might use
+# to initialize the disk label and copy a miniroot image
+# into the swap partiton. Everything else is done after
+# the machine is rebooted from the miniroot.
+#
+# Note that the "ln" directives below are not really about
+# filesystem links, but rather the ability of the resulting
+# crunched binary to select the right program when argv[0]
+# matches the names on right of the "ln prog" directive.
+# For example, the shell can be run with argv[0]="-sh"
+# (login shell convention) but no such file will exist.
+# Similarly, one may want to run "init" as "oinit"...
+#
+# Notes about what is included (or not) and why:
+#
+# Include mknod incase I forgot some device nodes...
+# Support copying miniroot from NFS, TFTP, or CDROM.
+# Need mount_ffs, mount_ufs to remount the ramdisk.
+#
+# Might use cat to look at files (it's small anyway).
+# Need for copying miniroot from tape: dd, mt
+# Keep to allow minor fixes: ln, mkdir, mv
+# Small and handy: cat, echo, pwd, sync
+#
+# Note: ssh has no "if", so "test" is useless. Also,
+# left out: cp, chmod, rm. The ramdisk does not really
+# need them, and they pull in fts_* from libc.
+#
+# Might use these to get the miniroot: rsh, tftp
+#
+# Assume gunzip can run elsewhere, i.e.:
+# rsh gzcat sun3.miniroot.gz
+# No need to extract archives either...
+#
+
+#
+# Here are all the programs, ordered by source location:
+
+# Special programs used to save space...
+srcdirs distrib/utils
+progs init_s ssh tls
+ln init_s init oinit
+ln ssh sh
+ln ssh -sh # login shell (not actual file name)
+ln tls ls
+# These are built with special flags to save a little space.
+# The x_ prefix is just to make them unique among all srcdirs.
+progs x_dd x_ifconfig
+ln x_dd dd
+ln x_ifconfig ifconfig
+
+srcdirs sbin
+progs edlabel mknod mount
+progs mount_cd9660 mount_ffs mount_nfs
+progs reboot umount
+ln mount_ffs ffs mount_ufs ufs
+ln mount_nfs nfs
+ln mount_cd9660 cd9660
+ln reboot halt
+
+srcdirs bin
+progs cat echo ln mkdir mt mv pwd sync
+
+srcdirs usr.bin
+progs rsh tftp
+
+# srcdirs usr.sbin
+
+# srcdirs gnu/usr.bin
+# progs cpio, gzip, tar
+# ln gzip gzcat gunzip
+
+libs libhack.o -lutil
diff --git a/distrib/mvme68k/common/rd_bin.list b/distrib/mvme68k/common/rd_bin.list
new file mode 100644
index 00000000000..7c7c855d1f6
--- /dev/null
+++ b/distrib/mvme68k/common/rd_bin.list
@@ -0,0 +1,44 @@
+#
+# $NetBSD: rd_bin.list,v 1.2 1995/10/13 16:38:36 gwr Exp $
+#
+
+# copy the crunched binary, link to it, and kill it
+
+COPY ${OBJDIR}/rd_bin rd_bin
+
+# From /usr/src/distrib/utils:
+LINK rd_bin sbin/init
+LINK rd_bin sbin/ifconfig
+LINK rd_bin sbin/edlabel
+LINK rd_bin bin/dd
+LINK rd_bin bin/ls
+LINK rd_bin bin/rsh
+LINK rd_bin bin/sh
+LINK rd_bin bin/ssh
+LINK rd_bin bin/tftp
+
+# From /usr/src/sbin:
+LINK rd_bin sbin/halt
+LINK rd_bin sbin/mknod
+LINK rd_bin sbin/mount
+LINK rd_bin sbin/mount_cd9660
+LINK rd_bin sbin/mount_ffs
+LINK rd_bin sbin/mount_nfs
+LINK rd_bin sbin/mount_ufs
+LINK rd_bin sbin/reboot
+LINK rd_bin sbin/umount
+
+# From /usr/src/bin:
+LINK rd_bin bin/cat
+# LINK rd_bin bin/chmod
+# LINK rd_bin bin/cp
+LINK rd_bin bin/echo
+LINK rd_bin bin/ln
+LINK rd_bin bin/mkdir
+LINK rd_bin bin/mt
+LINK rd_bin bin/mv
+LINK rd_bin bin/pwd
+# LINK rd_bin bin/rm
+LINK rd_bin bin/sync
+
+SPECIAL rm rd_bin
diff --git a/distrib/mvme68k/common/rdsetroot.c b/distrib/mvme68k/common/rdsetroot.c
new file mode 100644
index 00000000000..3ef17fc4091
--- /dev/null
+++ b/distrib/mvme68k/common/rdsetroot.c
@@ -0,0 +1,230 @@
+/* $NetBSD: rdsetroot.c,v 1.2 1995/10/13 16:38:39 gwr Exp $ */
+
+/*
+ * Copyright (c) 1994 Gordon W. Ross
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $Id: rdsetroot.c,v 1.1 1996/10/12 01:18:01 deraadt Exp $
+ */
+
+/*
+ * Copy a ramdisk image into the space reserved for it.
+ * Kernel variables: rd_root_size, rd_root_image
+ */
+
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/mman.h>
+
+#include <stdio.h>
+#include <a.out.h>
+
+extern off_t lseek();
+
+struct exec head;
+char *file;
+
+/* Virtual addresses of the symbols we frob. */
+long rd_root_image_va, rd_root_size_va;
+
+/* Offsets relative to start of data segment. */
+long rd_root_image_off, rd_root_size_off;
+
+/* value in the location at rd_root_size_off */
+int rd_root_size_val;
+
+/* pointers to pieces of mapped file */
+char *dataseg;
+
+/* and lengths */
+int data_len;
+int data_off;
+int data_pgoff;
+
+main(argc,argv)
+ char **argv;
+{
+ int fd, n;
+ int *ip;
+ char *cp;
+
+ if (argc < 2) {
+ printf("%s: missing file name\n", argv[0]);
+ exit(1);
+ }
+ file = argv[1];
+
+ fd = open(file, O_RDWR);
+ if (fd < 0) {
+ perror(file);
+ exit(1);
+ }
+
+ n = read(fd, &head, sizeof(head));
+ if (n < sizeof(head)) {
+ printf("%s: reading header\n", file);
+ exit(1);
+ }
+
+ if (N_BADMAG(head)) {
+ printf("%s: bad magic number\n");
+ exit(1);
+ }
+
+#ifdef DEBUG
+ printf(" text: %9d\n", head.a_text);
+ printf(" data: %9d\n", head.a_data);
+ printf(" bss: %9d\n", head.a_bss);
+ printf(" syms: %9d\n", head.a_syms);
+ printf("entry: 0x%08X\n", head.a_entry);
+ printf("trsiz: %9d\n", head.a_trsize);
+ printf("drsiz: %9d\n", head.a_drsize);
+#endif
+
+ if (head.a_syms <= 0) {
+ printf("%s: no symbols\n", file);
+ exit(1);
+ }
+ if (head.a_trsize ||
+ head.a_drsize)
+ {
+ printf("%s: has relocations\n");
+ exit(1);
+ }
+
+ find_rd_root_image(file);
+
+ /*
+ * Map in the whole data segment.
+ * The file offset needs to be page aligned.
+ */
+ data_off = N_DATOFF(head);
+ data_len = head.a_data;
+ /* align... */
+ data_pgoff = N_PAGSIZ(head) - 1;
+ data_pgoff &= data_off;
+ data_off -= data_pgoff;
+ data_len += data_pgoff;
+ /* map in in... */
+ dataseg = mmap(NULL, /* any address is ok */
+ data_len, /* length */
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED,
+ fd, data_off);
+ if ((long)dataseg == -1) {
+ printf("%s: can not map data seg\n", file);
+ perror(file);
+ exit(1);
+ }
+ dataseg += data_pgoff;
+
+ /*
+ * Find value in the location: rd_root_size
+ */
+ ip = (int*) (dataseg + rd_root_size_off);
+ rd_root_size_val = *ip;
+#ifdef DEBUG
+ printf("rd_root_size val: 0x%08X (%d blocks)\n",
+ rd_root_size_val, (rd_root_size_val >> 9));
+#endif
+
+ /*
+ * Copy the symbol table and string table.
+ */
+#ifdef DEBUG
+ printf("copying root image...\n");
+#endif
+ n = read(0, dataseg + rd_root_image_off,
+ rd_root_size_val);
+ if (n < 0) {
+ perror("read");
+ exit(1);
+ }
+
+ msync(dataseg - data_pgoff, data_len
+#ifdef sun
+ ,0
+#endif
+ );
+
+#ifdef DEBUG
+ printf("...copied %d bytes\n", n);
+#endif
+ close(fd);
+ exit(0);
+}
+
+
+/*
+ * Find locations of the symbols to patch.
+ */
+struct nlist wantsyms[] = {
+ { "_rd_root_size", 0 },
+ { "_rd_root_image", 0 },
+ { NULL, 0 },
+};
+
+find_rd_root_image(file)
+ char *file;
+{
+ int data_va;
+ int std_entry;
+
+ if (nlist(file, wantsyms)) {
+ printf("%s: no rd_root_image symbols?\n", file);
+ exit(1);
+ }
+ std_entry = N_TXTADDR(head) +
+ (head.a_entry & (N_PAGSIZ(head)-1));
+ data_va = N_DATADDR(head);
+ if (head.a_entry != std_entry) {
+ printf("%s: warning: non-standard entry point: 0x%08x\n",
+ file, head.a_entry);
+ printf("\texpecting entry=0x%X\n", std_entry);
+ data_va += (head.a_entry - std_entry);
+ }
+
+ rd_root_size_off = wantsyms[0].n_value - data_va;
+ rd_root_image_off = wantsyms[1].n_value - data_va;
+#ifdef DEBUG
+ printf(".data segment va: 0x%08X\n", data_va);
+ printf("rd_root_size va: 0x%08X\n", wantsyms[0].n_value);
+ printf("rd_root_image va: 0x%08X\n", wantsyms[1].n_value);
+ printf("rd_root_size off: 0x%08X\n", rd_root_size_off);
+ printf("rd_root_image off: 0x%08X\n", rd_root_image_off);
+#endif
+
+ /*
+ * Sanity check locations of db_* symbols
+ */
+ if (rd_root_image_off < 0 || rd_root_image_off >= head.a_data) {
+ printf("%s: rd_root_image not in data segment?\n", file);
+ exit(1);
+ }
+ if (rd_root_size_off < 0 || rd_root_size_off >= head.a_data) {
+ printf("%s: rd_root_size not in data segment?\n", file);
+ exit(1);
+ }
+}
diff --git a/distrib/mvme68k/miniroot/Makefile b/distrib/mvme68k/miniroot/Makefile
new file mode 100644
index 00000000000..339166cbe38
--- /dev/null
+++ b/distrib/mvme68k/miniroot/Makefile
@@ -0,0 +1,72 @@
+# $NetBSD: Makefile,v 1.3.6.1 1996/08/29 03:24:24 gwr Exp $
+
+TOP= ${.CURDIR}/..
+
+# This include just sets REV=XX
+.include "${TOP}/Makefile.inc"
+
+IMAGE= miniroot
+CBIN= mini_usr
+
+TREE= ${TOP}/common/${IMAGE}.tree
+
+LISTS= ${TOP}/common/mini_sbin.list \
+ ${TOP}/common/mini_bin.list \
+ ${TOP}/common/${CBIN}.list \
+ ${TOP}/common/mini_xx.list \
+ ${TOP}/common/${IMAGE}.list
+
+KERNEL=${SRCSYSDIR}/arch/sun3/compile/GENERIC/netbsd
+
+MOUNT_POINT= /mnt
+BDEV= /dev/sd2b
+CDEV= /dev/rsd2b
+#BDEV= /dev/sd0d
+#CDEV= /dev/rsd0d
+
+# These are all the parameters for the miniroot: (8MB)
+DISKTYPE= miniroot
+NBLKS= 16384
+# old format, minfree, opt, b/i trks, sects, cpg
+NEWFSARGS= -O -m 0 -o space -i 8192 -t 8 -u 32 -c 16
+
+CLEANFILES= ${IMAGE}.gz install.sub
+
+${IMAGE}.gz: ${TREE} ${LISTS} ${CBIN} mini_xx install.sub
+ -newfs ${NEWFSARGS} -s ${NBLKS} ${CDEV} ${DISKTYPE}
+ mount ${BDEV} ${MOUNT_POINT}
+ mtree -def ${TREE} -p ${MOUNT_POINT}/ -u
+ TOPDIR=${TOP} CURDIR=${.CURDIR} \
+ OBJDIR=${.OBJDIR} TARGDIR=${MOUNT_POINT} \
+ sh ${TOP}/common/RunList.sh ${LISTS}
+ sync ; sleep 1 ; sync
+ cd ${MOUNT_POINT} ;\
+ usr/mdec/installboot -v ufsboot usr/mdec/bootxx ${CDEV}
+ cp ${KERNEL} ${MOUNT_POINT}/netbsd
+ sync
+ @echo ""
+ @df -i ${MOUNT_POINT}
+ @echo ""
+ -umount ${MOUNT_POINT}
+ dd if=${CDEV} bs=16b count=`expr ${NBLKS} / 16` |\
+ gzip > ${IMAGE}.tmp
+ -mv -f ${IMAGE}.tmp ${IMAGE}.gz
+
+# Do not delete this if I change my mind and kill make...
+.PRECIOUS: ${IMAGE}.gz
+
+# Rules for making ${CBIN} ...
+.include "${TOP}/common/Make.crunch"
+
+install.sub : ${TOP}/../miniroot/install.sub
+ sed -e "/^VERSION=/s/=.*/=${REV}/" < $? > $@
+
+clean cleandir: clean_xx
+ -rm -f a.out core *.core *.o
+ -rm -f ${CLEANFILES}
+
+# Standard rules needed by the above...
+.include <bsd.obj.mk>
+
+# Hacks for re-linking some program -static
+.include "${TOP}/common/mini_xx.mk"
diff --git a/distrib/mvme68k/ramdisk/Findrefs b/distrib/mvme68k/ramdisk/Findrefs
new file mode 100644
index 00000000000..2a098b5df7a
--- /dev/null
+++ b/distrib/mvme68k/ramdisk/Findrefs
@@ -0,0 +1,12 @@
+#!/bin/sh
+# $NetBSD: Findrefs,v 1.2 1995/10/13 16:51:28 gwr Exp $
+
+# Small helper to find out who pulls in X
+
+[ "$1" ] || { echo "$0: match_string" ; exit 1; }
+
+for f in *.lo
+do
+ nm -p $f | grep "$1" && echo $f
+done
+
diff --git a/distrib/mvme68k/ramdisk/Makefile b/distrib/mvme68k/ramdisk/Makefile
new file mode 100644
index 00000000000..278e1c30042
--- /dev/null
+++ b/distrib/mvme68k/ramdisk/Makefile
@@ -0,0 +1,70 @@
+# $NetBSD: Makefile,v 1.3 1995/11/21 21:19:14 gwr Exp $
+
+TOP= ${.CURDIR}/..
+
+# This include just sets REV=XX
+.include "${TOP}/Makefile.inc"
+
+IMAGE= ramdisk
+CBIN= rd_bin
+
+TREE= ${TOP}/common/${IMAGE}.tree
+
+LISTS= ${TOP}/common/${CBIN}.list \
+ ${TOP}/common/${IMAGE}.list
+
+KERNEL=${SRCSYSDIR}/arch/sun3/compile/RAMDISK/netbsd
+
+MOUNT_POINT= /mnt
+BDEV= /dev/rd0
+CDEV= /dev/rd0
+
+# These are all the parameters for the root fs: (256K)
+DISKTYPE= rdroot
+NBLKS= 512
+# old format, minfree, opt, b/i trks, sects, cpg
+NEWFSARGS= -O -m 0 -o space -i 2048 -t 2 -u 16 -c 16
+
+CLEANFILES= netbsd-rd rdsetroot ${IMAGE}.fs
+
+netbsd-rd : rdsetroot ${IMAGE}.fs
+ cp ${KERNEL} netbsd-tmp
+ ./rdsetroot netbsd-tmp < ${IMAGE}.fs
+ -mv -f netbsd-tmp $@
+
+rdsetroot: ${TOP}/common/rdsetroot.c
+ $(CC) -o $@ -DDEBUG ${TOP}/common/rdsetroot.c
+
+${IMAGE}.fs: ${TREE} ${LISTS} ${CBIN}
+ -newfs ${NEWFSARGS} -s ${NBLKS} ${CDEV} ${DISKTYPE}
+ mount ${BDEV} ${MOUNT_POINT}
+ mtree -def ${TREE} -p ${MOUNT_POINT}/ -u
+ TOPDIR=${TOP} CURDIR=${.CURDIR} \
+ OBJDIR=${.OBJDIR} TARGDIR=${MOUNT_POINT} \
+ sh ${TOP}/common/RunList.sh ${LISTS}
+ sync
+ @echo ""
+ @df -i ${MOUNT_POINT}
+ @echo ""
+ -umount ${MOUNT_POINT}
+ dd if=${CDEV} of=$@ count=${NBLKS}
+
+# Do not delete this if I change my mind and kill make...
+.PRECIOUS: ${IMAGE}.fs
+
+# Rules for making ${CBIN} ...
+.include "${TOP}/common/Make.crunch"
+
+# This is listed in rd_bin.conf but is built here.
+${CBIN} : libhack.o
+
+# Use stubs to eliminate some large stuff from libc
+HACKSRC=${TOP}/../utils/libhack
+.include "${HACKSRC}/Makefile.inc"
+
+clean cleandir:
+ -rm -f a.out core *.core *.o
+ -rm -f ${CLEANFILES}
+
+# Standard rules needed by the above...
+.include <bsd.obj.mk>
diff --git a/distrib/mvme68k/ramdisk/Showsyms b/distrib/mvme68k/ramdisk/Showsyms
new file mode 100644
index 00000000000..a854d3ce55c
--- /dev/null
+++ b/distrib/mvme68k/ramdisk/Showsyms
@@ -0,0 +1,9 @@
+#!/bin/sh
+# $NetBSD: Showsyms,v 1.2 1995/10/13 16:51:31 gwr Exp $
+# Small helper to print out symbols in a useful order.
+
+nm -n rd_bin.syms |grep -i ' a '
+nm -n rd_bin.syms |grep -i ' t '
+nm -n rd_bin.syms |grep -i ' d '
+nm -n rd_bin.syms |grep -i ' b '
+nm -p rd_bin.syms |grep -i ' c '