method of kernel-copy floppy

This commit is contained in:
oki 1996-06-17 04:14:15 +00:00
parent cc7e048040
commit fc865832f6
8 changed files with 272 additions and 0 deletions

View File

@ -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 <bsd.obj.mk>
.include <bsd.subdir.mk>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
..

View File

@ -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"

View File

@ -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