From d7ea61788c5bf002ca87cdc74d169ccec43e17f3 Mon Sep 17 00:00:00 2001 From: downsj Date: Mon, 21 Apr 1997 07:32:11 +0000 Subject: [PATCH] Lots of changes... * Build via a vnd, ala i386. * Remove most of the sleep calls and all of the background processing. * Add the notion of `kernel sets'. * Add a couple more binaries to the ramdisk. --- distrib/hp300/ramdisk/Makefile | 100 ++++++++++++------------ distrib/hp300/ramdisk/install.md | 43 ++-------- distrib/hp300/ramdisk/install.sh | 19 ++--- distrib/hp300/ramdisk/install.sub | 77 +++++++++++++----- distrib/hp300/ramdisk/raminst.conf | 10 +-- distrib/hp300/ramdisk/start_rdconfig.sh | 4 - 6 files changed, 127 insertions(+), 126 deletions(-) delete mode 100644 distrib/hp300/ramdisk/start_rdconfig.sh diff --git a/distrib/hp300/ramdisk/Makefile b/distrib/hp300/ramdisk/Makefile index 2269947b72c..e713fc6e1d4 100644 --- a/distrib/hp300/ramdisk/Makefile +++ b/distrib/hp300/ramdisk/Makefile @@ -1,19 +1,21 @@ -# $OpenBSD: Makefile,v 1.2 1997/02/23 19:10:50 downsj Exp $ +# $OpenBSD: Makefile,v 1.3 1997/04/21 07:32:11 downsj Exp $ # $NetBSD: Makefile,v 1.1 1995/07/18 04:13:06 briggs Exp $ TOP= ${.CURDIR}/.. .include "${TOP}/Makefile.inc" -IMAGE= miniroot-${REV}.fs +IMAGE= ramdisk-${REV}.fs CRUNCHCONF?= ${.CURDIR}/${CBIN}.conf BASE=miniroot -MOUNT_POINT= /mnt1 -BDEV= /dev/rd0a -CDEV= /dev/rrd0a -RDEV= /dev/rd0c +MOUNT_POINT= /mnt -KERNEL= ${SRCSYSDIR}/arch/hp300/compile/RAMDISK/bsd +VND?= vnd0 +VND_DEV= /dev/${VND}a +VND_RDEV= /dev/r${VND}a +VND_CRDEV= /dev/r${VND}c +PID!= echo $$$$ +REALIMAGE!= echo /tmp/image.${PID} all: ${CBIN} ${IMAGE} @echo "all done" @@ -22,55 +24,49 @@ all: ${CBIN} ${IMAGE} DISKTYPE= rdroot NBLKS= 4096 -# old format, minfree, opt, b/i trks, sects, cpg -#NEWFSARGS= -t ffs -m 0 -o space -u 32 -c 16 - -${IMAGE}: do_prep do_mount do_files do_umount_copy do_unconfig - mv -f ${IMAGE}.tmp ${IMAGE} - if [ -e ${.CURDIR}/${__objdir}/rd.pid ] ; then \ - kill `< ${.CURDIR}/${__objdir}/rd.pid`; \ - rm ${.CURDIR}/${__objdir}/rd.pid;\ - fi - -rdsetroot: ${TOP}/common/rdsetroot.c - ${HOSTCC} -o rdsetroot ${TOP}/common/rdsetroot.c - -setroot: ${IMAGE} bsd - ${.CURDIR}/${__objdir}/rdsetroot bsd < ${IMAGE} - -bsd: ${KERNEL} - cp ${KERNEL} bsd - -writetape: - echo rewinding tape < /dev/rst0 - buffer -i /usr/mdec/stboot -o /dev/nrst0 - buffer -i /usr/mdec/bootst -o /dev/nrst0 - buffer -B -p75 -i bsd -o /dev/nrst0 - echo rewinding tape < /dev/rst0 - - -do_prep: ${CBIN} do_unconfig - sh ${.CURDIR}/start_rdconfig.sh ${RDEV} ${NBLKS} - disklabel -w -r ${RDEV} ${DISKTYPE} - -do_mount: - -newfs ${NEWFSARGS} -s ${NBLKS} ${CDEV} ${DISKTYPE} - mount ${BDEV} ${MOUNT_POINT} - -do_umount_copy: - @echo "" +# minfree, opt, b/i trks, sects, cpg +NEWFSARGS= -m 0 -o space -c 16 -i 4096 + +bsd.gz: bsd.rd + gzip -c9 bsd.rd > bsd.gz + +bsd.rd: ${IMAGE} bsd rdsetroot + cp bsd bsd.rd + ${.OBJDIR}/rdsetroot bsd.rd < ${IMAGE} + +bsd: +# cd ${.CURDIR}/../../../sys/arch/hp300/conf && config RAMDISK +# cd ${.CURDIR}/../../../sys/arch/hp300/compile/RAMDISK && \ +# make clean && make depend && make + cp ${.CURDIR}/../../../sys/arch/hp300/compile/RAMDISK/bsd bsd + +${IMAGE}: ${CBIN} rd_setup do_files rd_teardown + +rd_setup: ${CBIN} + dd if=/dev/zero of=${REALIMAGE} bs=512 count=${NBLKS} + vnconfig -v -c ${VND} ${REALIMAGE} + disklabel -w -r ${VND} ${DISKTYPE} + newfs ${NEWFSARGS} ${VND_RDEV} ${DISKTYPE} + fsck ${VND_RDEV} + mount ${VND_DEV} ${MOUNT_POINT} + +rd_teardown: @df -i ${MOUNT_POINT} - @echo "" + sync + cat /*bin/* > /dev/null + sync -umount ${MOUNT_POINT} - dd if=${CDEV} of=${IMAGE}.tmp bs=4b count=`expr ${NBLKS} / 4 ` + -vnconfig -u ${VND} + cp ${REALIMAGE} ${IMAGE} + rm ${REALIMAGE} -do_unconfig: - -umount ${MOUNT_POINT} - if [ -e ${.CURDIR}/${__objdir}/rd.pid ] ; then \ - kill `< ${.CURDIR}/${__objdir}/rd.pid`; \ - rm ${.CURDIR}/${__objdir}/rd.pid; \ - fi +rdsetroot: ${TOP}/../common/rdsetroot.c + ${HOSTCC} -DDEBUG -o rdsetroot ${TOP}/../common/rdsetroot.c +unconfig: + -umount -f ${MOUNT_POINT} + -vnconfig -u ${VND} + -/bin/rm -f ${IMAGE} .PRECIOUS: ${IMAGE} diff --git a/distrib/hp300/ramdisk/install.md b/distrib/hp300/ramdisk/install.md index 271aadca727..9d021888e8c 100644 --- a/distrib/hp300/ramdisk/install.md +++ b/distrib/hp300/ramdisk/install.md @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: install.md,v 1.3 1997/02/23 19:10:52 downsj Exp $ +# $OpenBSD: install.md,v 1.4 1997/04/21 07:32:11 downsj Exp $ # $NetBSD: install.md,v 1.1.2.4 1996/08/26 15:45:14 gwr Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -275,7 +275,7 @@ __scsi_label_1 getresp "" disklabel -W ${1} - if ! disklabel -e /dev/r${1}a; then + if ! disklabel -r -e /dev/r${1}a; then echo "" echo "ERROR: can't fixup geometry!" rval="1" @@ -371,7 +371,7 @@ md_labeldisk() { 0) # Go ahead and just edit the disklabel. disklabel -W $1 - disklabel -e $1 + disklabel -r -e $1 ;; *) @@ -406,7 +406,7 @@ md_labeldisk() { # We have some defaults installed. Pop into # the disklabel editor. disklabel -W $1 - if ! disklabel -e $1; then + if ! disklabel -r -e $1; then echo "" echo "ERROR: couldn't set partition map for $1" echo "" @@ -467,43 +467,10 @@ __md_prep_disklabel_1 echo -n "Press [Enter] to continue " getresp "" disklabel -W ${_disk} - disklabel -e ${_disk} + disklabel -r -e ${_disk} } md_copy_kernel() { - if [ -d "$SETSDIR" ]; then - # `bsd' is prefered over `bsd.gz' - if [ -f "$SETSDIR/bsd" ]; then - kernfile="$SETSDIR/bsd" - dogzip="" - elif [ -f "$SETSDIR/bsd.gz" ]; then - kernfile="$SETSDIR/bsd.gz" - dogzip="yes" - elif [ -f "$SETSDIR/bsd-gen" ]; then - kernfile="$SETSDIR/bsd-gen" - dogzip="" - elif [ -f "$SETSDIR/bsd-gen.gz" ]; then - kernfile="$SETSDIR/bsd-gen.gz" - dogzip="yes" - else - echo "Couldn't find a kernel file in $SETSDIR." - echo "You will have to copy a kernel by hand." - return - fi - - # Copy in the kernel. - echo -n "Copying kernel $kernfile..." - if [ "$dogzip" ]; then - gzip -d < $kernfile > /mnt/bsd - else - cp $kernfile /mnt/bsd - fi - chmod 755 /mnt/bsd - echo " done." - else - echo "Couldn't find $SETSDIR." - echo "You will have to copy a kernel by hand." - fi } # Note, while they might not seem machine-dependent, the diff --git a/distrib/hp300/ramdisk/install.sh b/distrib/hp300/ramdisk/install.sh index 415879a02d9..10d7018b65e 100644 --- a/distrib/hp300/ramdisk/install.sh +++ b/distrib/hp300/ramdisk/install.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: install.sh,v 1.2 1997/02/23 19:10:52 downsj Exp $ +# $OpenBSD: install.sh,v 1.3 1997/04/21 07:32:12 downsj Exp $ # $NetBSD: install.sh,v 1.5.2.8 1996/08/27 18:15:05 gwr Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -91,10 +91,10 @@ echo -n "Is this a (s)napshot or (r)elease? [s] " getresp "s" case "$resp" in s*|S*) - THESETS="$SNAPSETS" + THESETS="$SNAPSETS $KERNSETS" ;; r*|R*) - THESETS="$ALLSETS" + THESETS="$ALLSETS $KERNSETS" ;; *) md_not_going_to_install @@ -401,12 +401,13 @@ install_sets $ALLSETS $MDSETS if [ ! -x /mnt/dev/MAKEDEV ]; then echo "No /dev/MAKEDEV installed, something is wrong here..." else - echo -n "Making devices..." - pid=`twiddle` - cd /mnt/dev - sh MAKEDEV all - kill $pid - echo "done." + # Check if a device exists... snapshots have a dev.tar.gz + if [ ! -e /mnt/dev/rsd0a ]; then + echo -n "Making devices..." + cd /mnt/dev + sh MAKEDEV all + echo "done." + fi fi md_copy_kernel diff --git a/distrib/hp300/ramdisk/install.sub b/distrib/hp300/ramdisk/install.sub index 2b100052f32..13df8c0022c 100644 --- a/distrib/hp300/ramdisk/install.sub +++ b/distrib/hp300/ramdisk/install.sub @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: install.sub,v 1.3 1997/02/23 19:10:53 downsj Exp $ +# $OpenBSD: install.sub,v 1.4 1997/04/21 07:32:12 downsj Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -40,12 +40,13 @@ # OpenBSD installation/upgrade script - common subroutines. ROOTDISK="" # filled in below -VERSION=2.0 # filled in automatically (see list) +VERSION=2.1 # filled in automatically (see list) export VERSION ALLSETS="base comp etc games man misc text" # default install sets UPGRSETS="base comp games man misc text" # default upgrade sets SNAPSETS="bin dev etc sbin usr.bin usr.games usr.include usr.lib usr.libexec usr.misc usr.sbin usr.share var" # default snapshot tarfiles +KERNSETS="bsd-gen bsd-dl" # kernel sets THESETS= # one of the above local_sets_dir="" # Path searched for sets by install_sets @@ -163,20 +164,14 @@ dir_has_sets() { if [ -f $_dir/${_file}.tgz ]; then return 0 fi + # Kernel sets... + if [ -f $_dir/${_file}.gz ]; then + return 0 + fi done return 1 } -twiddle() { -# spin the propeller so we don't get bored - while : ; do - sleep 1; echo -n "\010/"; - sleep 1; echo -n "\010-"; - sleep 1; echo -n "\010\\\\"; - sleep 1; echo -n "\010|"; - done >> /dev/tty & echo $! -} - get_localdir() { # $1 is relative mountpoint local _mp @@ -598,9 +593,6 @@ __install_ftp_2 install_from_mounted_fs() { # $1 - directory containing installation sets - # We need to export the final path to the istall sets - SETSDIR=$1 - export SETSDIR local _filename local _sets @@ -608,12 +600,15 @@ install_from_mounted_fs() { local _f _sets="" + _ksets="" if dir_has_sets $1 $THESETS; then for _f in $THESETS ; do if [ -f $1/${_f}.tar.gz ]; then _sets="$_sets ${_f}.tar.gz" elif [ -f $1/${_f}.tgz ]; then _sets="$_sets ${_f}.tgz" + elif [ -f $1/${_f}.gz ]; then + _ksets="$_ksets ${_f}.gz" fi done else @@ -665,6 +660,54 @@ install_from_mounted_fs() { _setsdone="$_f $_setsdone" done + + while : ; do + echo "The following kernel sets are available for extraction:" + echo "NOTE: Only one kernel set should be extracted. The" + echo "final one extracted will be the booted kernel." + echo "(marked sets have already been extracted)" + echo "" + + _next="" + for _f in $_ksets ; do + if isin $_f $_setsdone; then + echo -n "[X] " + _next="" + else + echo -n " " + if [ -z "$_next" ]; then _next=$_f; fi + fi + echo $_f + done + echo "" + + # Get the name of the file. + if [ "X$_next" = "X" ]; then resp=n; else resp=y; fi + echo -n "Continue extraction [$resp]?" + getresp "$resp" + if [ "$resp" = "n" ]; then + break + fi + + echo -n "File name [$_next]? " + getresp "$_next" + _f=$resp + _filename="/$1/$_f" + + # Ensure file exists + if [ ! -f $_filename ]; then + echo "File $_filename does not exist. Check to make" + echo "sure you entered the information properly." + continue + fi + + # Extract file + gzip -d < $_filename > /mnt/bsd + chmod 755 /mnt/bsd + echo "Extraction complete." + _setsdone="$_f $_setsdone" + + done } install_cdrom() { @@ -1275,9 +1318,7 @@ unmount_fs() if [ $_fast = 0 ]; then echo -n "Syncing disks..." - _pid=`twiddle` - sync; sleep 4; sync; sleep 2; sync; sleep 2 - kill $_pid + sync; sync; sync; sync echo "done." fi diff --git a/distrib/hp300/ramdisk/raminst.conf b/distrib/hp300/ramdisk/raminst.conf index 8dcd3ef4b21..7176457008a 100644 --- a/distrib/hp300/ramdisk/raminst.conf +++ b/distrib/hp300/ramdisk/raminst.conf @@ -1,16 +1,16 @@ # -# $OpenBSD: raminst.conf,v 1.2 1997/02/23 19:10:55 downsj Exp $ +# $OpenBSD: raminst.conf,v 1.3 1997/04/21 07:32:13 downsj Exp $ # $NetBSD: raminst.conf,v 1.3 1995/09/30 20:00:47 briggs Exp $ # # ram.conf - unified binary for the RAM disk # -srcdirs bin sbin usr.bin/less usr.bin usr.sbin gnu/usr.bin +srcdirs bin sbin usr.bin/less usr.bin usr.sbin gnu/usr.bin usr.sbin/pppd -progs awk cat chmod chown chroot cp cut dd df disklabel ed expr fsck_ffs ftp -progs grep gzip hostname ifconfig init kill less ln ls mkdir mknod mount +progs awk cat chat chmod chown chroot cp cut dd df disklabel ed expr fsck_ffs +progs ftp grep gzip hostname ifconfig init kill less ln ls mkdir mknod mount progs mount_cd9660 mount_ffs mount_kernfs mount_nfs -progs mv newfs pax pdksh ping pwd reboot rm route +progs mv newfs pax pdksh ping pppd pwd reboot rm route progs sed shutdown slattach sleep sort strings stty sync test tip umount progs restore vim diff --git a/distrib/hp300/ramdisk/start_rdconfig.sh b/distrib/hp300/ramdisk/start_rdconfig.sh deleted file mode 100644 index d22552b968e..00000000000 --- a/distrib/hp300/ramdisk/start_rdconfig.sh +++ /dev/null @@ -1,4 +0,0 @@ -echo rdconfig ${1} ${2} -rdconfig ${1} ${2} & -echo $! >rd.pid - -- 2.20.1