diff -urN release.orig/Makefile release/Makefile --- release.orig/Makefile Thu Oct 23 13:54:31 2003 +++ release/Makefile Fri Feb 20 21:49:48 2004 @@ -256,6 +256,10 @@ cd ${.CURDIR}/..; ${CROSSMAKE} -f Makefile.inc1 -V WMAKEENV WMAKE= ${WMAKEENV} ${MAKE} +# ========= CDBSD support ========= +# extra devices for /dev on CDROM (Typical RAID cards, etc.) +CDBSD_MAKEDEVS= aacd0 amrd0 idad0 mlxd0 + rerelease release: .if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT) @echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false @@ -681,6 +685,91 @@ @rm mfsroot mfsroot.gz @echo "Regular and MFS boot floppies made." touch release.9 + +# CDBSD - cdbsd-prepare: +# put CDBSD kernel config file at src/sys/${TARGET_ARCH}/conf/CDBSD, +# and don't forget to run "make buildworld" at src/ top directory + +cdbsd-prepare: release.1 + -rm -rf ${RD}/cdbsd 2> /dev/null + -chflags -R noschg ${RD}/cdbsd + rm -rf ${RD}/cdbsd + @mkdir -p ${RD}/cdbsd + @mkdir -p ${RD}/cdbsd/fd + @mkdir -p ${RD}/cdbsd/hd + @mkdir -p ${RD}/cdbsd/fatfs + @mkdir -p ${RD}/cdbsd/ntfs + @cd ${.CURDIR}/../ && \ + make installworld DESTDIR=${RD}/cdbsd + @cd ${.CURDIR}/../etc/ && \ + make distribution DESTDIR=${RD}/cdbsd + @cd ${RD}/cdbsd/dev/ && \ + sh MAKEDEV ${CDBSD_MAKEDEVS} + @mkdir -p ${RD}/cdbsd/usr/ports + @cd ${RD}/cdbsd/usr/ports/ && \ + tar -C /usr/ports --exclude distfiles --exclude work -cf - . |\ + tar -xvf - + @mkdir -p ${RD}/cdbsd/usr/local/sbin + @install -c -o root -g wheel -m 0755 ${.CURDIR}/cdbsd/mkrwfs.sh ${RD}/cdbsd/usr/local/sbin + @install -c -o root -g wheel -m 0644 ${.CURDIR}/cdbsd/rc.cdrom ${RD}/cdbsd/etc + @cp ${.CURDIR}/../etc/rc . && patch -p0 < ${.CURDIR}/cdbsd/rc.diff + @install -c -o root -g wheel -m 0644 rc ${RD}/cdbsd/etc + @install -c -o root -g wheel -m 0644 ${.CURDIR}/cdbsd/fstab ${RD}/cdbsd/etc + +# CDBSD - cdbsd-configure: +# configure CDROM image in the chroot'ed tree. + +cdbsd-configure: + @echo "Chroot to cdbsd directory. Type 'exit' to finish the configuration." + @echo "Setting root password with 'passwd root' is strongly recommended." + @echo "Unique parameters of host OS (e.g.: hostname, etc.) cannot be changed." + @echo "If you need to change such parameters in chrooted environment, please" + @echo "create alias IPaddr and use cdbsd-configure-jail target instead." + @cd ${RD}/cdbsd/&& chroot . + +cdbsd-configure-jail: + @echo "Not yet implemented, sorry." + +# CDBSD - cdbsd-image: +# create ISO-9660 image for CDBSD + +cdbsd-image: none.flp + @cp ${RD}/floppies/none.flp ${RD}/cdbsd/ + @mkdir -p ${RD}/cdroms + mkisofs -A "CDBSD" -R -J -b none.flp -c boot.catalog -o ${RD}/cdroms/cdbsd.iso -x ${RD}/cdbsd/usr/ports ${RD}/cdbsd + +none.flp: release.1 + @cd ${.CURDIR}/../sys/boot/ && \ + ${MAKE} obj all install DESTDIR=${RD}/trees/bin + @cd ${.CURDIR} && ${MAKE} none + +none: + -vnconfig 2>/dev/null + cd ${.CURDIR}/..; \ + INSTKERNNAME=CDBSDKERN \ + ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES -DNO_KERNELCLEAN \ + KERNCONF=CDBSD buildkernel reinstallkernel \ + DESTDIR=${RD}/kernels + @rm -rf ${RD}/image.none + @mkdir ${RD}/image.none + @cd ${RD}/kernels && \ + (chflags noschg CDBSDKERN || true) && \ + ${WMAKEENV} strip -R .comment CDBSDKERN + mv ${RD}/kernels/CDBSDKERN ${RD}/image.none/kernel + @mkdir -p ${RD}/image.none/boot + @mkdir -p ${RD}/image.none/etc + echo "/dev/acd0a / cd9660 ro 0 0" >> ${RD}/image.none/etc/fstab +.if ${TARGET} == "i386" + @kgzip -vo ${RD}/image.none/boot/loader ${RD}/trees/bin/boot/loader +.else + @cp ${RD}/trees/bin/boot/loader ${RD}/image.none/boot +.endif + @gzip -9v ${RD}/image.none/kernel + @rm -f ${RD}/floppies/none.flp + sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/none.flp \ + ${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.none \ + ${BOOTINODE} ${BIGBOOTLABEL} + @echo "CDBSD boot floppy made." # # --==## Create a fixit floppy ##==-- diff -urN release.orig/cdbsd/fstab release/cdbsd/fstab --- release.orig/cdbsd/fstab Thu Jan 1 09:00:00 1970 +++ release/cdbsd/fstab Fri Feb 20 23:26:18 2004 @@ -0,0 +1,16 @@ +/dev/acd0c / cd9660 ro 0 0 +/dev/fd0a /fd msdos rw,noauto 0 0 +proc /proc procfs rw 0 0 + +# examples for Windows partitions +#/dev/ad0s1 /fatfs msdos rw,noauto 0 0 +#/dev/ad0s1 /ntfs ntfs ro,noauto 0 0 + +# examples for normal FreeBSD partitions on HDD +#/dev/ad0s1a /hd ufs rw 0 0 +#/dev/ad0s1f /hd/tmp ufs rw 0 0 +#/dev/ad0s1g /hd/usr ufs rw 0 0 +#/dev/ad0s1e /hd/var ufs rw 0 0 + +# if you want to use HD swap, uncomment next line +#/dev/ad0s1b none swap sw 0 0 diff -urN release.orig/cdbsd/mkrwfs.sh release/cdbsd/mkrwfs.sh --- release.orig/cdbsd/mkrwfs.sh Thu Jan 1 09:00:00 1970 +++ release/cdbsd/mkrwfs.sh Thu Feb 19 19:12:45 2004 @@ -0,0 +1,38 @@ +#!/bin/sh + +# mkrwfs.sh is a script to change read-only file system directory to +# writable directory by MFS (Memory File System). Files and directories +# in the old directory are saved. +# +# usage: +# mkrwfs.sh [directory] +# +# You can specify the directory absolutely or relatively. + +dir=$1 + +case $dir in +/*) + # dir is absolute directory. + absodir=$dir + ;; +*) + # dir is relative directory. + absodir=`/bin/pwd`/$dir + ;; +esac + +if [ -d $dir ]; then + # Backup files and directories in old directory. + /usr/bin/tar czPf /tmp/mkrwfs.tmp.tgz $dir + + /sbin/mount_mfs -s 4096 -T qp120at dummy $absodir + /bin/chmod 755 $dir + + # Restore the files and directories. + /usr/bin/tar xzPf /tmp/mkrwfs.tmp.tgz + rm -f /tmp/mkrwfs.tmp.tgz +else + echo "$absodir: cannot mount to MFS. (not found)" +fi + diff -urN release.orig/cdbsd/rc.cdrom release/cdbsd/rc.cdrom --- release.orig/cdbsd/rc.cdrom Thu Jan 1 09:00:00 1970 +++ release/cdbsd/rc.cdrom Thu Feb 19 19:12:50 2004 @@ -0,0 +1,117 @@ +# chkerr: +# +# Routine to check for error +# +# checks error code and drops into shell on failure. +# if shell exits, terminates script as well as /etc/rc. +# +chkerr() { + case $1 in + 0) + ;; + *) + echo "$2 failed: dropping into /bin/sh" + /bin/sh + # RESUME + ;; + esac +} + +# Create an MFS /tmp to temporarily hold files from /etc until we +# can bootstrap /etc as an MFS. + +/sbin/mount_mfs -s 4096 -T qp120at dummy /tmp +chkerr $? "MFS mount on /tmp" +/bin/cp -Rp /etc /tmp +chkerr $? "cp /etc to /tmp/etc MFS" + +/sbin/mount_mfs -s 4096 -T qp120at dummy /etc +chkerr $? "MFS mount on /etc" +/bin/chmod 755 /etc + +/bin/cp -Rp /tmp/etc / +chkerr $? "cp /tmp/etc to /etc MFS" + +rm -rf /tmp/etc + +# Create an MFS /root + +if [ -d /root ]; then + /bin/cp -Rp /root /tmp + chkerr $? "cp /root to /tmp/root MFS" + + /sbin/mount_mfs -s 4096 -T qp120at dummy /root + chkerr $? "MFS mount on /root" + /bin/chmod 755 /root + + /bin/cp -Rp /tmp/root / + chkerr $? "cp /tmp/root to /root MFS" + + rm -rf /tmp/root +fi + +# Create an MFS /home + +if [ -d /home ]; then + /bin/cp -Rp /home /tmp + chkerr $? "cp /home to /tmp/home MFS" + + /sbin/mount_mfs -s 4096 -T qp120at dummy /home + chkerr $? "MFS mount on /home" + /bin/chmod 755 /home + + /bin/cp -Rp /tmp/home / + chkerr $? "cp /tmp/home to /home MFS" + + rm -rf /tmp/home +fi + +#/sbin/umount /tmp + +# check FD inserted +dd if=/dev/fd0a of=/dev/null count=1 > /dev/null 2>&1 +case $? in +0) + echo "FD inserted. Now trying to mount FD." + if /sbin/mount -t msdos /dev/fd0a /mnt > /dev/null 2>&1 ; then + echo "FD mounted as msdosfs" + if [ -d /mnt/etc ] ; then + echo "Found /etc on FD. Now copying FD to /etc" + /bin/cp -Rp /mnt/etc / + chkerr $? "cp /etc on FD to /etc MFS" + else + echo "Not found /etc on FD" + fi + /sbin/umount /mnt + chkerr $? "Unmounted FD" + elif /sbin/mount -t ufs /dev/fd0a /mnt > /dev/null 2>&1 ; then + echo "FD mounted as ufs" + if [ -d /mnt/etc ] ; then + echo "Found /etc on FD. Now copying FD to /etc" + /bin/cp -Rp /mnt/etc / + chkerr $? "cp /etc on FD to /etc MFS" + else + echo "Not found /etc on FD" + fi + /sbin/umount /mnt + chkerr $? "Unmounted FD" + elif /usr/bin/gzip -cd /dev/fd0a > /tmp/fd_etc.tar 2> /dev/null ; then + if /usr/bin/tar xf /tmp/fd_etc.tar -C /etc > /dev/null 2>&1 ; then + echo "/etc extracted from FD as tar+gzip archive" + else + echo "FD not tar+gzip format" + fi + rm -f /tmp/fd_etc.tar + elif /usr/bin/tar xf /dev/fd0a -C /etc > /dev/null 2>&1 ; then + echo "/etc extracted from FD as tar archive" + else + echo "Unknown format FD" + fi + ;; +*) + echo "No FD inserted" + ;; +esac + +# /var, /dev mount by MFS. +diskless_mount="/etc/rc.diskless2" diff -urN release.orig/cdbsd/rc.diff release/cdbsd/rc.diff --- release.orig/cdbsd/rc.diff Thu Jan 1 09:00:00 1970 +++ release/cdbsd/rc.diff Fri Feb 20 07:54:32 2004 @@ -0,0 +1,15 @@ +--- rc.orig Fri Feb 20 07:54:14 2004 ++++ rc Thu Feb 19 19:13:03 2004 +@@ -52,6 +52,12 @@ + PATH=/sbin:/bin:/usr/sbin:/usr/bin + export HOME PATH + ++# for CD-ROM boot. ++# ++if [ -r /etc/rc.cdrom ]; then ++ . /etc/rc.cdrom ++fi ++ + # BOOTP diskless boot. We have to run the rc file early in order to + # retarget various config files. + # See /usr/share/examples/diskless/clone_root for details on how