diff options
| author | cvs2svn <cvs2svn@FreeBSD.org> | 1996-06-04 19:09:51 +0000 |
|---|---|---|
| committer | cvs2svn <cvs2svn@FreeBSD.org> | 1996-06-04 19:09:51 +0000 |
| commit | 38f70e7a6ec5f69556c583df9689f1fe59509abe (patch) | |
| tree | 1dcc1592d49e29f7eccc6965e3e5ba58505a43d1 /release/floppies | |
| parent | ed1cde0b4abec868221d2eb8da6af2e2878545ee (diff) | |
Notes
Diffstat (limited to 'release/floppies')
| -rw-r--r-- | release/floppies/boot/Makefile | 4 | ||||
| -rw-r--r-- | release/floppies/boot/crunch/crunch.conf | 20 | ||||
| -rw-r--r-- | release/floppies/boot/verbatim/etc/services | 4 | ||||
| -rw-r--r-- | release/floppies/doFS.sh | 120 | ||||
| -rw-r--r-- | release/floppies/fixit/Makefile | 6 | ||||
| -rw-r--r-- | release/floppies/fixit/crunch/crunch.conf | 45 | ||||
| -rw-r--r-- | release/floppies/fixit/image/Makefile | 16 | ||||
| -rw-r--r-- | release/floppies/fixit/verbatim/.profile | 15 | ||||
| -rw-r--r-- | release/floppies/write_mfs_in_kernel.c | 70 |
9 files changed, 300 insertions, 0 deletions
diff --git a/release/floppies/boot/Makefile b/release/floppies/boot/Makefile new file mode 100644 index 000000000000..2dd894d898d9 --- /dev/null +++ b/release/floppies/boot/Makefile @@ -0,0 +1,4 @@ +# $Id: Makefile,v 1.214 1996/05/02 08:18:28 jkh Exp $ +SUBDIR= crunch mfs floppy + +.include <bsd.subdir.mk> diff --git a/release/floppies/boot/crunch/crunch.conf b/release/floppies/boot/crunch/crunch.conf new file mode 100644 index 000000000000..b9d6f14b65f7 --- /dev/null +++ b/release/floppies/boot/crunch/crunch.conf @@ -0,0 +1,20 @@ +# $Id: boot_crunch.conf,v 1.23 1996/02/08 18:02:51 phk Exp $ + +srcdirs /usr/src/bin +srcdirs /usr/src/release +srcdirs /usr/src/sbin/i386 +srcdirs /usr/src/sbin +srcdirs /usr/src/usr.bin +srcdirs /usr/src/gnu/usr.bin +srcdirs /usr/src/usr.sbin + +progs sh find +progs pwd ft ppp +progs sysinstall newfs gzip cpio bad144 fsck ifconfig route slattach +progs mount_nfs +ln gzip gunzip +ln gzip zcat +ln sh -sh + +libs -ll -ledit -lutil -lkvm -lmd +libs -ldialog -lncurses -lmytinfo -L/usr/src/release/libdisk/obj -ldisk -lipx diff --git a/release/floppies/boot/verbatim/etc/services b/release/floppies/boot/verbatim/etc/services new file mode 100644 index 000000000000..bd1beff4d9a7 --- /dev/null +++ b/release/floppies/boot/verbatim/etc/services @@ -0,0 +1,4 @@ +nameserver 42/tcp name +ftp 21/tcp +domain 53/tcp nameserver +domain 53/udp nameserver diff --git a/release/floppies/doFS.sh b/release/floppies/doFS.sh new file mode 100644 index 000000000000..16932269363f --- /dev/null +++ b/release/floppies/doFS.sh @@ -0,0 +1,120 @@ +: +#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/Makefile b/release/floppies/fixit/Makefile new file mode 100644 index 000000000000..ee278f76ab4c --- /dev/null +++ b/release/floppies/fixit/Makefile @@ -0,0 +1,6 @@ +### +# $Id: Makefile,v 1.214 1996/05/02 08:18:28 jkh Exp $ +# +SUBDIR= crunch image + +.include <bsd.subdir.mk> diff --git a/release/floppies/fixit/crunch/crunch.conf b/release/floppies/fixit/crunch/crunch.conf new file mode 100644 index 000000000000..f31652ea1e87 --- /dev/null +++ b/release/floppies/fixit/crunch/crunch.conf @@ -0,0 +1,45 @@ +# $Id: fixit_crunch.conf,v 1.6 1996/01/03 23:41:03 joerg 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. + +srcdirs /usr/src/bin +srcdirs /usr/src/sbin/i386 +srcdirs /usr/src/sbin +srcdirs /usr/src/gnu/usr.bin +srcdirs /usr/src/usr.bin +srcdirs /usr/src/usr.sbin +srcdirs /usr/src/usr.bin/vi + +# second, we list all the programs we want to include in our crunched binary. +# The order doesn't matter. Any program that needs hard links to it gets an +# `ln' directive. + +# /bin stuff + +progs cat chmod chroot cp date dd df echo ed expr hostname kill ln ls mkdir +progs mt mv pwd rcp rm rmdir sleep stty sync test + +ln test [ + +# /sbin stuff + +progs badsect chown clri disklabel dump dmesg fdisk +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 + +# /usr/bin stuff + +progs ftp rsh sed telnet rlogin common find grep +ln common vi +ln common view +ln common ex + +# finally, we specify the libraries to link in with our binary + +libs -lcrypt -ltelnet -lutil -ll +libs -lcurses -ltermcap -ledit -lgnuregex -lkvm -lscsi diff --git a/release/floppies/fixit/image/Makefile b/release/floppies/fixit/image/Makefile new file mode 100644 index 000000000000..a8a80c4403be --- /dev/null +++ b/release/floppies/fixit/image/Makefile @@ -0,0 +1,16 @@ +### +# $Id: Makefile,v 1.214 1996/05/02 08:18:28 jkh Exp $ +# +# What are we if we weren't told.. +CRUNCH?= fixit +CRUNCHDIRS= ../crunch +TOP=${.CURDIR}/../../../.. +FS_BIN=${.CURDIR}/../.. + +# 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" +all: fs_image diff --git a/release/floppies/fixit/verbatim/.profile b/release/floppies/fixit/verbatim/.profile new file mode 100644 index 000000000000..f5664e8d6eb8 --- /dev/null +++ b/release/floppies/fixit/verbatim/.profile @@ -0,0 +1,15 @@ +: +# $Id: fixit.profile,v 1.1 1995/03/15 06:14:19 phk Exp $ +PATH=/stand +BLOCKSIZE=K +PS1="Fixit# " + +echo '+---------------------------------------------------+' +echo '| You are now running from a FreeBSD "fixit" floppy |' +echo '+---------------------------------------------------+' +echo +echo 'Good Luck!' +echo + +export PATH BLOCKSIZE PS1 + diff --git a/release/floppies/write_mfs_in_kernel.c b/release/floppies/write_mfs_in_kernel.c new file mode 100644 index 000000000000..886bdd234dd8 --- /dev/null +++ b/release/floppies/write_mfs_in_kernel.c @@ -0,0 +1,70 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * <phk@login.dknet.dk> 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 1995/04/25 03:45:18 phk Exp $ + * + * This program patches a filesystem into a kernel made with MFS_ROOT + * option. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/param.h> +#include <sys/stat.h> +#include <ufs/ffs/fs.h> + +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); +} |
