From fc865832f631f51299edd8a3aab93d37149c4343 Mon Sep 17 00:00:00 2001 From: oki Date: Mon, 17 Jun 1996 04:14:15 +0000 Subject: [PATCH] method of kernel-copy floppy --- distrib/x68k/floppies/kc-common/Makefile.inc | 50 ++++++++ .../x68k/floppies/kc-common/copy_kernel.sh | 113 ++++++++++++++++++ distrib/x68k/floppies/kc-common/dot.profile | 13 ++ distrib/x68k/floppies/kc-common/kcbin.conf | 16 +++ distrib/x68k/floppies/kc-common/list | 32 +++++ distrib/x68k/floppies/kc-common/mtree.conf | 36 ++++++ distrib/x68k/floppies/kc/Makefile | 8 ++ distrib/x68k/floppies/kc/list | 4 + 8 files changed, 272 insertions(+) create mode 100644 distrib/x68k/floppies/kc-common/Makefile.inc create mode 100644 distrib/x68k/floppies/kc-common/copy_kernel.sh create mode 100644 distrib/x68k/floppies/kc-common/dot.profile create mode 100644 distrib/x68k/floppies/kc-common/kcbin.conf create mode 100644 distrib/x68k/floppies/kc-common/list create mode 100644 distrib/x68k/floppies/kc-common/mtree.conf create mode 100644 distrib/x68k/floppies/kc/Makefile create mode 100644 distrib/x68k/floppies/kc/list diff --git a/distrib/x68k/floppies/kc-common/Makefile.inc b/distrib/x68k/floppies/kc-common/Makefile.inc new file mode 100644 index 000000000000..61f1140cdc69 --- /dev/null +++ b/distrib/x68k/floppies/kc-common/Makefile.inc @@ -0,0 +1,50 @@ +# $Id: Makefile.inc,v 1.1 1996/06/17 04:14:18 oki Exp $ + +# TOP is assumed to be defined by Makefile including this one. + +CBIN= kcbin +COMMONDIR= ${TOP}/kc-common + +MOUNT_POINT?= /mnt +VND?= vnd0 +VND_DEV= /dev/${VND}c +VND_RDEV= /dev/r${VND}c +IMAGE?= xxx-${REV}.fs +MDEC= ${DESTDIR}/usr/mdec + +LISTS= ${COMMONDIR}/list ${.CURDIR}/list +CRUNCHCONF= ${COMMONDIR}/${CBIN}.conf +MTREE= ${COMMONDIR}/mtree.conf + +all: ${CBIN} + dd if=/dev/zero of=${IMAGE} bs=100k count=12 + vnconfig -v -c ${VND_DEV} ${IMAGE} + dd if=${MDEC}/fdboot of=${VND_RDEV} conv=sync + newfs -O -m 0 -o space -i 6144 -c 80 ${VND_RDEV} floppy5 + mount ${VND_DEV} ${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} + vnconfig -u ${VND_DEV} + cat /*bin/* > /dev/null + +unconfig: + -umount -f ${MOUNT_POINT} + -vnconfig -u ${VND_DEV} + -/bin/rm -f ${IMAGE} + +${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CRUNCHCONF} + crunchgen -D ${TOP}/../../.. -L ${DESTDIR}/usr/lib ${CRUNCHCONF} + +${CBIN}: ${CBIN}.mk ${CBIN}.cache ${CBIN}.c + make -f ${CBIN}.mk all + +clean cleandir: + /bin/rm -f core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache *.o *.lo *.c + +.include +.include diff --git a/distrib/x68k/floppies/kc-common/copy_kernel.sh b/distrib/x68k/floppies/kc-common/copy_kernel.sh new file mode 100644 index 000000000000..66450050cd3e --- /dev/null +++ b/distrib/x68k/floppies/kc-common/copy_kernel.sh @@ -0,0 +1,113 @@ +# $Id: copy_kernel.sh,v 1.1 1996/06/17 04:14:19 oki Exp $ +# +# Kernel copy script + +DEFAULT_PARTITON=sd0a +MOUNT_POINT=/mnt +KERNEL_NAME=/netbsd +#TEST=testfn + +testfn() { + echo $* + sleep 5 +} + +cancel() { + echo "" + echo "Copy cancelled." + exit 1 +} + +umountfs() { + echo "Unmounting filesystem; please wait." + trap 2 3 + ${TEST} umount ${MOUNT_POINT} + case $? in + 0) + ;; + *) + echo "Warning: Unmount of ${MOUNT_POINT} failed." + ;; + esac +} + +warning() { + echo "" + echo "Copy failed or was interrupted." + echo "Warning: Copied kernel my be corrupted!" +} + +trap "cancel;" 2 3 +echo "NetBSD kernel copy program" +echo "" +echo "Default answers are displayed in brackets. You may hit Control-C" +echo "at any time to cancel this operation (though if you hit Control-C at" +echo "a prompt, you need to hit return for it to be noticed)." + +echo "" +echo "What disk partition should the kernel be installed on?" +echo "(For example, \"sd0a\", \"wd0a\", etc.)" +echo "" +echo -n "Partition? [${DEFAULT_PARTITON}] " +read diskpart +if [ "X${diskpart}" = "X" ]; then + diskpart=${DEFAULT_PARTITON} +fi +rawdiskpart="r${diskpart}" + +echo "" +echo -n "Are you sure you want to copy a new kernel to ${diskpart}? [n] " +read reply +case ${reply} in +y*|Y*) + ;; +*) + cancel + ;; +esac + +echo "" +echo "Checking ${diskpart} partition; please wait." +${TEST} fsck -p "/dev/${rawdiskpart}" +case $? in +0) + ;; +*) + echo "File system check failed or aborted!" + cancel + ;; +esac + +echo "Mounting /dev/${diskpart} on ${MOUNT_POINT}." +trap "echo ''; umountfs; cancel;" 2 3 +${TEST} mount "/dev/${diskpart}" ${MOUNT_POINT} +case $? in +0) + ;; +*) + echo "Mount failed!" + cancel + ;; +esac + +echo "Copying kernel to ${MOUNT_POINT}." +trap "warning; umountfs; cancel;" 2 3 +${TEST} cp ${KERNEL_NAME} ${MOUNT_POINT} +case $? in +0) + ;; +*) + warning + umountfs + cancel + ;; +esac + +umountfs + +echo "" +echo "Copy completed." +echo "" +echo "Use \"halt\" to halt the system, then (when the system is halted)" +echo "eject the floppy disk and hit any key to reboot from the hard disk." +exit 0 diff --git a/distrib/x68k/floppies/kc-common/dot.profile b/distrib/x68k/floppies/kc-common/dot.profile new file mode 100644 index 000000000000..61e2ca6b364e --- /dev/null +++ b/distrib/x68k/floppies/kc-common/dot.profile @@ -0,0 +1,13 @@ +# $Id: dot.profile,v 1.1 1996/06/17 04:14:19 oki Exp $ + +PATH=/sbin:/bin:/ +export PATH + +if [ "X${DONEPROFILE}" = "X" ]; then + DONEPROFILE=YES + + echo -n "Enter 'copy_kernel' at the prompt to copy a kernel to your " + echo "hard disk," + echo "'reboot' to reboot the system, or 'halt' to halt the system." + echo "" +fi diff --git a/distrib/x68k/floppies/kc-common/kcbin.conf b/distrib/x68k/floppies/kc-common/kcbin.conf new file mode 100644 index 000000000000..6bc39a44a544 --- /dev/null +++ b/distrib/x68k/floppies/kc-common/kcbin.conf @@ -0,0 +1,16 @@ +# +# kcbin.conf - unified binary for the kc floppy +# $Id: kcbin.conf,v 1.1 1996/06/17 04:14:20 oki Exp $ +# + +srcdirs bin sbin + +progs cp dd disklabel fsck_ffs init mount mount_ffs reboot sh test umount + +ln fsck_ffs fsck +ln test [ +ln mount_ffs ffs +ln reboot halt +ln sh -sh # init invokes the shell this way + +libs -ledit -lutil -ltermcap -lcrypt -ll diff --git a/distrib/x68k/floppies/kc-common/list b/distrib/x68k/floppies/kc-common/list new file mode 100644 index 000000000000..1792eb20625f --- /dev/null +++ b/distrib/x68k/floppies/kc-common/list @@ -0,0 +1,32 @@ +# $Id: list,v 1.1 1996/06/17 04:14:21 oki Exp $ + +# copy the crunched binary, link to it, and kill it +COPY ${OBJDIR}/kcbin kcbin +LINK kcbin bin/cp +LINK kcbin bin/dd +LINK kcbin bin/sh +LINK kcbin bin/test +LINK kcbin bin/[ +LINK kcbin sbin/disklabel +LINK kcbin sbin/fsck +LINK kcbin sbin/fsck_ffs +LINK kcbin sbin/halt +LINK kcbin sbin/init +LINK kcbin sbin/mount +LINK kcbin sbin/mount_ffs +LINK kcbin sbin/reboot +LINK kcbin sbin/umount +SPECIAL /bin/rm kcbin + +# copy the MAKEDEV script and make some devices +COPY ${CURDIR}/../../../../etc/etc.x68k/MAKEDEV dev/MAKEDEV +SPECIAL cd dev; sh MAKEDEV floppy +SPECIAL /bin/rm dev/MAKEDEV + +# we need the contents of /usr/mdec +COPYDIR ${DESTDIR}/usr/mdec usr/mdec + +# copy the common kc-floppy tools +COPY ${TOPDIR}/kc-common/dot.profile .profile +COPY ${TOPDIR}/kc-common/copy_kernel.sh copy_kernel +SPECIAL chmod 755 copy_kernel diff --git a/distrib/x68k/floppies/kc-common/mtree.conf b/distrib/x68k/floppies/kc-common/mtree.conf new file mode 100644 index 000000000000..7ec4f69393a3 --- /dev/null +++ b/distrib/x68k/floppies/kc-common/mtree.conf @@ -0,0 +1,36 @@ +# $Id: mtree.conf,v 1.1 1996/06/17 04:14:22 oki Exp $ + +/set type=dir uname=root gname=wheel mode=0755 +# . +. + +# ./bin +bin +# ./bin +.. + +# ./dev +dev +# ./dev +.. + +#./mnt +mnt +# ./mnt +.. + +# ./sbin +sbin +# ./sbin +.. + +# ./usr +usr + +# ./usr/mdec +mdec +# ./usr/mdec +.. + +# ./usr +.. diff --git a/distrib/x68k/floppies/kc/Makefile b/distrib/x68k/floppies/kc/Makefile new file mode 100644 index 000000000000..785e74edddfe --- /dev/null +++ b/distrib/x68k/floppies/kc/Makefile @@ -0,0 +1,8 @@ +# $Id: Makefile,v 1.1 1996/06/17 04:14:15 oki Exp $ + +TOP= ${.CURDIR}/.. + +.include "${TOP}/Makefile.inc" +IMAGE= kc${REV}.fs + +.include "${TOP}/kc-common/Makefile.inc" diff --git a/distrib/x68k/floppies/kc/list b/distrib/x68k/floppies/kc/list new file mode 100644 index 000000000000..4a017616958a --- /dev/null +++ b/distrib/x68k/floppies/kc/list @@ -0,0 +1,4 @@ +# $Id: list,v 1.1 1996/06/17 04:14:16 oki Exp $ + +# copy the kernel +COPY ${CURDIR}/../../../../sys/arch/x68k/compile/GENERIC/netbsd netbsd