From 4868503a07e7bdfed27c6d43a80d6316ac76daae Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 22 Jul 1997 02:51:02 +0000 Subject: update the floppies directory to work better --- release/floppies/Makefile | 8 +- release/floppies/README.TXT | 33 ------ release/floppies/bin/Makefile | 7 ++ release/floppies/bin/doFS.sh | 71 ++++++++++++ release/floppies/bin/dumpnlist/Makefile | 8 ++ release/floppies/bin/dumpnlist/dumpnlist.c | 44 ++++++++ release/floppies/bin/write_mfs_in_kernel/Makefile | 8 ++ .../bin/write_mfs_in_kernel/write_mfs_in_kernel.c | 70 ++++++++++++ release/floppies/boot/crunch/Makefile | 2 +- release/floppies/boot/crunch/crunch.conf | 7 +- release/floppies/boot/floppy/Makefile | 48 ++++++--- release/floppies/boot/mfs/Makefile | 7 +- release/floppies/crunch_fs.mk | 107 ------------------ release/floppies/doFS.sh | 120 --------------------- release/floppies/fixit/crunch/Makefile | 2 +- release/floppies/fixit/crunch/crunch.conf | 14 +-- release/floppies/fixit/image/Makefile | 10 +- release/floppies/makecrunch.mk | 25 ----- release/floppies/mk/crunch_fs.mk | 108 +++++++++++++++++++ release/floppies/mk/makecrunch.mk | 25 +++++ release/floppies/write_mfs_in_kernel.c | 70 ------------ 21 files changed, 400 insertions(+), 394 deletions(-) delete mode 100644 release/floppies/README.TXT create mode 100644 release/floppies/bin/Makefile create mode 100644 release/floppies/bin/doFS.sh create mode 100644 release/floppies/bin/dumpnlist/Makefile create mode 100644 release/floppies/bin/dumpnlist/dumpnlist.c create mode 100644 release/floppies/bin/write_mfs_in_kernel/Makefile create mode 100644 release/floppies/bin/write_mfs_in_kernel/write_mfs_in_kernel.c delete mode 100644 release/floppies/crunch_fs.mk delete mode 100644 release/floppies/doFS.sh delete mode 100644 release/floppies/makecrunch.mk create mode 100644 release/floppies/mk/crunch_fs.mk create mode 100644 release/floppies/mk/makecrunch.mk delete mode 100644 release/floppies/write_mfs_in_kernel.c (limited to 'release') diff --git a/release/floppies/Makefile b/release/floppies/Makefile index 8d5b150..01629be 100644 --- a/release/floppies/Makefile +++ b/release/floppies/Makefile @@ -1,9 +1,7 @@ -# $Id$ +# $Id: Makefile,v 1.6 1997/07/16 12:24:13 julian Exp $ # -SUBDIR= boot fixit -PROG=write_mfs_in_kernel -NOMAN=yes +SUBDIR= bin boot fixit -.include +.include diff --git a/release/floppies/README.TXT b/release/floppies/README.TXT deleted file mode 100644 index 53fd6c8..0000000 --- a/release/floppies/README.TXT +++ /dev/null @@ -1,33 +0,0 @@ -For a normal CDROM or network installation, all you need to copy onto an -actual floppy from this directory is the boot.flp image (for 1.44MB floppies). - -NOTE: These images are NOT DOS files! You cannot simply copy them to -a DOS floppy as regular files, you need to *image* copy them to the -floppy with fdimage.exe under DOS or `dd' under UNIX. - -For example: - -To create the boot floppy image from DOS, you'd do something like -this: - -C> fdimage boot.flp a: - -Assuming that you'd copied fdimage.exe and boot.flp into a directory -somewhere. If you were doing this from the base of a CD distribution, -then the *exact* command would be: - -E> tools\fdimage floppies\boot.flp a: - - -If you're creating the boot floppy from a UNIX machine, you may find -that: - - dd if=floppies/boot.flp of=/dev/rfd0 - -or - - dd if=floppies/boot.flp of=/dev/floppy - -work well, depending on your hardware and operating system environment -(different versions of UNIX have totally different names for the -floppy drive - neat, huh? :-). diff --git a/release/floppies/bin/Makefile b/release/floppies/bin/Makefile new file mode 100644 index 0000000..15f5ebf --- /dev/null +++ b/release/floppies/bin/Makefile @@ -0,0 +1,7 @@ +# $Id: Makefile,v 1.1 1997/07/16 12:24:18 julian Exp $ +# +SUBDIR= write_mfs_in_kernel dumpnlist + +.include + + diff --git a/release/floppies/bin/doFS.sh b/release/floppies/bin/doFS.sh new file mode 100644 index 0000000..f0c2f2b --- /dev/null +++ b/release/floppies/bin/doFS.sh @@ -0,0 +1,71 @@ +: +#set -ex + +VNDEVICE=vn0 +export BLOCKSIZE=512 + +BOOTBLKDIR=$1 ; shift +MNT=$1 ; shift +FSSIZE=$1 ; shift +FSPROTO=$1 ; shift +FSINODE=$1 ; shift +FSLABEL=$1 ; shift + +deadlock=20 + +while true +do + rm -f fs-image + + if [ ! -b /dev/${VNDEVICE} -o ! -c /dev/r${VNDEVICE} ] ; then + ( cd /dev && sh MAKEDEV ${VNDEVICE} ) + fi + + umount /dev/${VNDEVICE} 2>/dev/null || true + + umount ${MNT} 2>/dev/null || true + + vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true + + dd of=fs-image if=/dev/zero count=${FSSIZE} bs=1k 2>/dev/null + # this suppresses the `invalid primary partition table: no magic' + awk 'BEGIN {printf "%c%c", 85, 170}' |\ + dd of=fs-image obs=1 seek=510 conv=notrunc 2>/dev/null + + vnconfig -s labels -c /dev/r${VNDEVICE} fs-image + + disklabel -Brw \ + -b ${BOOTBLKDIR}/boot1 \ + -s ${BOOTBLKDIR}/boot2 \ + /dev/r${VNDEVICE} minimum + + TPC=1 + CPD=1 + SPT=$(( 2 * $FSSIZE / 2)) + newfs -u ${SPT} -t ${TPC} -s $(( ${FSSIZE} * 2 )) -i ${FSINODE} -m 0 -o space /dev/r${VNDEVICE}c + + mount /dev/${VNDEVICE}c ${MNT} + + ( set -e && cd ${FSPROTO} && find . -print | cpio -dump ${MNT} ) + + df -ki /mnt + + set `df -ki /mnt | tail -1` + + umount ${MNT} + + fsck -p /dev/r${VNDEVICE}c < /dev/null + + vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true + + if [ $FSLABEL != "minimum" ] ; then + echo ${FSSIZE} > fs-image.size + break + fi + + echo ">>> Filesystem is ${FSSIZE} K, $4 left" + echo ">>> ${FSINODE} bytes/inode, $7 left" + echo ">>> `expr ${FSSIZE} \* 1024 / ${FSINODE}`" + echo ${FSSIZE} > fs-image.size + break; +done diff --git a/release/floppies/bin/dumpnlist/Makefile b/release/floppies/bin/dumpnlist/Makefile new file mode 100644 index 0000000..1149cad --- /dev/null +++ b/release/floppies/bin/dumpnlist/Makefile @@ -0,0 +1,8 @@ +# $Id: Makefile,v 1.1 1997/07/16 12:24:19 julian Exp $ +# +PROG=dumpnlist +NOMAN=yes + +.include + + diff --git a/release/floppies/bin/dumpnlist/dumpnlist.c b/release/floppies/bin/dumpnlist/dumpnlist.c new file mode 100644 index 0000000..31f25c1 --- /dev/null +++ b/release/floppies/bin/dumpnlist/dumpnlist.c @@ -0,0 +1,44 @@ +#include +#include +#include +#include +#include +#include + +struct nlist nl[] = { + {"_isa_devtab_bio"}, + {"_isa_devtab_tty"}, + {"_isa_devtab_net"}, + {"_isa_devtab_null"}, + {"_isa_biotab_wdc"}, + {"_isa_biotab_fdc"}, + {"_eisadriver_set"}, + {"_eisa_dev_list"}, + {"_pcidevice_set"}, + {"_device_list"}, + {"_scbusses"}, + {"_scsi_cinit"}, + {"_scsi_dinit"}, + {"_scsi_tinit"}, + {""}, +}; + +int +main(int ac, char **av) +{ + int i; + + i = nlist(av[1], nl); + if (i == -1) { + fprintf(stderr, "nlist returns error for %s\n", av[1]); + perror("nlist"); + return 1; + } + printf("%d\n", sizeof(nl) / sizeof(struct nlist)); + for (i = 0; nl[i].n_name; i++) { + printf("%s\n", nl[i].n_name); + printf("%d %d %d %ld\n", + nl[i].n_type, nl[i].n_other, nl[i].n_desc, nl[i].n_value); + } + return 0; +} diff --git a/release/floppies/bin/write_mfs_in_kernel/Makefile b/release/floppies/bin/write_mfs_in_kernel/Makefile new file mode 100644 index 0000000..cd65a8e --- /dev/null +++ b/release/floppies/bin/write_mfs_in_kernel/Makefile @@ -0,0 +1,8 @@ +# $Id: Makefile,v 1.1 1997/07/16 12:24:20 julian Exp $ +# +PROG=write_mfs_in_kernel +NOMAN=yes + +.include + + diff --git a/release/floppies/bin/write_mfs_in_kernel/write_mfs_in_kernel.c b/release/floppies/bin/write_mfs_in_kernel/write_mfs_in_kernel.c new file mode 100644 index 0000000..b624ed6 --- /dev/null +++ b/release/floppies/bin/write_mfs_in_kernel/write_mfs_in_kernel.c @@ -0,0 +1,70 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + * + * $Id: write_mfs_in_kernel.c,v 1.1 1997/07/16 12:24:21 julian Exp $ + * + * This program patches a filesystem into a kernel made with MFS_ROOT + * option. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +main(int argc, char **argv) +{ + unsigned char *buf_kernel, *buf_fs, *p,*q; + int fd_kernel, fd_fs; + struct stat st_kernel, st_fs; + u_long l; + + if (argc < 3) { + fprintf(stderr,"Usage:\n\t%s kernel fs\n"); + exit(2); + } + fd_kernel = open(argv[1],O_RDWR); + if (fd_kernel < 0) { perror(argv[1]); exit(2); } + fstat(fd_kernel,&st_kernel); + fd_fs = open(argv[2],O_RDONLY); + if (fd_fs < 0) { perror(argv[2]); exit(2); } + fstat(fd_fs,&st_fs); + buf_kernel = malloc(st_kernel.st_size); + if (!buf_kernel) { perror("malloc"); exit(2); } + buf_fs = malloc(st_fs.st_size); + if (!buf_fs) { perror("malloc"); exit(2); } + if (st_kernel.st_size != read(fd_kernel,buf_kernel,st_kernel.st_size)) + { perror(argv[1]); exit(2); } + if (st_fs.st_size != read(fd_fs,buf_fs,st_fs.st_size)) + { perror(argv[2]); exit(2); } + for(l=0,p=buf_kernel; l < st_kernel.st_size - st_fs.st_size ; l++,p++ ) + if(*p == 'M' && !strcmp(p,"MFS Filesystem goes here")) + goto found; + fprintf(stderr,"MFS filesystem signature not found in %s\n",argv[1]); + exit(1); + found: + for(l=0,q= p + SBOFF; l < st_fs.st_size - SBOFF ; l++,q++ ) + if (*q) + goto fail; + memcpy(p+SBOFF,buf_fs+SBOFF,st_fs.st_size-SBOFF); + lseek(fd_kernel,0L,SEEK_SET); + if (st_kernel.st_size != write(fd_kernel,buf_kernel,st_kernel.st_size)) + { perror(argv[1]); exit(2); } + exit(0); + fail: + l += SBOFF; + fprintf(stderr,"Obstruction in kernel after %ld bytes (%ld Kbyte)\n", + l, l/1024); + fprintf(stderr,"Filesystem is %ld bytes (%ld Kbyte)\n", + (u_long)st_fs.st_size, (u_long)st_fs.st_size/1024); + exit(1); +} diff --git a/release/floppies/boot/crunch/Makefile b/release/floppies/boot/crunch/Makefile index b339e18..90ee8bc 100644 --- a/release/floppies/boot/crunch/Makefile +++ b/release/floppies/boot/crunch/Makefile @@ -11,5 +11,5 @@ ${SYSINSTALL}: exit 1; \ fi -.include "../../makecrunch.mk" +.include "../../mk/makecrunch.mk" diff --git a/release/floppies/boot/crunch/crunch.conf b/release/floppies/boot/crunch/crunch.conf index d9edd11..01d7595 100644 --- a/release/floppies/boot/crunch/crunch.conf +++ b/release/floppies/boot/crunch/crunch.conf @@ -1,4 +1,4 @@ -# $Id$ +# $Id: crunch.conf,v 1.4 1997/07/16 12:24:23 julian Exp $ srcdirs /usr/src/bin srcdirs /usr/src/release @@ -16,5 +16,8 @@ ln gzip gunzip ln gzip zcat ln sh -sh -libs -ll -ledit -lutil -lkvm -lmd +libs -ll -ledit -lutil -lkvm -lmd -lcrypt -lftpio libs -ldialog -lncurses -lmytinfo -L/usr/src/release/libdisk/obj -ldisk -lipx +#libs -ll -ledit -lutil -lkvm -lmd -lcrypt -lftpio -lalias +#libs -ldialog -lncurses -lmytinfo -L/usr/src/release/libdisk/obj -ldisk -lipx + diff --git a/release/floppies/boot/floppy/Makefile b/release/floppies/boot/floppy/Makefile index 906a96b..34d30b2 100644 --- a/release/floppies/boot/floppy/Makefile +++ b/release/floppies/boot/floppy/Makefile @@ -1,5 +1,5 @@ -# $Id$ +# $Id: Makefile,v 1.6 1997/07/16 12:24:23 julian Exp $ # If this is a RELEASE, then set # Things which without too much trouble can be considered variables @@ -7,7 +7,8 @@ # mountpoint for filesystems. TOP=${.CURDIR}/../../../.. OBJTOP=${.OBJDIR}/../../../.. -FS_BIN=${.CURDIR}/../.. +FS_BIN=../../bin +SCRIPTDIR=${.CURDIR}/../../bin MNT= /mnt @@ -58,7 +59,7 @@ all: ${FS_BIN}/write_mfs_in_kernel CONF=${TOP}/sys/i386/conf COMPILE=${TOP}/sys/compile doKERNEL: - cd ${CONF} && config -n ${KERNEL} + cd ${CONF} && config ${KERNEL} cd ${COMPILE}/${KERNEL} && \ make depend && \ make kernel && \ @@ -67,30 +68,45 @@ doKERNEL: # --==## Put a filesystem into a BOOTMFS kernel ##==-- # LABELDIR=${OBJTOP}/sys/i386/boot/biosboot -doMFSKERN: + +${COMPILE}/BOOTMFS/kernel: rm -f ${COMPILE}/BOOTMFS/mfs_vfsops.o cd ${CONF} && \ - fgrep -v SYSV GENERIC | \ - fgrep -v pty | \ - fgrep -v PROCFS | \ - sed 's/GENERIC/BOOTMFS/g' | \ - sed '/maxusers/s/10/4/' > BOOTMFS && \ - echo "options MFS" >> BOOTMFS && \ - echo "options NFS_NOSERVER" >> BOOTMFS && \ - echo 'options "MAXCONS=4"' >> BOOTMFS + sed -e '/SYSV/d' \ + -e '/pty/d' \ + -e '/PROCFS/d' \ + -e '/KTRACE/d' \ + -e 's/GENERIC/BOOTMFS/g' \ + -e '/maxusers/s/10/4/' < GENERIC > BOOTMFS && \ + echo "options MFS" >> BOOTMFS && \ + echo "options NFS_NOSERVER" >> BOOTMFS && \ + echo 'options "MAXCONS=4"' >> BOOTMFS && \ + echo "options USERCONFIG_BOOT" >> BOOTMFS echo "options \"MFS_ROOT=`cat ../mfs/fs-image.size`\"" >> \ ${CONF}/BOOTMFS cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS + +doMFSKERN: ${COMPILE}/BOOTMFS/kernel -mkdir tree cp ${COMPILE}/BOOTMFS/kernel tree - ${FS_BIN}/write_mfs_in_kernel tree/kernel ../mfs/fs-image - kzip tree/kernel + ${FS_BIN}/write_mfs_in_kernel/write_mfs_in_kernel tree/kernel ../mfs/fs-image + kzip -v tree/kernel mv tree/kernel.kz tree/kernel - ls -l tree/kernel - sh -e ${FS_BIN}/doFS.sh ${LABELDIR} ${MNT} ${FSSIZE} tree \ + cp ${COMPILE}/../i386/boot/biosboot/boot.help tree + touch tree/boot.config + @vnconfig /dev/vn0 ../mfs/fs-image + @mkdir -p /tmp/mnt_xx + @mount /dev/vn0 /tmp/mnt_xx + ${FS_BIN}/dumpnlist/dumpnlist ${COMPILE}/BOOTMFS/kernel > /tmp/mnt_xx/stand/symbols + @umount /tmp/mnt_xx + @vnconfig -u /dev/vn0 + @rmdir /tmp/mnt_xx + + sh -e ${SCRIPTDIR}/doFS.sh ${LABELDIR} ${MNT} ${FSSIZE} tree \ 10000 ${FSLABEL} clean: rm -rf tree fs-image fs-image.size .include + diff --git a/release/floppies/boot/mfs/Makefile b/release/floppies/boot/mfs/Makefile index 8917397..6a2032d 100644 --- a/release/floppies/boot/mfs/Makefile +++ b/release/floppies/boot/mfs/Makefile @@ -1,12 +1,11 @@ ### -# $Id$ +# $Id: Makefile,v 1.5 1997/07/16 12:24:24 julian Exp $ # # What are we if we weren't told.. -CRUNCH?= mfs CRUNCHDIRS= ../crunch OBJTOP=../../../.. TOP=${.CURDIR}/../../../.. -FS_BIN=${.CURDIR}/../.. +SCRIPTDIR=${.CURDIR}/../../bin FSLABEL=minimum ZIP=false @@ -18,7 +17,7 @@ FS_DEVICES= std wd0 wd1 wd2 sd0 sd1 sd2 cuaa0 cuaa1 cuaa2 cuaa3 \ # a subdir that contains a verbatim image to be copied to the fs VERBATIM= ../verbatim -.include "../../crunch_fs.mk" +.include "../../mk/crunch_fs.mk" all: fs_image # tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \ diff --git a/release/floppies/crunch_fs.mk b/release/floppies/crunch_fs.mk deleted file mode 100644 index 14c06b9..0000000 --- a/release/floppies/crunch_fs.mk +++ /dev/null @@ -1,107 +0,0 @@ -### -# $Id$ -# -# This is included to make a floppy that includes a crunch file -# -# Variables that control this mk include file. -# TOP specifies where the top of the FreeBSD source tree is.. (*) -# FS_DIRS directories to make on the fs (*) -# STANDLINKS added symlinks to /stand on the fs -# VERBATIM a directory that contains tree to be copied to the fs -# FSSIZE defaults to 1200 -# FSLABEL defaults to fd1200 -# FSINODE defaults to 4300 -# FS_DEVICES devices to make on the fs (using MAKEDEV) (default = all) -# ZIP decides if the installed cruch will also be gzip'd(def=true) -# (*) = Mandatory -### - -# If we weren't told, default to nothing -.if ! defined( TOP ) -# define TOP! -xxx -.endif - -# mountpoint for filesystems. -MNT= /mnt - -# other floppy parameters. -FSSIZE?= 1200 -FSLABEL?= fd1200 -FSINODE?= 4300 -FS_DEVICES?= all -ZIP?=true - -# Things which will get you into trouble if you change them -TREE= tree -LABELDIR= ${OBJTOP}/sys/i386/boot/biosboot - -clean: - rm -rf tree fs-image fs-image.size step[0-9] - -.include - - -# -# --==## Create a filesystem image ##==-- -# - -fs_image: ${TREE} step2 step3 step4 fs-image - -${TREE}: ${.CURDIR}/Makefile - rm -rf ${TREE} - mkdir -p ${TREE} - cd ${TREE} && mkdir ${FS_DIRS} - cd ${TREE} ; for i in ${STANDLINKS} ;\ - do ; \ - ln -s /stand $${i} ; \ - done - -step2: ${.CURDIR}/${CRUNCHDIRS} ${.CURDIR}/Makefile -.if defined(CRUNCHDIRS) - @cd ${.CURDIR} && $(MAKE) installCRUNCH DIR=${TREE}/stand ZIP=${ZIP} -.endif - touch step2 - -step3: step2 -.if defined (FS_DEVICES) - ( cd tree/dev && \ - cp ${TOP}/etc/etc.i386/MAKEDEV . && sh MAKEDEV ${FS_DEVICES} ) -.endif - touch step3 - -step4: step3 -.if defined(VERBATIM) - A=`pwd`;cd ${.CURDIR}/${VERBATIM}; \ - find . \! \( -name CVS -and -prune \) -print |cpio -pdmuv $$A/tree -.endif - true || cp ${TOP}/etc/spwd.db tree/etc - touch step4 - -fs-image: step4 - sh -e ${FS_BIN}/doFS.sh ${LABELDIR} ${MNT} ${FSSIZE} tree \ - 10000 ${FSLABEL} - - -.if defined(CRUNCHDIRS) -installCRUNCH: -.if !defined(DIR) - @echo "DIR undefined in installCRUNCH" && exit 1 -.endif -.if !defined(ZIP) - @echo "ZIP undefined in installCRUNCH" && exit 1 -.endif -.for CRUNCHDIR in ${CRUNCHDIRS} - if ${ZIP} ; then \ - gzip -9 < ${CRUNCHDIR}/crunch > ${DIR}/.crunch ; \ - else \ - ln -f ${CRUNCHDIR}/crunch ${DIR}/.crunch ; \ - fi - chmod 555 ${DIR}/.crunch - for i in `crunchgen -l ${.CURDIR}/${CRUNCHDIR}/crunch.conf` ; do \ - ln -f ${DIR}/.crunch ${DIR}/$$i ; \ - done - rm -f ${DIR}/.crunch -.endfor -.endif - diff --git a/release/floppies/doFS.sh b/release/floppies/doFS.sh deleted file mode 100644 index 1693226..0000000 --- a/release/floppies/doFS.sh +++ /dev/null @@ -1,120 +0,0 @@ -: -#set -ex - -VNDEVICE=vn0 -export BLOCKSIZE=512 - -LABELDIR=$1 ; shift -MNT=$1 ; shift -FSSIZE=$1 ; shift -FSPROTO=$1 ; shift -FSINODE=$1 ; shift -FSLABEL=$1 ; shift -OLDFSSIZE=${FSSIZE} -OLDFSINODE=${FSINODE} - -deadlock=40 - -while true -do - rm -f fs-image - - if [ ! -b /dev/${VNDEVICE} -o ! -c /dev/r${VNDEVICE} ] ; then - ( cd /dev && sh MAKEDEV ${VNDEVICE} ) - fi - - umount /dev/${VNDEVICE} 2>/dev/null || true - - umount ${MNT} 2>/dev/null || true - - vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true - - dd of=fs-image if=/dev/zero count=${FSSIZE} bs=1k 2>/dev/null - # this suppresses the `invalid primary partition table: no magic' - awk 'BEGIN {printf "%c%c", 85, 170}' |\ - dd of=fs-image obs=1 seek=510 conv=notrunc 2>/dev/null - - vnconfig -s labels -c /dev/r${VNDEVICE} fs-image - - sed '/^minimum:/,$d' /etc/disktab > /etc/disktab.tmp - cat /etc/disktab.tmp > /etc/disktab - rm -f /etc/disktab.tmp - ( - a=`expr ${FSSIZE} \* 2` - echo - echo "minimum:ty=mfs:se#512:nt#1:rm#300:\\" - echo " :ns#$a:nc#1:\\" - echo " :pa#$a:oa#0:ba#4096:fa#512:\\" - echo " :pc#$a:oc#0:bc#4096:fc#512:" - echo - ) >> /etc/disktab - - disklabel -w -r -B \ - -b ${LABELDIR}/boot1 \ - -s ${LABELDIR}/boot2 \ - /dev/r${VNDEVICE} minimum - - newfs -u 0 -t 0 -i ${FSINODE} -m 0 -T minimum /dev/r${VNDEVICE}a - - mount /dev/${VNDEVICE}a ${MNT} - - if ( set -e && cd ${FSPROTO} && find . -print | cpio -dump ${MNT} ) - then - ; - else - echo " $FSINODE and $FSSIZE failed, reverting.." - FSSIZE=`expr ${FSSIZE} + 10` - #FSSIZE=${OLDFSSIZE} - FSINODE=${FSINODE} - continue - fi - - set `df -i /mnt | tail -1` -#/dev/vn0a 937 932 5 99% 342 328 51% /mnt - - umount ${MNT} - - fsck -p /dev/r${VNDEVICE}a < /dev/null - - vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true - - if [ $FSLABEL != "minimum" ] ; then - echo ${FSSIZE} > fs-image.size - break - fi - - OLDFSSIZE=${FSSIZE} - OLDFSINODE=${FSINODE} - echo ">>> Filesystem is ${FSSIZE} K, $4 left" - echo ">>> ${FSINODE} bytes/inode, $7 left" - echo ">>> `expr ${FSSIZE} \* 1024 / ${FSINODE}`" - if [ $4 -gt 128 ] ; then - echo "Reducing size" - FSSIZE=`expr ${FSSIZE} - $4 / 2` - continue - fi - if [ $7 -gt 128 ] ; then - echo "Increasing bytes per inode" - FSINODE=`expr ${FSINODE} + 8192` - continue - fi - if [ $4 -gt 32 ] ; then - echo "Reducing size" - FSSIZE=`expr ${FSSIZE} - 4` - FSINODE=`expr ${FSINODE} - 1024` - continue - fi - if [ $7 -gt 64 ] ; then - echo "Increasing bytes per inode" - FSINODE=`expr ${FSINODE} + 8192` - continue - fi - if [ $deadlock -eq 0 ] ; then - echo "Avoiding deadlock, giving up" - echo ${FSSIZE} > fs-image.size - break - fi - deadlock=`expr $deadlock - 1` - echo ${FSSIZE} > fs-image.size - break; -done diff --git a/release/floppies/fixit/crunch/Makefile b/release/floppies/fixit/crunch/Makefile index 13b0860..a1bf7cf 100644 --- a/release/floppies/fixit/crunch/Makefile +++ b/release/floppies/fixit/crunch/Makefile @@ -1,3 +1,3 @@ OBJTOP=../../../.. -.include "../../makecrunch.mk" +.include "../../mk/makecrunch.mk" diff --git a/release/floppies/fixit/crunch/crunch.conf b/release/floppies/fixit/crunch/crunch.conf index d05160e..8938ab7 100644 --- a/release/floppies/fixit/crunch/crunch.conf +++ b/release/floppies/fixit/crunch/crunch.conf @@ -1,4 +1,4 @@ -# $Id$ +# $Id: crunch.conf,v 1.4 1997/07/16 12:24:26 julian Exp $ # first, we list the source dirs that our programs reside in. These are # searched in order listed to find the dir containing each program. @@ -24,22 +24,22 @@ ln test [ # /sbin stuff -progs badsect chown clri disklabel dump dmesg fdisk +progs badsect chown clri disklabel dump dmesg fdisk ft progs mknod mount newfs ping reboot restore scsi swapon umount progs mount_msdos mount_cd9660 mount_nfs ln dump rdump ln restore rrestore ln newfs mount_mfs +ln chown chgrp # /usr/bin stuff -progs ftp rsh sed telnet rlogin common find grep -ln common vi -ln common view -ln common ex +progs ftp rsh sed telnet rlogin vi find grep +ln vi view +ln vi ex # finally, we specify the libraries to link in with our binary -libs -lcrypt -ltelnet -lutil -ll +libs -lcrypt -ltelnet -lutil -ll -ltcl -lm libs -lcurses -ltermcap -ledit -lgnuregex -lkvm -lscsi diff --git a/release/floppies/fixit/image/Makefile b/release/floppies/fixit/image/Makefile index f946522..571ecc5 100644 --- a/release/floppies/fixit/image/Makefile +++ b/release/floppies/fixit/image/Makefile @@ -1,16 +1,20 @@ ### -# $Id$ +# $Id: Makefile,v 1.4 1997/07/16 12:24:27 julian Exp $ # # What are we if we weren't told.. CRUNCH?= fixit CRUNCHDIRS= ../crunch TOP=${.CURDIR}/../../../.. -FS_BIN=${.CURDIR}/../.. +OBJTOP=${.OBJDIR}/../../../.. +SCRIPTDIR=${.CURDIR}/../../bin +#FSLABEL=minimum +FSINODE=2000 + # the directories you want on the fs FS_DIRS= dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp # a subdir that contains a verbatim image to be copied to the fs VERBATIM= ../verbatim -.include "../../crunch_fs.mk" +.include "../../mk/crunch_fs.mk" all: fs_image diff --git a/release/floppies/makecrunch.mk b/release/floppies/makecrunch.mk deleted file mode 100644 index 8f2d3e7..0000000 --- a/release/floppies/makecrunch.mk +++ /dev/null @@ -1,25 +0,0 @@ - - -SYSINSTALL= ${OBJTOP}/release/sysinstall/sysinstall - -NOCRYPT?= yes - -all: crunch - -crunch: - -crunchgen ${.CURDIR}/crunch.conf - ${MAKE} -f crunch.mk all NOCRYP=${NOCRYPT} \ - "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY" - -clean: - rm -f *.o *.stub *.lo *_stub.c *.mk \ - crunch.cache \ - crunch.mk \ - crunch.c \ - crunch \ - .tmp_* - -install: - @echo " No idea what to do to install yet" - -.include diff --git a/release/floppies/mk/crunch_fs.mk b/release/floppies/mk/crunch_fs.mk new file mode 100644 index 0000000..c6d51d1 --- /dev/null +++ b/release/floppies/mk/crunch_fs.mk @@ -0,0 +1,108 @@ +### +# $Id: crunch_fs.mk,v 1.1 1997/07/16 12:24:29 julian Exp $ +# +# This is included to make a floppy that includes a crunch file +# +# Variables that control this mk include file. +# TOP specifies where the top of the FreeBSD source tree is.. (*) +# FS_DIRS directories to make on the fs (*) +# STANDLINKS added symlinks to /stand on the fs +# VERBATIM a directory that contains tree to be copied to the fs +# FSSIZE defaults to 1440 +# FSLABEL defaults to fd1440 +# FSINODE defaults to 4000 +# FS_DEVICES devices to make on the fs (using MAKEDEV) (default = all) +# ZIP decides if the installed cruch will also be gzip'd(def=true) +# (*) = Mandatory +### + +# If we weren't told, default to nothing +.if ! defined( TOP ) +# define TOP! +xxx +.endif + +# mountpoint for filesystems. +MNT= /mnt + +# other floppy parameters. +FSSIZE?= 1440 +FSLABEL?= fd1440 +FSINODE?= 2000 +FS_DEVICES?= all +ZIP?=true + +# Things which will get you into trouble if you change them +TREE= tree +LABELDIR= ${OBJTOP}/sys/i386/boot/biosboot + +clean: + rm -rf tree fs-image fs-image.size step[0-9] + +.include + + +# +# --==## Create a filesystem image ##==-- +# + +fs_image: ${TREE} step2 step3 step4 fs-image + +${TREE}: ${.CURDIR}/Makefile + rm -rf ${TREE} + mkdir -p ${TREE} + cd ${TREE} && mkdir ${FS_DIRS} + cd ${TREE} ; for i in ${STANDLINKS} ; \ + do \ + ln -s /stand $${i} ; \ + done + +step2: ${.CURDIR}/${CRUNCHDIRS} ${.CURDIR}/Makefile +.if defined(CRUNCHDIRS) + @cd ${.CURDIR} && $(MAKE) installCRUNCH DIR=${TREE}/stand ZIP=${ZIP} +.endif + touch step2 + +step3: step2 +.if defined (FS_DEVICES) + ( cd tree/dev && \ + cp ${TOP}/etc/etc.i386/MAKEDEV . && sh MAKEDEV ${FS_DEVICES} ) +.endif + touch step3 + +step4: step3 +.if defined(VERBATIM) + A=`pwd`;cd ${.CURDIR}/${VERBATIM}; \ + find . \! \( -name CVS -and -prune \) -print |cpio -pdmuv $$A/tree +.endif + true || cp ${TOP}/etc/spwd.db tree/etc + touch step4 + +fs-image: step4 + sh -e ${SCRIPTDIR}/doFS.sh ${LABELDIR} ${MNT} ${FSSIZE} tree \ + ${FSINODE} ${FSLABEL} + cp fs-image.size ${.CURDIR} + + +.if defined(CRUNCHDIRS) +installCRUNCH: +.if !defined(DIR) + @echo "DIR undefined in installCRUNCH" && exit 1 +.endif +.if !defined(ZIP) + @echo "ZIP undefined in installCRUNCH" && exit 1 +.endif +.for CRUNCHDIR in ${CRUNCHDIRS} + if ${ZIP} ; then \ + gzip -9 < ${CRUNCHDIR}/crunch > ${DIR}/.crunch ; \ + else \ + ln -f ${CRUNCHDIR}/crunch ${DIR}/.crunch ; \ + fi + chmod 555 ${DIR}/.crunch + for i in `crunchgen -l ${.CURDIR}/${CRUNCHDIR}/crunch.conf` ; do \ + ln -f ${DIR}/.crunch ${DIR}/$$i ; \ + done + rm -f ${DIR}/.crunch +.endfor +.endif + diff --git a/release/floppies/mk/makecrunch.mk b/release/floppies/mk/makecrunch.mk new file mode 100644 index 0000000..8f2d3e7 --- /dev/null +++ b/release/floppies/mk/makecrunch.mk @@ -0,0 +1,25 @@ + + +SYSINSTALL= ${OBJTOP}/release/sysinstall/sysinstall + +NOCRYPT?= yes + +all: crunch + +crunch: + -crunchgen ${.CURDIR}/crunch.conf + ${MAKE} -f crunch.mk all NOCRYP=${NOCRYPT} \ + "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY" + +clean: + rm -f *.o *.stub *.lo *_stub.c *.mk \ + crunch.cache \ + crunch.mk \ + crunch.c \ + crunch \ + .tmp_* + +install: + @echo " No idea what to do to install yet" + +.include diff --git a/release/floppies/write_mfs_in_kernel.c b/release/floppies/write_mfs_in_kernel.c deleted file mode 100644 index 358c7d9..0000000 --- a/release/floppies/write_mfs_in_kernel.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - * - * $Id$ - * - * This program patches a filesystem into a kernel made with MFS_ROOT - * option. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -main(int argc, char **argv) -{ - unsigned char *buf_kernel, *buf_fs, *p,*q; - int fd_kernel, fd_fs; - struct stat st_kernel, st_fs; - u_long l; - - if (argc < 3) { - fprintf(stderr,"Usage:\n\t%s kernel fs\n"); - exit(2); - } - fd_kernel = open(argv[1],O_RDWR); - if (fd_kernel < 0) { perror(argv[1]); exit(2); } - fstat(fd_kernel,&st_kernel); - fd_fs = open(argv[2],O_RDONLY); - if (fd_fs < 0) { perror(argv[2]); exit(2); } - fstat(fd_fs,&st_fs); - buf_kernel = malloc(st_kernel.st_size); - if (!buf_kernel) { perror("malloc"); exit(2); } - buf_fs = malloc(st_fs.st_size); - if (!buf_fs) { perror("malloc"); exit(2); } - if (st_kernel.st_size != read(fd_kernel,buf_kernel,st_kernel.st_size)) - { perror(argv[1]); exit(2); } - if (st_fs.st_size != read(fd_fs,buf_fs,st_fs.st_size)) - { perror(argv[2]); exit(2); } - for(l=0,p=buf_kernel; l < st_kernel.st_size - st_fs.st_size ; l++,p++ ) - if(*p == 'M' && !strcmp(p,"MFS Filesystem goes here")) - goto found; - fprintf(stderr,"MFS filesystem signature not found in %s\n",argv[1]); - exit(1); - found: - for(l=0,q= p + SBOFF; l < st_fs.st_size - SBOFF ; l++,q++ ) - if (*q) - goto fail; - memcpy(p+SBOFF,buf_fs+SBOFF,st_fs.st_size-SBOFF); - lseek(fd_kernel,0L,SEEK_SET); - if (st_kernel.st_size != write(fd_kernel,buf_kernel,st_kernel.st_size)) - { perror(argv[1]); exit(2); } - exit(0); - fail: - l += SBOFF; - fprintf(stderr,"Obstruction in kernel after %ld bytes (%ld Kbyte)\n", - l, l/1024); - fprintf(stderr,"Filesystem is %ld bytes (%ld Kbyte)\n", - (u_long)st_fs.st_size, (u_long)st_fs.st_size/1024); - exit(1); -} -- cgit v1.1