Commit PicoBSD mega-patch:

. Bring PicoBSD up to date with -CURRENT reality.
. Make PicoBSD smart and not spam /dev/vn0 and /mnt.  Now it uses the first
  unused vn device and creates a temporary mountpoint in /tmp.
. Miscellaneous build cleanups and optimizations.

Unfortunately the bridge, isp, and router floppies are too big and need
the axe treatment.  The install floppy needs updating to -CURRENT. Dial and
net build and (appear to) run OK.  I will be adressing these in the
near future (unless someone beats me to it :-) ).

PR:		misc/17737
Submitted by:	Omachonu Ogali <oogali@intranova.net>
This commit is contained in:
Doug White 2000-04-25 19:00:08 +00:00
parent 5d5e482682
commit 223b633217
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=59627
25 changed files with 108 additions and 88 deletions

View File

@ -34,6 +34,8 @@ options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPDIVERT
#options DEVFS
options PCI_QUIET
options COMPAT_OLDISA #Use ISA shims and glue for old drivers
options COMPAT_OLDPCI #Use PCI shims and glue for old drivers
#options NO_LKM
# Support for bridging and bandwidth limiting
options DUMMYNET

View File

@ -2,7 +2,7 @@
# $FreeBSD$
#
SRC?=/usr/src
CRUNCHFLAGS+= -DNOPAM -DRELEASE_CRUNCH -DNOSECURE -DNOCRYPT
CRUNCHFLAGS+= -DNOPAM -DRELEASE_CRUNCH -DNOSECURE -DNOCRYPT -DNONETGRAPH -DNOIPSEC
all: crunch
@ -29,16 +29,16 @@ clean:
*.gz
install:
cp crunch1 /mnt/stand/crunch
chmod 555 /mnt/stand/crunch
cp crunch1 ${MFS_MOUNTPOINT}/stand/crunch
chmod 555 ${MFS_MOUNTPOINT}/stand/crunch
for i in `crunchgen -l crunch1.conf` ; \
do \
ln /mnt/stand/crunch /mnt/stand/$${i}; \
ln ${MFS_MOUNTPOINT}/stand/crunch ${MFS_MOUNTPOINT}/stand/$${i}; \
done
rm /mnt/stand/crunch
rm ${MFS_MOUNTPOINT}/stand/crunch
# Install the MIB files
#mkdir -p /mnt/usr/local/share/snmp/mibs
#cp ../../net/crunch1/mibs/*.txt /mnt/usr/local/share/snmp/mibs/
#mkdir -p ${MFS_MOUNTPOINT}/usr/local/share/snmp/mibs
#cp ../../net/crunch1/mibs/*.txt ${MFS_MOUNTPOINT}/usr/local/share/snmp/mibs/
.include <bsd.prog.mk>

View File

