Subject: Re: Tiny BSD with DHCP
To: Graham Jenkins <c714553@vus415.telstra.com.au>
From: Bill Squier <groo@cs.stevens-tech.edu>
List: port-i386
Date: 09/01/1999 11:35:45
> Does anybody know of a tiny-BSD implementation which does DHCP; something
> which comes on a single floppy and can be stuffed into any PC on our LAN
> to boot and give me a VT220 terminal?
I recently put together an "almost-diskless" X Terminal installation for
486/33's and 486/66's which fits on a floppy. You need very little besides
the kernel to get a prompt-- just init and a shell. Dhclient-script makes
only one minor complaint about being unable to write resolv.conf, but
otherwise will function in read-only root environments with no modifications.
dhclient itself needs /var/db to be read-write. I solved this in my config by
mounting an MFS over /tmp and providing a symlink from /var/db to /tmp/db on
the read-only floppy. (I also make other small writes in /tmp as well, you
can probably get away with mounting on /var/db directly).
I'd suggest a layout like this:
/
netbsd (custom, take out everything you don't need)
bin/
[
echo
mkdir
sh
etc/
dhclient-script
dhclient.conf (custom or 0 length)
fstab
rc (custom)
sbin/
dhclient
ifconfig
init
route
mount
mount_mfs
mount_nfs
dev/
(devices you need)
var/
db -> /tmp/db
tmp/
To fit this on a floppy, you'll need to compress it-- the details on creating
compressed boot image floppies I can't provide. I simply put a compressed tar
on the floppy and unpacked it to a small root partition on the destination
machine's hard drive.
As an example, here's my custom stage-one rc file from the floppy:
----
#!/bin/sh
# Philosophy: This file does the minimum to get the machine on the network
# and mounts a directory which contains (along with other files) a script
# to continue the rest of the process
# Don't let the user abort this
trap "" 2 3
PATH=/sbin:/bin/:/usr/bin:/usr/sbin:/usr/X11R6/bin
export PATH
# A small memory based file system to allow local writes
mount_mfs -s 200 /dev/wd0b /tmp
# Obtain network information from DHCP
# /var/db is a symlink to /tmp/db, thus we must create it first.
mkdir /tmp/db
ifconfig lo0 inet 127.0.0.1
# this will produce an error on machines without ep0
ifconfig ep0 media 10base2 2>/dev/null
dhclient
# Get /etc which contains rc2, the next script to execute
NFS_SERVER=155.246.89.68
NFS_ROOT=/share/netbsd/i386
mount -o ro $NFS_SERVER:$NFS_ROOT/etc /etc
if [ ! -f /etc/rc2 ]; then
echo "[rc]: panic: can't find /etc/rc2"
exit 1
fi
exec /bin/sh /etc/rc2
----
I can provide more details on any of this stuff, but I'll leave it at this
until you (or anyone else for that matter) decides they want to know more.
Good luck.
--
Bill Squier (groo@cs.stevens-tech.edu)
http://www.cs.stevens-tech.edu/~groo
Ph: (201)216-5486 Fax: (201)216-8249