[Cu-wireless] to-do list for netbsd bootable cd-rom
David Young
dyoung at onthejob.net
Mon May 6 23:22:15 CDT 2002
Zach & Ralph,
Here is the to-do list I have kept as I produced the bootable CD-ROM.
The list is written in my own short-hand, but it should give you
the general flavor of what I have been doing. I am going to dedicate
myself for the next few days to producing convenient scripts and more
intelligible instructions.
The Web page that got me started making a bootable CD-ROM was this one:
http://www.daemonnews.org/200106/bootable_CD.html
I have only skimmed this page; it seems to contain similar information
as the first:
http://www.bsdtoday.com/2002/March/Features646.html
[x] Add to /etc/fstab entries for writable memory filesystems /etc,
/home, /var, /tmp. Set their sizes right (PITA). See 'man 4 mfs'.
[x] In /etc/rc.d, change mountcritlocal to REQUIRE mountcritmem instead
of root. Actually, change every script that REQUIREs root to REQUIRE
mountcritmem. See /etc/rc, 'man rcorder'.
[x] In /etc/rc.d, add mountcritmem which REQUIREs root. If /cdboot exists,
mountcritmem mounts /var, /home, /tmp, and /etc (/etc last, so that
the /etc/fstab is available until the last moment!) and extracts
/cdrom/mfs.tgz in /. Otherwise, mountcritmem does nothing. See
'man rcorder' and the daemonnews.org article.
[x] Turn off swap; disable warnings by setting no_swap=YES in
/etc/rc.conf. See 'man rc.conf'.
[x] On a hard drive, change rc.conf, defaults/rc.conf to list /usr
in a new variable, critical_filesystems_beforemem, as a filesystem
it is critical to mount before preparing the memory filesystems,
reason being that pax needs executables in /usr/bin/. (This is not
necessary on the CD, since /usr and / are on the same partition,
thus the executables pax needs in /usr/bin/ are always available.)
[x] In /etc/daily.conf, turn off most the cron stuff that will bog down
with the slowness of the CD-ROM, or produce enormous outputs that
will fill the memory filesystems.
[ ] Ditto with other cron .conf files.
[ ] To conserve memory disk, keep fewer logs, and rotate them more
rapidly. Change /etc/newsyslog.conf for this.
[ ] Figure out what to do about /root. Another mfs? Link to /home/root ?
Let's just forget about it, since it hasn't been a problem.
[x] Create /etc/myname (is this ordinarily done at install?), which is
the file from which /etc/rc reads the hostname.
[x] Make sure /dev/console exists in /dev. If it does not, all hell will
break loose at boot. IIRC, init will go haywire, trying to create
/dev/console and other device special files.
[x] add to /etc/dhclient.conf 'send option dhcp-client-identifier =
"cu-wireless";' and 'request subnet-mask, broadcast-address, routers,
domain-name, domain-name-servers, host-name;'
[x] edit /etc/rc.d/ttys so that it does not chmod any ttys in /dev
[x] In /etc/rc.d, add createifs that REQUIREs mountcritmem. In createifs,
if /cdboot exists, create /etc/ifconfig.* from select interfaces in
'ifconfig -l' (e.g., ep?, wi?, fxp?, an?). Link to exemplar files
(e.g., ifconfig.ep.xmpl, ifconfig.wi.xmpl, ifconfig.xmpl---is
wildcard) when they exist. Make rc.d/network depend upon
rc.d/createifs. Possibly rewrite arguments to dhclient? Or rewrite
/etc/rc.d/dhclient? Or /etc/dhclient.conf? Study some more. See
'man ifconfig.if' and 'man rcorder'.
[x] Install screen, encap, Zebra, PERL, Python, vim, wget.
[x] Link /usr/pkg/bin/python22 to /usr/pkg/bin/python
[x] Install gdbm, py-gdbm in anticipation of installing the rudimentary
database program.
[x] Start sshd at boot.
[x] Create a small kernel (suitable for a floppy) w/ cd0a boot device,
dyoung_wi_tiny.
[x] Re-enable pseudo-device rnd in small kernel because sshd needs it.
[ ] Write templates for zebra.conf and ospfd.conf. Create them at
boot from parameters in dhcp response and in database response.
[ ] Write /etc/rc.d/zebra and /etc/rc.d/ospfd, the second dependent on
the first.
[ ] Add to rc.conf zebra=YES and ospfd=YES.
[x] Change /netbsd configuration to mount root from cd0a.
[ ] In bootloader, change to CONSDEV_AUTO serial policy for field
diagnosis of headless stations. See boot_console man page. Basically,
I want the opportunity to diddle with the box starting at boot whether
it has a monitor and keyboard attached or not. Presumably I will
have a laptop w/ serial port on-site more often than I will have a
display and keyboard. That's certainly been my experience up 'til now.
[x] Take /usr out of CD-ROM's /etc/fstab. Change / partition name to cd0a.
Change / fstype to cd9660. Add read-only option. Add extatt option,
just in case (see man mount_cd9660).
For every CD-ROM:
[ ] Create floppy image like so
mdconfig /dev/md0d 2880 &
newfs -T floppy /dev/md0a
mount /dev/md0a /mnt/floppy/
# netbsd comes from sys/arch/i386/compile/dyoung_wi_tiny
gzip < netbsd > /mnt/floppy/netbsd.gz
umount /mnt/floppy/
mknod /dev/rmd0a c 24 0
/usr/mdec/installboot -f /usr/mdec/biosboot.sym /dev/rmd0a
cd $ROOT # $ROOT is the root of the filesystem we will write to CD-ROM
dd if=/dev/md0a of=cdboot/boot.img bs=1024 count=1440
# insert floppy disk
fdformat -f /dev/fd0a
dd if=cdboot/boot.img of=/dev/fd0a bs=1024 count=1440
alternatively, use vnconfig
dd if=/dev/zero of=cdboot/boot.img bs=1024 count=1440
vnconfig vnd0 cdboot/boot.img
disklabel -w -r /dev/vnd0c floppy
newfs -T floppy /dev/vnd0a
mount /dev/vnd0a /mnt/floppy/
# gzip, umount, installboot, ..., skip dd of md0a, fdformat, dd to
# floppy disk.
to update boot.img,
vnconfig vnd0 boot.img
disklabel -w -r /dev/vnd0c floppy
mount /dev/vnd0a /mnt/floppy
gzip < netbsd > /mnt/floppy/netbsd.gz
umount /mnt/floppy
)
[ ] Add /netbsd to CD-ROM. Better be the same as the boot kernel.
kvm_mkdb requires it. Do not compress it, kvm_mkdb does not grok
netbsd.gz.
[ ] Create /dev/log by 'ln -sf /var/run/log /dev/log'. Otherwise,
/etc/rc.d/syslogd or something will try and fail to create it at boot.
[ ] On the CD, change the last columns of /etc/fstab to 0 0 throughout.
[ ] Add 'config netbsd root on cd0a type cd9660' to kernel config.
[ ] Create CD image w/ floppy image cdboot/boot.img for boot. It is important
to use -R instead of -r. In directory ~dyoung/cu-wireless/,
mkhybrid -o boot.iso -b cdboot/boot.img -c boot.catalog -a \
-l -J -R -L ./station-boot-cd
[ ] Clean up /home before producing /cdboot/mfs.tgz.
[ ] Create /cdboot/mfs.tgz by
# remove /dev files cd9660 cannot handle with a command similar to this,
# but NOT this (see the tail -600? suppose there aren't 600 files to
# delete, in your case?)
ls -l | grep '^[cbps]' | sort -k 6 -n | tail -600 | \
awk '{ print $10; }' | xargs rm
[ -d /cdboot ] || mkdir /cdboot || bomb "mkdir /cdboot FAILED"
# $ROOT is the root of the filesystem we will write to CD-ROM
cd $ROOT ; pax -wzf cdboot/mfs.tgz var etc home
Todo once:
[ ] Write scripts to produce ISO & floppy images containing the
development environment. Create a devel environment manifest,
files.devel.
[ ] Write script to install binary packages to the CD in its
development environment.
[ ] Produce a script that will download pkgsrc into the development
environment? (Do not include pkgsrc on the CD-ROM w/o doing a make
clean or make distclean first!)
[ ] Write scripts to write CD-ROM to hard drive and set up devel
environment. Add a directory /devel to CD. Write this to hard drive,
turning CD inside-out so that /devel encloses the CD contents (in
directory station-boot-cd) instead of the other way around.
[ ] Report bug where cd9660 will not handle minor node numbers greater
than 512*1024 on block/character devices.
Dave
--
David Young OJC Engineering from the Right Brain
dyoung at onthejob.net Urbana, IL * (217) 278-3933
More information about the CU-Wireless
mailing list