diff options
Diffstat (limited to 'distrib/pmax')
-rw-r--r-- | distrib/pmax/Makefile.inc | 3 | ||||
-rw-r--r-- | distrib/pmax/list2sh.awk | 71 | ||||
-rw-r--r-- | distrib/pmax/ramdisk/Makefile | 71 | ||||
-rw-r--r-- | distrib/pmax/ramdisk/Makefile.inc | 31 | ||||
-rw-r--r-- | distrib/pmax/ramdisk/disktab.preinstall | 32 | ||||
-rw-r--r-- | distrib/pmax/ramdisk/disktab.shadow | 32 | ||||
-rw-r--r-- | distrib/pmax/ramdisk/dot.commonutils | 129 | ||||
-rw-r--r-- | distrib/pmax/ramdisk/dot.instutils | 152 | ||||
-rw-r--r-- | distrib/pmax/ramdisk/dot.profile | 118 | ||||
-rw-r--r-- | distrib/pmax/ramdisk/install.md | 264 | ||||
-rw-r--r-- | distrib/pmax/ramdisk/list | 84 | ||||
-rw-r--r-- | distrib/pmax/ramdisk/mtree.conf | 79 | ||||
-rw-r--r-- | distrib/pmax/ramdisk/raminst.conf | 28 | ||||
-rw-r--r-- | distrib/pmax/ramdisk/termcap.vt | 90 | ||||
-rw-r--r-- | distrib/pmax/rdsetroot.c | 214 | ||||
-rw-r--r-- | distrib/pmax/runlist.sh | 13 |
16 files changed, 1411 insertions, 0 deletions
diff --git a/distrib/pmax/Makefile.inc b/distrib/pmax/Makefile.inc new file mode 100644 index 00000000000..77103d9368c --- /dev/null +++ b/distrib/pmax/Makefile.inc @@ -0,0 +1,3 @@ +# $OpenBSD: Makefile.inc,v 1.1 1998/11/09 06:16:04 millert Exp $ + +REV=${OSrev} diff --git a/distrib/pmax/list2sh.awk b/distrib/pmax/list2sh.awk new file mode 100644 index 00000000000..99310139b41 --- /dev/null +++ b/distrib/pmax/list2sh.awk @@ -0,0 +1,71 @@ +# $OpenBSD: list2sh.awk,v 1.1 1998/11/09 06:16:05 millert Exp $ + +BEGIN { + printf("cd ${CURDIR}\n"); + printf("\n"); +} +/^$/ || /^#/ { + print $0; + next; +} +$1 == "COPY" { + printf("echo '%s'\n", $0); + printf("test -f ${TARGDIR}/%s && rm -fr ${TARGDIR}/%s\n", $3, $3); + printf("cp %s ${TARGDIR}/%s\n", $2, $3); + next; +} +$1 == "LINK" { + printf("echo '%s'\n", $0); + for (i = 3; i <= NF; i++) { + printf("test -f ${TARGDIR}/%s && rm -f ${TARGDIR}/%s\n", $i, $i); + printf("(cd ${TARGDIR}; ln %s %s)\n", $2, $i); + } + next; +} +$1 == "SYMLINK" { + printf("echo '%s'\n", $0); + for (i = 3; i <= NF; i++) { + printf("test -f ${TARGDIR}/%s && rm -f ${TARGDIR}/%s\n", $i, $i); + printf("(cd ${TARGDIR}; ln -s %s %s)\n", $2, $i); + } + next; +} +$1 == "ARGVLINK" { + # crunchgen directive; ignored here + next; +} +$1 == "SRCDIRS" { + # crunchgen directive; ignored here + next; +} +$1 == "CRUNCHSPECIAL" { + # crunchgen directive; ignored here + next; +} +$1 == "COPYDIR" { + printf("echo '%s'\n", $0); + printf("(cd ${TARGDIR}/%s && find . ! -name . | xargs /bin/rm -rf)\n", + $3); + printf("(cd %s && find . ! -name . | cpio -pdamu ${TARGDIR}/%s)\n", $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/pmax/ramdisk/Makefile b/distrib/pmax/ramdisk/Makefile new file mode 100644 index 00000000000..5413fb5a9ec --- /dev/null +++ b/distrib/pmax/ramdisk/Makefile @@ -0,0 +1,71 @@ +# $OpenBSD: Makefile,v 1.1 1998/11/09 06:16:07 millert Exp $ + +TOP= ${.CURDIR}/.. + +.include "${TOP}/Makefile.inc" +IMAGE= ramdisk-${REV}.fs +CRUNCHCONF?= ${.CURDIR}/${CBIN}.conf +BASE= ramdisk + +MOUNT_POINT= /mnt + +VND?= svnd0 +VND_DEV= /dev/${VND}a +VND_RDEV= /dev/r${VND}a +VND_CRDEV= /dev/r${VND}c +PID!= echo $$$$ +REALIMAGE!= echo /var/tmp/image.${PID} + +STRIP?= strip +GZIP?= gzip +GZIPFLAGS?= -9f + +all: ${CBIN} ${IMAGE} bsd.rd + @echo "all done" + +.include "Makefile.inc" + +DISKTYPE= rdroot +NBLKS= 6144 +NEWFSARGS= -m 0 -o space -c 16 -i 3072 + +bsd.rd: ${IMAGE} bsd.elf rdsetroot + cp bsd.elf bsd.elf.rd + ${.OBJDIR}/rdsetroot bsd.elf.rd < ${IMAGE} + elf2ecoff bsd.elf.rd bsd.rd + rm bsd.elf.rd + +bsd.elf: + cd ${.CURDIR}/../../../sys/arch/pmax/conf && config RAMDISK + cd ${.CURDIR}/../../../sys/arch/pmax/compile/RAMDISK && \ + make clean && make + cp ${.CURDIR}/../../../sys/arch/pmax/compile/RAMDISK/bsd.elf bsd.elf + +${IMAGE}: do_prep do_mount do_files do_umount + mv -f ${REALIMAGE} ${IMAGE} + +rdsetroot: ${TOP}/rdsetroot.c + ${HOSTCC} ${HOSTCFLAGS} -o rdsetroot ${TOP}/rdsetroot.c + +do_prep: + dd if=/dev/zero of=${REALIMAGE} bs=512 count=${NBLKS} + vnconfig -v -c ${VND} ${REALIMAGE} + disklabel -w -r ${VND} ${DISKTYPE} + +do_mount: + newfs ${NEWFSARGS} ${NEWFSARGS_RD} -s ${NBLKS} ${VND_RDEV} + mount ${VND_DEV} ${MOUNT_POINT} + +do_umount: + @echo "" + @df -i ${MOUNT_POINT} + @echo "" + umount ${MOUNT_POINT} + vnconfig -u ${VND} + +unconfig: + -umount ${MOUNT_POINT} + -vnconfig -u ${VND} + +beforeinstall: + cp bsd.rd ${DESTDIR}/snapshot diff --git a/distrib/pmax/ramdisk/Makefile.inc b/distrib/pmax/ramdisk/Makefile.inc new file mode 100644 index 00000000000..28ec056efc8 --- /dev/null +++ b/distrib/pmax/ramdisk/Makefile.inc @@ -0,0 +1,31 @@ +# +# $OpenBSD: Makefile.inc,v 1.1 1998/11/09 06:16:07 millert Exp $ +# + +# TOP is assumed to be defined by Makefile including this one. + +CBIN?= raminst +COMMONDIR= ${TOP}/ramdisk + +MOUNT_POINT?= ${TOP}/${BASE}/fs + +LISTS= ${.CURDIR}/list +CRUNCHCONF?= ${COMMONDIR}/${CBIN}.conf +MTREE= ${COMMONDIR}/mtree.conf + +${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CRUNCHCONF} + crunchgen -E -D ${BSDSRCDIR} -L ${DESTDIR}/usr/lib ${CRUNCHCONF} + +${CBIN}: ${CBIN}.mk ${CBIN}.cache ${CBIN}.c + make -f ${CBIN}.mk all + +do_files: + mtree -def ${MTREE} -p ${MOUNT_POINT}/ -u + TOPDIR=${TOP} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} \ + REV=${REV} TARGDIR=${MOUNT_POINT} sh ${TOP}/runlist.sh ${LISTS} + +clean cleandir: + /bin/rm -f core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache *.o *.lo *.c + +.include <bsd.obj.mk> +.include <bsd.subdir.mk> diff --git a/distrib/pmax/ramdisk/disktab.preinstall b/distrib/pmax/ramdisk/disktab.preinstall new file mode 100644 index 00000000000..73600f00dc9 --- /dev/null +++ b/distrib/pmax/ramdisk/disktab.preinstall @@ -0,0 +1,32 @@ +# +# $OpenBSD: disktab.preinstall,v 1.1 1998/11/09 06:16:08 millert 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/pmax/ramdisk/disktab.shadow b/distrib/pmax/ramdisk/disktab.shadow new file mode 100644 index 00000000000..c5c3adeef9f --- /dev/null +++ b/distrib/pmax/ramdisk/disktab.shadow @@ -0,0 +1,32 @@ +# +# $OpenBSD: disktab.shadow,v 1.1 1998/11/09 06:16:08 millert 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/pmax/ramdisk/dot.commonutils b/distrib/pmax/ramdisk/dot.commonutils new file mode 100644 index 00000000000..eefb7c18cb9 --- /dev/null +++ b/distrib/pmax/ramdisk/dot.commonutils @@ -0,0 +1,129 @@ +# +# $OpenBSD: dot.commonutils,v 1.1 1998/11/09 06:16:08 millert Exp $ +# +# 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. +# + +# Installation utilites (functions), to get NetBSD installed on +# the hard disk. These are meant to be invoked from the shell prompt, +# by people installing NetBSD. + +Set_tmp_dir() +{ + def_tmp_dir=`pwd` + if [ "$def_tmp_dir" = "/" -o "$def_tmp_dir" = "/mnt" ]; then + def_tmp_dir=/mnt/usr/distrib + fi + + echo -n "What directory should be used to find and/or store " + echo "installtion" + echo -n "files? [$def_tmp_dir] " + read tmp_dir + if [ "$tmp_dir" = "" ]; then + tmp_dir=$def_tmp_dir + fi + if [ ! -d "$tmp_dir" ]; then + /bin/rm -rf $tmp_dir + mkdir -p $tmp_dir + fi +} + +Tmp_dir() +{ + if [ "$tmp_dir" = "" ]; then + Set_tmp_dir + fi + cd $tmp_dir +} + +Load_fd() +{ + Tmp_dir + which= + while [ "$which" != "a" -a "$which" != "b" ]; do + echo -n "Read from which floppy drive ('a' or 'b')? [a] " + read which + if [ "X$which" = "X" ]; then + which=a + fi + done + while echo -n "Insert floppy (hit ^C to terminate, enter to load): " + do + mount -t msdos /dev/fd0$which /mnt2 + cp -rp /mnt2/* . + umount /mnt2 + done +} + +Load_tape() +{ + Tmp_dir + echo -n "Which tape drive will you be using? [rst0] " + read which + if [ "X$which" = "X" ]; then + which=rst0 + fi + echo -n "Insert the tape into the tape drive and hit return to " + echo -n "continue..." + read foo + echo "Extracting files from the tape..." + tar xvfp /dev/$which + echo "Done." +} + +Extract() +{ + Tmp_dir + echo -n "Would you like to list the files as they're extracted? [n] " + read verbose + case $verbose in + y*|Y*) + tarverbose=v + ;; + *) + tarverbose= + ;; + esac + echo -n "Are you installing a '-current' snapshot? [n] " + read snapshot + case $snapshot in + y*|Y*) + snapshot=y + ;; + *) + snapshot=n + ;; + esac + if [ $snapshot = n ] + then + cat "$1".??? | gunzip | (cd / ; tar xfp$tarverbose -) + else + cat "$1".tar.gz | gunzip | (cd /mnt ; tar xfp$tarverbose -) + fi +} diff --git a/distrib/pmax/ramdisk/dot.instutils b/distrib/pmax/ramdisk/dot.instutils new file mode 100644 index 00000000000..2df3bc0874a --- /dev/null +++ b/distrib/pmax/ramdisk/dot.instutils @@ -0,0 +1,152 @@ +# +# $OpenBSD: dot.instutils,v 1.1 1998/11/09 06:16:09 millert Exp $ +# +# 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. +# + +# Installation configuration utilites (functions), to get NetBSD configured +# reasonably once it is installed on the hard disk. These are meant to be +# invoked from the shell prompt, by people installing NetBSD. + +Configure() +{ + DEV=/mnt/dev + ETC=/mnt/etc + + echo "You will now be prompted for information about this" + echo "machine. If you hit return, the default answer (in" + echo "brackets) will be used." + + echo "" + echo -n "What is this machine's hostname? [unknown.host.domain] " + read hname + if [ "$hname" = "" ]; then + hname=unknown.host.domain + fi + echo $hname > ${ETC}/myname + proto_domain=`echo $hname | sed -e 's/[^.]*\.//'` + + echo "" + echo "What domain is this machine in (this is NOT its YP" + echo -n "domain name)? [$proto_domain] " + read dname + if [ "$dname" = "" ]; then + dname=$proto_domain + fi + + echo "" + if [ -e ${ETC}/sendmail.cf ]; then + echo "WARNING: A default sendmail.cf exists, and probably" + echo "needs to be tuned and/or replaced, to work properly at" + echo "your site!" + else + echo "WARNING: No default sendmail.cf installed. Did you" + echo "forget to install the 'etc' distribution?" + fi + + echo "127.0.0.1 localhost localhost.$dname" > ${ETC}/hosts + + echo "" + echo -n "Does this machine have an ethernet interface? [y] " + read resp + case "$resp" in + n*) + ;; + *) + intf= + while [ "$intf" = "" ]; do + echo -n "What is the primary interface name " + echo -n "(e.g. ae0, etc)? " + read intf + done + echo -n "What is the hostname for this interface? [$hname] " + read ifname + if [ "$ifname" = "" ]; then + ifname=$hname + fi + ifaddr= + while [ "$ifaddr" = "" ]; do + echo -n "What is the IP address associated with " + echo -n "interface ${intf}? " + read ifaddr + done + echo "$ifaddr $ifname `echo $ifname | sed -e s/\.$dname//`" \ + >> ${ETC}/hosts + + echo -n "Does this interface have a special netmask? [n] " + read resp + case "$resp" in + y*) + echo -n "What is the netmask? [0xffffff00] " + read ifnetmask + if [ "$ifnetmask" = "" ]; then + ifnetmask=0xffffff00 + fi + ;; + *) + ifnetmask= + ;; + esac + + echo -n "Does this interface need additional flags? [n] " + read resp + case "$resp" in + y*) + echo -n "What flags? [link0] " + read ifflags + if [ "$ifflags" = "" ]; then + ifflags=link0 + fi + ;; + *) + ifflags= + ;; + esac + echo "inet $ifname $ifnetmask $ifflags" > ${ETC}/hostname.$intf + + echo "" + echo -n "WARNING: if you have any more ethernet interfaces, " + echo "you will have to configure" + echo -n "them by hand. Read the comments in /etc/netstart to" + echo "learn how to do this." + ;; + esac + + echo "" + echo -n "Making device nodes..." + cd ${DEV} + sh MAKEDEV all + echo " done." + + echo "You may now reboot your machine with the shutdown command." + echo " shutdown -r now" + echo "to reboot or" + echo " shutdown -h now" + echo "to halt." +} diff --git a/distrib/pmax/ramdisk/dot.profile b/distrib/pmax/ramdisk/dot.profile new file mode 100644 index 00000000000..ba332d6f107 --- /dev/null +++ b/distrib/pmax/ramdisk/dot.profile @@ -0,0 +1,118 @@ +# +# $OpenBSD: dot.profile,v 1.1 1998/11/09 06:16:11 millert Exp $ +# +# 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. +# + +export PATH=/sbin:/bin:/usr/bin:/usr/sbin:/ +export HISTFILE=/.sh_history + +umask 022 + +set -o emacs # emacs-style command line editing + +# XXX +# the TERM/EDITOR stuff is really well enough parameterized to be moved +# into install.sub where it could use the routines there and be invoked +# from the various (semi) MI install and upgrade scripts + +# Terminals in termcap, default TERM. +# This assumes a *small* termcap file. +TERMS=`grep '^[A-z]' /usr/share/misc/termcap | sed -e 's/|[^|]*$//' -e 's/|/ /g'` +TERM=sun +PAGER=more + +if [ "X${DONEPROFILE}" = "X" ]; then + DONEPROFILE=YES + + # need a writable root + mount /dev/rd0a / + + isin() { + local _a + + _a=$1; shift + while [ $# != 0 ]; do + if [ "$_a" = "$1" ]; then return 0; fi + shift + done + return 1 + } + + + # set up some sane defaults + echo 'erase ^?, werase ^W, kill ^U, intr ^C' + stty newcrt werase ^W intr ^C kill ^U erase ^? 9600 + echo '' + + # get the terminal type + echo "Supported terminals are:" + echo $TERMS + _forceloop="" + while [ "X$_forceloop" = X"" ]; do + echo -n "TERM = ($TERM) " + read resp + if [ "X$resp" = "X" ]; then + break + fi + if isin $resp $TERMS ; then + TERM=$resp + break; + fi + echo "Type $resp unknown." + done + export TERM + + # pull in the functions that people will use from the shell prompt. + . /.commonutils + . /.instutils + + # Installing or upgrading? + _forceloop="" + while [ "X$_forceloop" = X"" ]; do + echo -n '(I)nstall, (U)pgrade, or (S)hell? ' + read _forceloop + case "$_forceloop" in + i*|I*) + /install + ;; + + u*|U*) + /upgrade + ;; + + s*|S*) + ;; + + *) + _forceloop="" + ;; + esac + done +fi diff --git a/distrib/pmax/ramdisk/install.md b/distrib/pmax/ramdisk/install.md new file mode 100644 index 00000000000..9069df633f0 --- /dev/null +++ b/distrib/pmax/ramdisk/install.md @@ -0,0 +1,264 @@ +# $OpenBSD: install.md,v 1.1 1998/11/09 06:16:11 millert 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. +# + +TMPWRITEABLE=/tmp/writeable +KERNFSMOUNTED=/tmp/kernfsmounted + +# Machine-dependent install sets +MDSETS="kernel" + +md_machine_arch() { + cat /kern/machine +} + +md_copy_kernel() { + check_kernel +} + +md_set_term() { + if [ ! -z "$TERM" ]; then + return + fi + echo -n "Specify terminal type [sun]: " + getresp "sun" + TERM="$resp" + export TERM +} + +md_get_msgbuf() { + # Only want to see one boot's worth of info + sed -n -f /dev/stdin /kern/msgbuf <<- OOF + /^Copyright (c)/h + /^Copyright (c)/!H + \${ + g + p + } + OOF +} + +md_get_diskdevs() { + md_get_msgbuf | egrep "^[sw]d[0-9]+ " | cutword 1 +} + +md_get_cddevs() { + md_get_msgbuf | egrep "^a?cd[0-9]+ " | cutword 1 +} + +md_get_partition_range() { + # return range of valid partition letters + echo "[a-p]" +} + +md_installboot() { + # $1 is the root disk + + echo -n "Installing boot block... " + disklabel -W ${1} + disklabel -W ${1} + disklabel -B ${1} + echo "done." +} + +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) + ;; + 1) + echo "WARNING: Disk $_disk has no label. You will be creating a new one." + echo + ;; + 2) + echo "WARNING: Label on disk $_disk is corrupted. You will be repairing." + echo + ;; + esac + + # display example + cat << \__md_prep_disklabel_1 + +If you are unsure of how to use multiple partitions properly +(ie. separating /, /usr, /tmp, /var, /usr/local, and other things) +just split the space into a root and swap partition for now. +__md_prep_disklabel_1 + + disklabel -W ${_disk} + disklabel -E ${_disk} +} + +md_welcome_banner() { +{ + if [ "$MODE" = "install" ]; then + echo "Welcome to the OpenBSD/pmax ${VERSION_MAJOR}.${VERSION_MINOR} installation program." + cat << \__welcome_banner_1 + +This program is designed to help you put OpenBSD on your system in a +simple and rational way. +__welcome_banner_1 + + else + echo "Welcome to the OpenBSD/pmax ${VERSION_MAJOR}.${VERSION_MINOR} upgrade program." + cat << \__welcome_banner_2 + +This program is designed to help you upgrade your OpenBSD 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 +} | more +} + +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 OpenBSD! +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 +} + +md_native_fstype() { +} +md_native_fsopts() { +} + +md_makerootwritable() { + # 2048 is the size in DEV_BIZE blocks + + if [ -e ${TMPWRITEABLE} ] + then + md_mountkernfs + return + fi + umount /tmp >> /dev/null 2>&1 + if ! mount -t ffs -u /dev/rd0a / ; then + cat << \__rd0_failed_1 + +FATAL ERROR: Can't mount the ram filesystem. + +__rd0_failed_1 + exit + fi + + # Bleh. Give mount_mfs a chance to DTRT. + sleep 2 + > ${TMPWRITEABLE} + + md_mountkernfs +} +md_mountkernfs() { + if [ -e ${KERNFSMOUNTED} ] + then + return + fi + if ! mount -t kernfs /kern /kern + then + cat << \__kernfs_failed_1 +FATAL ERROR: Can't mount kernfs filesystem +__kernfs_failed_1 + exit + fi + > ${KERNFSMOUNTED} +} + +hostname() { + case $# in + 0) cat /kern/hostname ;; + 1) echo "$1" > /kern/hostname ;; + *) echo "usage: hostname [name-of-host]" + esac +} diff --git a/distrib/pmax/ramdisk/list b/distrib/pmax/ramdisk/list new file mode 100644 index 00000000000..d83b48ae62f --- /dev/null +++ b/distrib/pmax/ramdisk/list @@ -0,0 +1,84 @@ +# +# $OpenBSD: list,v 1.1 1998/11/09 06:16:12 millert Exp $ +# + +# copy the crunched binary, link to it, and kill it +COPY ${OBJDIR}/raminst raminst +LINK raminst bin/cat +LINK raminst bin/chmod +LINK raminst bin/cp +LINK raminst bin/cpio +LINK raminst bin/dd +LINK raminst bin/df +LINK raminst bin/ed +LINK raminst bin/expr +LINK raminst bin/ln +LINK raminst bin/ls +LINK raminst bin/mkdir +LINK raminst bin/mv +LINK raminst bin/ksh bin/sh +ARGVLINK ksh -sh +LINK raminst bin/rm +LINK raminst bin/stty +LINK raminst bin/sleep +LINK raminst bin/tar +LINK raminst sbin/disklabel +LINK raminst sbin/fsck +LINK raminst sbin/halt +LINK raminst sbin/dhclient +LINK raminst sbin/ifconfig +LINK raminst sbin/init +LINK raminst sbin/mknod +LINK raminst sbin/mount +LINK raminst sbin/mount_cd9660 +LINK raminst sbin/mount_ffs +LINK raminst sbin/mount_kernfs +LINK raminst sbin/mount_nfs +LINK raminst sbin/mount_mfs +LINK raminst sbin/newfs +LINK raminst sbin/reboot +LINK raminst sbin/route +LINK raminst sbin/umount +LINK raminst usr/bin/chgrp +LINK raminst usr/bin/ftp +LINK raminst usr/bin/egrep +LINK raminst usr/bin/fgrep +LINK raminst usr/bin/grep +LINK raminst usr/bin/gzip +LINK raminst usr/bin/less +LINK raminst usr/bin/more +LINK raminst usr/bin/sed +LINK raminst usr/bin/pax +LINK raminst usr/sbin/chown +SPECIAL /bin/rm raminst + +# copy the MAKEDEV script and make some devices +COPY ${DESTDIR}/dev/MAKEDEV dev/MAKEDEV +SPECIAL cd dev; sh MAKEDEV raminst + +# we need the contents of /usr/mdec +COPY ${DESTDIR}/usr/mdec/bootrz usr/mdec/bootrz +COPY ${DESTDIR}/usr/mdec/rzboot usr/mdec/rzboot + +# various files that we need in /etc for the install +COPY ${DESTDIR}/etc/group etc +COPY ${DESTDIR}/etc/protocols etc +COPY ${DESTDIR}/etc/services etc +COPY ${DESTDIR}/etc/spwd.db etc + +# and the common installation tools (XXX - not common right now) +COPY ${CURDIR}/dot.commonutils .commonutils +COPY ${CURDIR}/termcap.vt usr/share/misc/termcap + +# so DNS can work +SYMLINK /tmp/resolv.conf.shadow etc/resolv.conf + +# and the installation tools +SPECIAL sed -e '/^#[ ].*$/d' < ${CURDIR}/dot.profile > .profile +SPECIAL sed -e '/^#[ ].*$/d' < ${CURDIR}/dot.instutils > .instutils +SPECIAL sed -e '/^#[ ].*$/d' < ${CURDIR}/disktab.shadow > etc/disktab.shadow +SPECIAL sed -e "/^VERSION=/s/=.*/=${REV}/" -e '/^#[ ].*$/d' < ${CURDIR}/../../miniroot/install.sub > install.sub +SPECIAL sed -e '/^#[ ].*$/d' < ${CURDIR}/../../miniroot/install.sh > install +SPECIAL sed -e '/^#[ ].*$/d' < ${CURDIR}/../../miniroot/upgrade.sh > upgrade +SPECIAL sed -e '/^#[ ].*$/d' < ${CURDIR}/install.md > install.md +SPECIAL chmod 755 install upgrade diff --git a/distrib/pmax/ramdisk/mtree.conf b/distrib/pmax/ramdisk/mtree.conf new file mode 100644 index 00000000000..460374b984f --- /dev/null +++ b/distrib/pmax/ramdisk/mtree.conf @@ -0,0 +1,79 @@ +# +# $OpenBSD: mtree.conf,v 1.1 1998/11/09 06:16:12 millert Exp $ +# + +/set type=dir uname=root gname=wheel mode=0755 +# . +. + +# ./bin +bin +# ./bin +.. + +# ./dev +dev +# ./dev +.. + +# ./etc +etc +# ./etc +.. + +# ./mnt +mnt +# ./mnt +.. + +# ./mnt2 +mnt2 +# ./mnt2 +.. + +# ./sbin +sbin +# ./sbin +.. + +# ./tmp +tmp +# ./tmp +.. + +# ./kern +kern +# ./kern +.. + +# ./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 +.. diff --git a/distrib/pmax/ramdisk/raminst.conf b/distrib/pmax/ramdisk/raminst.conf new file mode 100644 index 00000000000..a035eaa15a7 --- /dev/null +++ b/distrib/pmax/ramdisk/raminst.conf @@ -0,0 +1,28 @@ +# +# $OpenBSD: raminst.conf,v 1.1 1998/11/09 06:16:13 millert Exp $ +# +# raminst.conf - unified binary for the RAM disk +# + +srcdirs distrib/special bin sbin usr.bin usr.sbin gnu/usr.bin + +progs cat chmod chown cp dd df disklabel ed grep fsck_ffs ftp +progs gzip ifconfig init less ln ls mkdir mknod mount +progs mount_cd9660 mount_kernfs mount_ffs mount_nfs mv newfs ksh +progs reboot rm route rsh sed sleep stty pax umount dhclient expr +#progs slattach sync tip + +ln chown chgrp +ln fsck_ffs fsck +ln ksh sh +ln ksh -sh # init invokes the shell this way +ln mount_ffs ffs +ln newfs mount_mfs +ln grep egrep +ln grep fgrep +ln less more +ln reboot halt +ln pax tar +ln pax cpio + +libs -lutil -ltermcap -lm diff --git a/distrib/pmax/ramdisk/termcap.vt b/distrib/pmax/ramdisk/termcap.vt new file mode 100644 index 00000000000..79af728b7af --- /dev/null +++ b/distrib/pmax/ramdisk/termcap.vt @@ -0,0 +1,90 @@ +# +# $OpenBSD: termcap.vt,v 1.1 1998/11/09 06:16:13 millert Exp $ +# +# Copyright (c) 1980, 1985, 1989 The Regents of the University of California. +# 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 the University of +# California, Berkeley and its contributors. +# 4. Neither the name of the University 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 REGENTS 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. +# +# @(#)termcap.src 5.109 (Berkeley) 3/8/93 +# +vt200|vt220|dec-vt220|vt200-js|vt220-js|dec vt200 series with jump scroll:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:LE=\E[%dD:\ + :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:ct=\E[3g:dc=\E[P:dl=\E[M:\ + :ei=\E[4l:im=\E[4h:k1=\E[17~:k2=\E[18~:k3=\E[19~:k4=\E[20~:\ + :k5=\E[21~:k6=\E[23~:k7=\E[24~:k8=\E[25~:kD=\E[3~:kH=\E[4~:\ + :kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:kh=\E[1~:km:mi:ms:\ + :if=/usr/share/tabset/vt100:se=\E[27m:st=\EH:ue=\E[24m:\ + :tc=vt100: +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: +vt300|vt320|vt300-80|VT 300 with 80 columns, on VMS:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ + :LE=\E[%dD:RI=\E[%dC:SR=1*\E[%dM:UP=\E[%dA:al=\E[L:\ + :am:bl=^G:bs:cd=2*\E[J:ce=2*\E[K:cl=45\E[H\E[2J:\ + :cm=%i\E[%d;%dH:co#80:cr=\r:cs=\E[%i%d;%dr:ct=\E[3g:\ + :dc=\E[P:dl=\E[M:dm=:do=\ED:ec=\E[%dX:ed=:ei=\E[4l:\ + :ho=\E[H:ic:im=\E[4h:it#8:k1=\EOP:k2=\EOQ:k3=\EOR:\ + :k4=\EOS:kd=\E[B:ke=\E[?1l\E>:kl=\E[D:kn#4:kr=\E[C:ks=\E[?1h\E=:\ + :ku=\E[A:le=^H:li#24:mb=\E[5m:md=\E[1m:me=\E[0m:mi:\ + :mr=\E[7m:ms:nd=\E[C:nl=\ED:nw=\EE:pf=\E[?4i:po=\E[?5i:\ + :ps=\E[i:rc=\E8:sc=\E7:se=\E[27m:sf=1*\ED:so=\E[7m:\ + :sr=1*\EM:st=\EH:ue=\E[24m:up=\EM:us=\E[4m:xn: +ansi-mini|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:ta=^I:up=\E[A: +sun|sun1|sun2|Sun Microsystems Inc. workstation console:\ + :am:km:ms:\ + :co#80:li#34:\ + :%7=\E[194z:&5=\E[193z:&8=\E[195z:@7=\E[220z:AL=\E[%dL:\ + :DC=\E[%dP:DL=\E[%dM:F1=\E[234z:F2=\E[235z:IC=\E[%d@:\ + :K2=\E[218z: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=^J:ei=:ic=\E[@:im=:\ + :k1=\E[224z:k2=\E[225z:k3=\E[226z:k4=\E[227z:k5=\E[228z:\ + :k6=\E[229z:k7=\E[230z:k8=\E[231z:k9=\E[232z:k;=\E[233z:\ + :kD=\177:kN=\E[222z:kP=\E[216z:kb=^H:kd=\E[B:kh=\E[214z:\ + :kl=\E[D:kr=\E[C:ku=\E[A:le=^H:md=\E[1m:me=\E[m:mr=\E[7m:\ + :nd=\E[C:r2=\E[s:\ + :..sa=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m:\ + :se=\E[m:sf=^J:so=\E[7m:ta=^I:ue=\E[m:up=\E[A:us=\E[4m: +dumb|80-column dumb tty:\ + :am:\ + :co#80:\ + :bl=^G:cr=^M:do=^J:sf=^J: diff --git a/distrib/pmax/rdsetroot.c b/distrib/pmax/rdsetroot.c new file mode 100644 index 00000000000..436037a8afb --- /dev/null +++ b/distrib/pmax/rdsetroot.c @@ -0,0 +1,214 @@ +/* $OpenBSD: rdsetroot.c,v 1.1 1998/11/09 06:16:05 millert Exp $ */ +/* $NetBSD: rdsetroot.c,v 1.2 1995/10/13 16:38:39 gwr Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * All rights reserved. + * + * ELF modifications Copyright (c) 1997 Per Fogelstrom. + * + * 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. + */ + +/* + * 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 <nlist.h> +#include <sys/exec_elf.h> + +extern off_t lseek(); + +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; + +/* parameters to mmap digged out from program header */ +int mmap_offs; +int mmap_size; + +main(argc,argv) + char **argv; +{ + int fd, n; + int found; + int *ip; + char *cp; + Elf32_Ehdr eh; + Elf32_Phdr *ph; + int phsize; + + 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, &eh, sizeof(eh)); + if (n < sizeof(eh)) { + printf("%s: reading header\n", file); + exit(1); + } + + if (!IS_ELF(eh)) { + printf("%s: not elf\n", file); + exit(1); + } + + phsize = eh.e_phnum * sizeof(Elf32_Phdr); + ph = (Elf32_Phdr *)malloc(phsize); + lseek(fd, eh.e_phoff, 0); + if(read(fd, (char *)ph, phsize) != phsize) { + printf("%s: can't read phdr area\n", file); + exit(1); + } + found = 0; + for(n = 0; n < eh.e_phnum && !found; n++) { + if(ph[n].p_type == PT_LOAD) { + found = find_rd_root_image(file, &eh, &ph[n]); + } + } + if(!found) { + printf("%s: can't locate space for rd_root_image!", file); + exit(1); + } + + /* + * Map in the whole data segment. + * The file offset needs to be page aligned. + */ + dataseg = mmap(NULL, /* any address is ok */ + mmap_size, /* length */ + PROT_READ | PROT_WRITE, + MAP_SHARED, + fd, mmap_offs); + if ((long)dataseg == -1) { + printf("%s: can not map data seg\n", file); + perror(file); + exit(1); + } + + /* + * 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, mmap_size, 0); + +#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 }, +}; + +int +find_rd_root_image(file, eh, ph) + char *file; + Elf32_Ehdr *eh; + Elf32_Phdr *ph; +{ + int data_va; + int std_entry; + int kernel_start; + int kernel_size; + + if (nlist(file, wantsyms)) { + printf("%s: no rd_root_image symbols?\n", file); + exit(1); + } + kernel_start = ph->p_paddr; + kernel_size = ph->p_filesz; + + rd_root_size_off = wantsyms[0].n_value - kernel_start; + rd_root_image_off = wantsyms[1].n_value - kernel_start; + +#ifdef DEBUG + printf("rd_root_size_off = 0x%x\n", rd_root_size_off); + printf("rd_root_image_off = 0x%x\n", rd_root_image_off); +#endif + + /* + * Sanity check locations of db_* symbols + */ + if (rd_root_image_off < 0 || rd_root_image_off >= kernel_size) { + return(0); + } + if (rd_root_size_off < 0 || rd_root_size_off >= kernel_size) { + printf("%s: rd_root_size not in data segment?\n", file); + return(0); + } + mmap_offs = ph->p_offset; + mmap_size = kernel_size; + return(1); +} diff --git a/distrib/pmax/runlist.sh b/distrib/pmax/runlist.sh new file mode 100644 index 00000000000..2b94b14b7a0 --- /dev/null +++ b/distrib/pmax/runlist.sh @@ -0,0 +1,13 @@ +# $OpenBSD: runlist.sh,v 1.1 1998/11/09 06:16:06 millert Exp $ + +if [ "X$1" = "X-d" ]; then + SHELLCMD=cat + shift +else + SHELLCMD="sh" +fi + +( while [ "X$1" != "X" ]; do + cat $1 + shift +done ) | awk -f ${TOPDIR}/list2sh.awk | ${SHELLCMD} |