Commit 45cfc3c6 authored by Leigh Stoller's avatar Leigh Stoller

Checkpoint the instructions for creating a bootable CDROM and a

stand alone bootable MFS (ala our PXE MFS). The bootable CD-ROM
can go multiuser and run sshd, and do imagezip and unzip. I support
I could commit the .iso file, but that would really annot people!
parent ada1f551
*** To duplicate the CD:
dd if=/dev/acd0c of=file.iso bs=2048
*** To mount the ISO file:
vnconfig -e vn0c file.iso
mount -t cd9660 /dev/vn0c /mnt
*** Copy the CDROM:
Note that this is read only. Use hier to make a complete copy of the
filesystem. You could also just mount the cd normally and copy it off.
su1 hier cp /mnt /FOO
I then removed CVS-REPO and commerce from the root directory of the
copy, which frees up about 350 MB!
*** Modify the copy of the CD image so that it can go multiuser:
Copy in fstab, rc.conf, and rc.cdroot from this directory to /etc of your
new directory tree. Edit the rc.conf to make sure the DHCP interfaces are
correct.
You also want to give it a root password. You can do that by using the -d
option to vipw:
vipw -d /FOO/etc
Create the ssh host keys in /FOO/etc/ssh:
/usr/bin/ssh-keygen -N "" -f /FOO/etc/ssh/ssh_host_key
/usr/bin/ssh-keygen -d -N "" -f /FOO/etc/ssh/ssh_host_dsa_key
Edit /FOO/etc/ssh/sshd_config to allow root login:
PermitRootLogin yes
Edit /FOO/etc/ttys and turn on the serial console if you want to use
the serial console.
console "/usr/libexec/getty std.115200" unknown on secure
Create /FOO/usr/site/bin and stash useful (required) stuff in it:
-rwxr-xr-x 1 root wheel 205084 Jun 26 06:15 hier*
-rwxrwxr-x 1 root wheel 90952 Jun 26 12:25 imageunzip*
-rwxrwxr-x 1 root wheel 129174 Jun 26 10:49 imagezip*
-r-xr-xr-x 1 root wheel 124532 Jun 26 10:48 wget*
Create /FOO/usr/local/lib and copy in libintl.so.2, which is needed
by wget, unless you go and reconfig it to statically link.
*** Create a bootable CD that does not run from the mini fs.
So, the problem with bootable CDs is that they really boot from a
floopy image on the CD. The mfsroot that the fixit disk runs from is
inside the floopy image. Obviously, thats too small to be very useful,
and you cannot run from the CD since its read-only, and we really want
to go multiuser so that we can use all the good tools including ssh!
We are going to make a minor change to floopy image so that it does not
load the mini mfsroot, and so that it boots directly from the CDROM.
This is okay; it will initially boot up with / read-only.
First off, you need to mount the floopy image from the CD.
cd /FOO/floppies
vnconfig vn0 boot.flp
mount /dev/vn0 /mnt/floopy
Edit /mnt/floopy/boot/loader.rc:
load /kernel
set vfs.root.mountfrom="cd9660:acd0a"
autoboot 10
Compress and copy kernel.GENERIC from the CDROM to the boot floopy image.
cat /FOO/kernel.GENERIC | gzip -9 > /mnt/floopy/kernel.gz
This is necessary cause something about the original kernel on the boot
floopy does not work correctly when putting /dev on an mfs. Also, it does
not drop into that userconfig interface on boot.
Then unmount/close the boot floopy.
umount /mnt/floopy
vnconfig -u vn0
*** To create a new ISO file once you have modified the tree:
mkisofs -U -R -b floppies/boot.flp -c floppies/boot.catalog \
-o /path/bootable.iso /FOO
*** To burn the CD I used used the windows box. The plextor software
comes with Easy CD Creator, which lets you create a CD from a
.iso file. The File menu has "Create CD from file" option, which
worked really slick. There are BSD programs to do this, but I do
not know what they are. I have a samba connection, so I browsed the
.iso file from my unix box. It will warn about reading from across the
network, but it works just fine cause of the burnproof thing the
plextor does.
# Device Mountpoint FStype Options Dump Pass#
/dev/acd0a / cd9660 ro 0 0
proc /proc procfs rw 0 0
5.2M ./bin
12K ./boot/defaults
403K ./boot
1.0K ./dev/fd
68K ./dev
104K ./etc/defaults
2.0K ./etc/gnats
47K ./etc/isdn
1.0K ./etc/kerberosIV
217K ./etc/mail
50K ./etc/mtree
12K ./etc/namedb
82K ./etc/periodic
3.0K ./etc/ppp
1.0K ./etc/skel
35K ./etc/ssh
9.0K ./etc/ssl
17K ./etc/uucp
1.0K ./etc/X11
1.1M ./etc
1.0K ./mnt
1.0K ./proc
5.0K ./root
8.9M ./sbin
1.0K ./tmp
12M ./usr/bin
579K ./usr/site
5.9M ./usr/lib
8.8M ./usr/libdata
539K ./usr/libexec
1.0K ./usr/local
1.0K ./usr/obj
6.6M ./usr/sbin
1.0K ./usr/src
34M ./usr
1.0K ./var/account
3.0K ./var/at
1.0K ./var/backups
2.0K ./var/crash
2.0K ./var/cron
4.0K ./var/db
61K ./var/games
1.0K ./var/heimdal
1.0K ./var/log
1.0K ./var/mail
1.0K ./var/msgs
1.0K ./var/preserve
2.0K ./var/run
1.0K ./var/rwho
15K ./var/spool
2.0K ./var/tmp
20K ./var/yp
120K ./var
50M .
*** Create an mfsroot directory tree from the CD:
So, follow the steps to create another copy of the fixit CD on hardisk.
The cut it way back so that it fits in a 64 MB filesystem. This is not as
hard as it seems. See the FILES file in this directory for a dump of the
top level directories, which should give you a good idea of what to cut
back. Note that you do not need any .a libs or any _p (profile) libs!
You do not the compat libs either.
Note that you cannot use this mfsroot on the CDROM cause it has to fit into
a 2.8MB floopy boot image. Its good for booting via PXE or for putting in
/boot on your disk.
Copy in fstab and rc.conf from this directory to /etc of your new directory
tree. Edit the rc.conf to make sure the DHCP interfaces are correct.
You also want to give it a root password. You can do that by using the -d
option to vipw:
vipw -d /FOO/etc
Create the ssh host keys in /FOO/etc/ssh:
/usr/bin/ssh-keygen -N "" -f /FOO/etc/ssh/ssh_host_key
/usr/bin/ssh-keygen -d -N "" -f /FOO/etc/ssh/ssh_host_dsa_key
Edit /etc/ssh/sshd_config to allow root login:
PermitRootLogin yes
Make sure you have a termcap file in /etc:
rm -f /FOO/etc/termcap
cp /etc/termcap /FOO/etc/termcap
Edit /FOO/etc/ttys and turn on the serial console:
console "/usr/libexec/getty std.115200" unknown on secure
Create /FOO/usr/site/bin and stash useful (required) stuff in it:
-rwxr-xr-x 1 root wheel 205084 Jun 26 06:15 hier*
-rwxrwxr-x 1 root wheel 90952 Jun 26 12:25 imageunzip*
-rwxrwxr-x 1 root wheel 129174 Jun 26 10:49 imagezip*
-r-xr-xr-x 1 root wheel 124532 Jun 26 10:48 wget*
Create /FOO/usr/local/lib and copy in libintl.so.2, which is needed
by wget, unless you go and reconfig it to statically link.
*** Create the image file.
dd if=/dev/zero of=mfsroot bs=64k count=1024
vnconfig -e -s labels vn0 mfsroot
disklabel -r -w vn0 auto
newfs /dev/vn0c
mkdir -p /mnt/mfs
mount /dev/vn0c /mnt/mfs
su1 hier cp /FOO /mnt/mfs
umount /mnt/mfs
vnconfig -u vn0
cat mfsroot | gzip > mfsroot.gz
Copy this file and a kernel to /boot, or to the tftp boot directory. Its
pretty big though, and perhaps not the best for PXE booting, but it will
work.
# Device Mountpoint FStype Options Dump Pass#
/dev/md0c / ufs rw 0 0
proc /proc procfs rw 0 0
# This file now contains just the overrides from /etc/defaults/rc.conf
# please make all changes to this file.
# -- sysinstall generated deltas -- #
sendmail_enable="NONE"
sshd_enable="YES"
nfs_client_enable="YES"
network_interfaces="fxp0"
ifconfig_fxp0="DHCP"
ifconfig_fxp1="DHCP"
ifconfig_fxp2="DHCP"
ifconfig_fxp3="DHCP"
ifconfig_fxp4="DHCP"
usbd_enable="NO"
xntpd_enable="NO"
ntpdate_enable="NO"
syslogd_enable="NO"
portmap_enable="NO"
inetd_enable="NO"
cron_enable="NO"
ldconfig_paths=""
ldconfig_paths_aout=""
blanktime="NO"
update_motd="NO"
# Copyright (c) 1999 Matt Dillon
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# rc.cdroot
#
# chkerr:
#
# Routine to check for error
#
# checks error code and drops into shell on failure.
# if shell exits, terminates script as well as /etc/rc.
#
chkerr() {
case $1 in
0)
;;
*)
echo "$2 failed: dropping into /bin/sh"
/bin/sh
# RESUME
;;
esac
}
#
# Create a real /tmp
#
/sbin/mount_mfs -s 8192 -b 8192 -f 1024 -i 1024 -T minimum dummy /tmp
chkerr $? "MFS mount on /tmp"
#
# Duplicate /etc using /tmp as a temporary location.
#
/usr/site/bin/hier cp /etc /tmp/etc
chkerr $? "hier cp /etc to /tmp/etc"
/sbin/mount_mfs -s 8192 -b 8192 -f 1024 -T minimum dummy /etc
chkerr $? "MFS mount on /etc"
/usr/site/bin/hier cp /tmp/etc /etc
chkerr $? "hier cp /tmp/etc to /etc"
/bin/rm -rf /tmp/etc
chkerr $? "rm -rf /tmp/etc"
#
# Duplicate /var using /tmp as a temporary location.
#
/usr/site/bin/hier cp /var /tmp/var
chkerr $? "hier cp /var to /tmp/var"
/sbin/mount_mfs -s 8192 -b 8192 -f 1024 -T minimum dummy /var
chkerr $? "MFS mount on /var"
/usr/site/bin/hier cp /tmp/var /var
chkerr $? "hier cp /tmp/var to /var"
/bin/rm -rf /tmp/var
chkerr $? "rm -rf /tmp/var"
#
# Duplicate /dev using /tmp as a temporary location.
#
/usr/site/bin/hier cp /dev /tmp/dev
chkerr $? "hier cp /dev to /tmp/dev"
/sbin/mount_mfs -s 8192 -b 8192 -f 1024 -i 1024 -T minimum dummy /dev
chkerr $? "MFS mount on /dev"
/usr/site/bin/hier cp /tmp/dev /dev
chkerr $? "hier cp /tmp/dev to /dev"
/bin/rm -rf /tmp/dev
chkerr $? "rm -rf /tmp/dev"
chmod 666 /dev/pty[pqrsPQRS]*
chown root:wheel /dev/pty[pqrsPQRS]*
exit 0
# This file now contains just the overrides from /etc/defaults/rc.conf
# please make all changes to this file.
# -- sysinstall generated deltas -- #
sendmail_enable="NONE"
sshd_enable="YES"
nfs_client_enable="YES"
network_interfaces="fxp0"
ifconfig_fxp0="DHCP"
ifconfig_fxp1="DHCP"
ifconfig_fxp2="DHCP"
ifconfig_fxp3="DHCP"
ifconfig_fxp4="DHCP"
usbd_enable="NO"
xntpd_enable="NO"
ntpdate_enable="NO"
syslogd_enable="NO"
portmap_enable="NO"
inetd_enable="NO"
cron_enable="NO"
ldconfig_paths=""
ldconfig_paths_aout=""
blanktime="NO"
update_motd="NO"
# For CD
root_rw_mount="NO"
diskless_mount="/etc/rc.cdroot"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment