1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-11 09:50:12 +00:00

update the floppies directory to work better

This commit is contained in:
Julian Elischer 1997-07-22 02:51:02 +00:00
parent b5b5fc9dc3
commit a75473fc14
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=27596
18 changed files with 210 additions and 204 deletions

View File

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

View File

@ -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? :-).

View File

@ -0,0 +1,7 @@
# $Id: Makefile,v 1.1 1997/07/16 12:24:18 julian Exp $
#
SUBDIR= write_mfs_in_kernel dumpnlist
.include <bsd.subdir.mk>

View File

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

View File

@ -0,0 +1,8 @@
# $Id: Makefile,v 1.1 1997/07/16 12:24:19 julian Exp $
#
PROG=dumpnlist
NOMAN=yes
.include <bsd.prog.mk>

View File

@ -0,0 +1,44 @@
#include <sys/types.h>
#include <sys/fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <nlist.h>
#include <stdio.h>
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;
}

View File

@ -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 <bsd.prog.mk>

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id$
* $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.

View File

@ -11,5 +11,5 @@ ${SYSINSTALL}:
exit 1; \
fi
.include "../../makecrunch.mk"
.include "../../mk/makecrunch.mk"

View File

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

View File

@ -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 <bsd.prog.mk>

View File

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

View File

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

View File

@ -1,3 +1,3 @@
OBJTOP=../../../..
.include "../../makecrunch.mk"
.include "../../mk/makecrunch.mk"

View File

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

View File

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

View File

@ -1,5 +1,5 @@
###
# $Id$
# $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
#
@ -8,9 +8,9 @@
# 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
# 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
@ -26,9 +26,9 @@ xxx
MNT= /mnt
# other floppy parameters.
FSSIZE?= 1200
FSLABEL?= fd1200
FSINODE?= 4300
FSSIZE?= 1440
FSLABEL?= fd1440
FSINODE?= 2000
FS_DEVICES?= all
ZIP?=true
@ -52,8 +52,8 @@ ${TREE}: ${.CURDIR}/Makefile
rm -rf ${TREE}
mkdir -p ${TREE}
cd ${TREE} && mkdir ${FS_DIRS}
cd ${TREE} ; for i in ${STANDLINKS} ;\
do ; \
cd ${TREE} ; for i in ${STANDLINKS} ; \
do \
ln -s /stand $${i} ; \
done
@ -79,8 +79,9 @@ step4: step3
touch step4
fs-image: step4
sh -e ${FS_BIN}/doFS.sh ${LABELDIR} ${MNT} ${FSSIZE} tree \
10000 ${FSLABEL}
sh -e ${SCRIPTDIR}/doFS.sh ${LABELDIR} ${MNT} ${FSSIZE} tree \
${FSINODE} ${FSLABEL}
cp fs-image.size ${.CURDIR}
.if defined(CRUNCHDIRS)