@ -73,7 +73,7 @@ set_msgs() {
}
# Main build procedure. It calls another scripts (stage1)
# Main build procedure. It calls another script (stage1)
main() {
if [ "X${TYPE}" = "X" ] ; then
@ -101,8 +101,9 @@ main() {
echo ""
echo "-> ERROR in \"${i}\" script. Aborting the build process."
echo -n "-> Cleaning temporary files... "
umount -f /mnt
vnconfig -u /dev/rvn0
umount -f ${MFS_MOUNTPOINT}
rm -rf ${MFS_MOUNTPOINT}
vnconfig -u /dev/rvn${VNUM}
./clean ${TYPE}
echo "Done."
exit 10

View File

@ -4,3 +4,4 @@ NOCRYPT=yes
NOPAM=yes
NOSECURE=yes
NONETGRAPH=yes
NOIPSEC=yes

View File

@ -47,6 +47,12 @@
share
misc
..
locale
..
syscons
..
nls
..
..
..
var

View File

@ -8,8 +8,12 @@
set -e # abort in case of untested errors
# By default, /tmp should exist.
#
MFS_NAME=fs.PICOBSD
MFS_MOUNTPOINT=/mnt
MFS_MOUNTPOINT=`mktemp -d "/tmp/picobsd.XXXXXXXXXX"`
export MFS_MOUNTPOINT
# fail errno errcode
# This function is used to trap errors and print msgs
#
@ -19,14 +23,14 @@ fail() {
echo "--> Error $errno code $errcode"
case $errcode in
no_vnconfig)
echo "Error while doing vnconfig of ${MFS_NAME} on /dev/rvn0..."
echo "Error while doing vnconfig of ${MFS_NAME} on /dev/rvn${VNUM}..."
echo " Most probably your running kernel doesn't have the vn(4) device."
;;
disklabel)
echo "Error while labeling ${MFS_NAME} size ${MFS_SIZE}"
;;
no_mount)
echo "Error while mounting ${MFS_NAME} (/dev/vn0c) on ${MFS_MOUNTPOINT}"
echo "Error while mounting ${MFS_NAME} (/dev/vn${VNUM}c) on ${MFS_MOUNTPOINT}"
;;
mtree)
echo "Error while making hierarchy in ${MFS_MOUNTPOINT}"
@ -38,7 +42,7 @@ fail() {
echo "Error while building ../${TYPE}/crunch1..."
;;
vnconfig2)
echo "Error while doing vnconfig of floppy.img on /dev/rvn0..."
echo "Error while doing vnconfig of floppy.img on /dev/rvn${VNUM}..."
;;
disklabel)
echo "Error while doing disklabel on of floppy.img size $FLOPPY_SIZE"
@ -54,6 +58,8 @@ fail() {
;;
esac
echo "-> Aborting $0"
umount ${MFS_MOUNTPOINT} 2> /dev/null || true
rm -rf ${MFS_MOUNTPOINT} 2> /dev/null || true
exit 10
}
@ -61,16 +67,20 @@ rm -f kernel.gz ${MFS_NAME} # cleanup...
create_mfs() {
echo "-> Preparing MFS filesystem..."
umount /dev/vn0 2> /dev/null || true
VNUM=`mount | awk "/vn/ { num++ } END { printf \"%d\", num }"`
export VNUM
echo "-> Using vn${VNUM}..."
umount /dev/vn${VNUM} 2> /dev/null || true
umount ${MFS_MOUNTPOINT} 2> /dev/null || true
vnconfig -u /dev/rvn0 2> /dev/null || true
vnconfig -u /dev/rvn${VNUM} 2> /dev/null || true
dd of=${MFS_NAME} if=/dev/zero count=${MFS_SIZE} bs=1k 2> /dev/null
awk 'BEGIN {printf "%c%c", 85, 170}' | \
dd of=${MFS_NAME} obs=1 seek=510 conv=notrunc 2> /dev/null
vnconfig -s labels -c /dev/rvn0 ${MFS_NAME} 2>/dev/null || \
vnconfig -s labels -c /dev/rvn${VNUM} ${MFS_NAME} 2>/dev/null || \
fail $? no_vnconfig
dd if=/boot/boot1 of=${MFS_NAME} conv=notrunc 2> /dev/null
@ -78,13 +88,13 @@ create_mfs() {
# This command does weird things on 2.2.x systems.
# For small image sizes, use std disktypes
if [ ${MFS_SIZE} -lt 1024 ] ; then
disklabel -rw /dev/rvn0 fd${MFS_SIZE} || fail $? disklabel
disklabel -rw /dev/rvn${VNUM} fd${MFS_SIZE} || fail $? disklabel
else
disklabel -rw vn0 auto || fail $? disklabel
disklabel -rw vn${VNUM} auto || fail $? disklabel
fi
newfs -i ${MFS_INODES} -m 0 -p 0 -o space /dev/rvn0c
mount /dev/vn0c ${MFS_MOUNTPOINT} || fail $? no_mount
newfs -i ${MFS_INODES} -m 0 -p 0 -o space /dev/rvn${VNUM}c
mount /dev/vn${VNUM}c ${MFS_MOUNTPOINT} || fail $? no_mount
pwd=`pwd`
}
@ -146,8 +156,8 @@ populate_mfs() {
(echo "-> Fixing permissions"; cd ${MFS_MOUNTPOINT}; chown -R root *)
df -ik ${MFS_MOUNTPOINT}
umount ${MFS_MOUNTPOINT}
fsck -p /dev/rvn0c
vnconfig -u /dev/rvn0
fsck -p /dev/rvn${VNUM}c
vnconfig -u /dev/rvn${VNUM}
}
# stage2
@ -172,17 +182,17 @@ do_floppy() {
awk 'BEGIN {printf "%c%c", 85, 170}' | \
dd of=picobsd.bin obs=1 seek=510 conv=notrunc 2> /dev/null
vnconfig -c /dev/rvn0 picobsd.bin || fail $? vnconfig2
vnconfig -c /dev/rvn${VNUM} picobsd.bin || fail $? vnconfig2
dd if=/boot/boot1 of=picobsd.bin conv=notrunc 2> /dev/null
# XXX todo: use a type matching floppy size.
disklabel -Brw -b /boot/boot1 -s /boot/boot2 /dev/rvn0 fd1440 || \
disklabel -Brw -b /boot/boot1 -s /boot/boot2 /dev/vn${VNUM}c fd1440 || \
fail $? disklabel
newfs -i ${FLOPPY_INODES} -m 0 -p 0 -o space /dev/rvn0c
newfs -i ${FLOPPY_INODES} -m 0 -p 0 -o space /dev/rvn${VNUM}c
mount /dev/vn0c ${MFS_MOUNTPOINT}
mount /dev/vn${VNUM}c ${MFS_MOUNTPOINT}
echo "==> Populating floppy filesystem..."
@ -215,7 +225,7 @@ do_floppy() {
fi
rm -f floppy.tree/etc/mfs\.* # mfs.rc, mfs.login.conf
files="motd"
echo "-> Copying language dependent files: ${files} -> /mnt/etc ..."
echo "-> Copying language dependent files: ${files} -> ${MFS_MOUNTPOINT}/etc ..."
for i in ${files} ; do
cat ${BUILDDIR}/../${TYPE}/lang/${i}.${LANGUAGE} | \
sed -e "s/@VER@/${VER}/g" > floppy.tree/etc/${i}
@ -263,7 +273,8 @@ __EOF
df -ik ${MFS_MOUNTPOINT} > .build.reply
umount ${MFS_MOUNTPOINT}
vnconfig -u /dev/rvn0
rm -rf ${MFS_MOUNTPOINT}
vnconfig -u /dev/rvn${VNUM}
# rm kernel.gz ${MFS_NAME}
}

View File

@ -219,3 +219,8 @@ pseudo-device bpf #Berkeley packet filter
#device ulpt0 # Printer
#device umass0 # Disks/Mass storage - Requires scbus and da0
#device ums0 # Mouse
# Compatibility...
options COMPAT_OLDISA #Use ISA shims and glue for old drivers
options COMPAT_OLDPCI #Use PCI shims and glue for old drivers

View File

@ -2,7 +2,9 @@
# $FreeBSD$
#
.ifndef (DESTDIR)
DESTDIR?=/mnt
.endif
STAND_LINKS= bin sbin
USR_LINKS= bin sbin libexec
@ -13,19 +15,19 @@ MY_DEVS= std sysmouse tun2 cuaa0 cuaa1 cuaa2 vty10 fd0 pty0 \
wd0s1h wd0s2 wd0s3 wd0s4 wd1s1h wd1s2 wd1s3 wd1s4
.if ${LANGUAGE} == pl
LOCALE= pl_PL.ISO_8859-2
LOCALE=pl_PL.ISO_8859-2
LOCALE_LINKS=${PL_LOCALE_LINKS}
FONT=iso02-8x16.fnt
KBD=pl_PL.ISO_8859-2.kbd
.else
LOCALE= en_US.ISO_8859-1
LOCALE=en_US.ISO_8859-1
LOCALE_LINKS=${US_LOCALE_LINKS}
.endif
all: tree links
tree:
mtree -deU -f mfs.mtree -p ${DESTDIR}
mtree -deU -f ../build/mfs.mtree -p ${DESTDIR}
links: tree
(cd ${DESTDIR}; \
@ -42,13 +44,14 @@ links: tree
done; \
cd share/misc;\
ln -s /etc/termcap termcap; \
echo emacs >/mnt/usr/share/misc/init.ee; \
echo emacs >${DESTDIR}/usr/share/misc/init.ee; \
cd ../; \
cd locale; \
for i in ${LOCALE_LINKS}; \
do \
ln -s ${LOCALE} $${i}; \
done; \
mkdir ${LOCALE}/; \
cp /usr/share/locale/${LOCALE}/* ${LOCALE}/; \
if [ "X${FONT}" != "X" ]; \
then \

View File

@ -2,7 +2,7 @@
# $FreeBSD$
#Line starting with #PicoBSD contains PicoBSD build parameters
#marker def_sz init MFS_inodes floppy_inodes
#PicoBSD 1600 init 4096 32768
#PicoBSD 2400 init 4096 32768
#
machine i386
@ -29,6 +29,8 @@ options INTRO_USERCONFIG #imply -c and parse info area
#options DEVFS
options PCI_QUIET
options NO_SWAPPING
options COMPAT_OLDISA #Use ISA shims and glue for old drivers
options COMPAT_OLDPCI #Use PCI shims and glue for old drivers
device isa0
device pci0

View File

@ -2,10 +2,6 @@
#
# NOTE1: the string "/usr/src" will be automatically replaced with the
# correct value set in 'build' script - you should change it there
#
# NOTE2: use of init(8) is now optional (selectable in "build" script).
# See Makefile for details on how it's added here - you shouldn't add it
# manually here...
# other sources
srcdirs /usr/src/bin
@ -19,15 +15,15 @@ srcdirs /usr/src/libexec
# ns, vm etc...
srcdirs ../../tinyware
progs ppp ftp telnet ee gzip more
progs ppp ftp telnet ee gzip more oinit
#progs ssh
ln gzip gunzip
ln gzip zcat
ln gzip gzcat
progs sh test kget echo pwd msg stty
progs sh test kget echo pwd msg stty init
progs hostname cat kill sps vm ns
progs chmod chown help
progs chmod chown help getty
progs cp df fsck ping mv ln traceroute
progs ifconfig kbdcontrol moused
progs ls mkdir mount mount_msdos mount_cd9660 mount_ext2fs

View File

@ -12,4 +12,5 @@ etc/rc.serial
etc/remote
etc/shells
etc/snmpd.conf
etc/sshd_config
etc/ttys

View File

@ -28,5 +28,8 @@ cd /etc
umount /start_floppy
echo "Ok. (Now you can remove floppy if you like)"
echo ""
gzip -d -f *.gz
. rc
exit 0

View File

@ -100,4 +100,3 @@ echo '| |'
echo '| abial@freebsd.org |'
echo '| |'
echo '+----------------------------------------------+'
exit 0

View File

@ -6,26 +6,5 @@
# This entry needed for asking password when init goes to single-user mode
# If you want to be asked for password, change "secure" to "insecure" here
console none unknown off secure
#
ttyv0 "/usr/libexec/getty Pc" cons25 on secure
# Virtual terminals
ttyv1 "/usr/libexec/getty Pc" cons25 on secure
ttyv2 "/usr/libexec/getty Pc" cons25 on secure
ttyv3 "/usr/libexec/getty Pc" cons25 on secure
ttyv4 "/usr/libexec/getty Pc" cons25 on secure
ttyv5 "/usr/libexec/getty Pc" cons25 on secure
ttyv6 "/usr/libexec/getty Pc" cons25 on secure
ttyv7 "/usr/libexec/getty Pc" cons25 on secure
ttyv8 "/usr/libexec/getty Pc" cons25 on secure
ttyv9 "/usr/libexec/getty Pc" cons25 on secure
# Pseudo terminals
ttyp0 none network secure
ttyp1 none network secure
ttyp2 none network secure
ttyp3 none network
ttyp4 none network
ttyp5 none network
ttyp6 none network
ttyp7 none network
ttyp8 none network
ttyp9 none network
ttyv0 "/usr/libexec/getty Pc" cons25 on secure

View File

@ -1,4 +1,3 @@
proc /proc procfs rw 0 0
/dev/fd0c /fd ufs rw,noauto 0 0
/dev/wd0s1 /dos msdos rw,noauto 0 0
/dev/wd0s1a /wd ufs rw,noauto 0 0

View File

@ -14,16 +14,14 @@ export PATH
trap "echo 'Reboot interrupted'; exit 1" 3
### Special setup for one floppy PICOBSD ###
set `df /` ; dev="/dev/$8"
echo "Reading /etc from ${dev}..."
mount -o rdonly ${dev} /mnt
cd /mnt/etc ; cp -Rp . /etc/
cp -Rp /mnt/root /
mount -o rdonly /dev/fd0 /start_floppy
cd /start_floppy/etc ; cp -Rp . /etc/
cp -Rp /start_floppy/root /
cd /etc
gzip -d *.gz
pwd_mkdb -p ./master.passwd
umount /mnt
echo "Ok. (Now you can remove ${dev} if you like)"
umount /start_floppy
echo "Ok. (Now you can remove /dev/fd0 if you like)"
echo ""
. rc
exit 0

View File

@ -1,9 +1,9 @@
#!/bin/sh
# $FreeBSD$
pwd=`pwd`
set `df /` ; dev="/dev/$8"
set `df /` ; dev="$8"
echo -n "Updating /etc contents on ${dev}... "
mount ${dev} /mnt
mount ${dev} /start_floppy
if [ "X$?" != "X0" ] ; then
echo ""
echo "Cannot mount ${dev} read-write!"
@ -12,11 +12,11 @@ fi
cd /etc
rm *.db
rm passwd
cp -Rp . /mnt/etc/
cp -Rp . /start_floppy/etc/
pwd_mkdb master.passwd
echo " Done."
echo -n "Updating kernel parameters... "
kget /mnt/boot/kernel.conf
umount /mnt
kget /start_floppy/boot/kernel.conf
umount /start_floppy
cd ${pwd}
echo " Done."

View File

@ -89,3 +89,6 @@ pseudo-device pty 16
pseudo-device md
#pseudo-device gzip # Exec gzipped a.out's
pseudo-device bpfilter 4
options COMPAT_OLDISA #Use ISA shims and glue for old drivers
options COMPAT_OLDPCI #Use PCI shims and glue for old drivers

View File

@ -30,15 +30,15 @@ clean:
*.gz
install:
cp crunch1 /mnt/stand/crunch
chmod 555 /mnt/stand/crunch
cp crunch1 ${MFS_MOUNTPOINT}/stand/crunch
chmod 555 ${MFS_MOUNTPOINT}/stand/crunch
for i in `crunchgen -l crunch1.conf` ; \
do \
ln /mnt/stand/crunch /mnt/stand/$${i}; \
ln ${MFS_MOUNTPOINT}/stand/crunch ${MFS_MOUNTPOINT}/stand/$${i}; \
done
rm /mnt/stand/crunch
rm ${MFS_MOUNTPOINT}/stand/crunch
# Install the MIB files
#cp mibs/*.txt /mnt/usr/local/share/snmp/mibs/
#cp mibs/*.txt ${MFS_MOUNTPOINT}/usr/local/share/snmp/mibs/
.include <bsd.prog.mk>

View File

@ -135,3 +135,7 @@ pseudo-device tun 2
pseudo-device pty 16
pseudo-device md
#pseudo-device gzip # Exec gzipped a.out's
options COMPAT_OLDISA #Use ISA shims and glue for old drivers
options COMPAT_OLDPCI #Use PCI shims and glue for old drivers

View File

@ -30,6 +30,8 @@ options IPFIREWALL
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPDIVERT
options PCI_QUIET
options COMPAT_OLDISA #Use ISA shims and glue for old drivers
options COMPAT_OLDPCI #Use PCI shims and glue for old drivers
#options DEVFS
# Support for bridging and bandwidth limiting
#options DUMMYNET

View File

@ -26,6 +26,7 @@ mount -o rdonly /dev/fd0a /start_floppy
cd /start_floppy/etc
cp -Rp . /etc/
cd /etc
gzip -d -f *.gz
pwd_mkdb -p ./master.passwd
umount /start_floppy
echo "Ok. (Now you can remove floppy if you like)"

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -
# $FreeBSD$
############################################
### Special setup for one floppy PICOBSD ###

View File

@ -83,3 +83,7 @@ pseudo-device ether
pseudo-device ppp 4
pseudo-device pty 16
pseudo-device md
options COMPAT_OLDISA #Use ISA shims and glue for old drivers
options COMPAT_OLDPCI #Use PCI shims and glue for old drivers

View File

@ -22,13 +22,13 @@ clean:
*.gz
install:
cp crunch1 /mnt/stand/crunch
chmod 555 /mnt/stand/crunch
cp crunch1 ${MFS_MOUNTPOINT}/stand/crunch
chmod 555 ${MFS_MOUNTPOINT}/stand/crunch
for i in `crunchgen -l crunch1.conf` ; \
do \
ln /mnt/stand/crunch /mnt/stand/$${i}; \
ln ${MFS_MOUNTPOINT}/stand/crunch ${MFS_MOUNTPOINT}/stand/$${i}; \
done
rm /mnt/stand/crunch
rm ${MFS_MOUNTPOINT}/stand/crunch
.include <bsd.prog.mk>