Commit e51f82aa authored by Mike Hibler's avatar Mike Hibler

New directory for flash dongle install.

parent e6fa026e
......@@ -255,6 +255,14 @@ cdboot-install: destdircheck cdboot
@$(MAKE) -C cdrom client-install
@$(MAKE) -C tmcd/freebsd6 cdboot-install
flashboot: mfsoscheck client
@echo "Flash dongle files built"
flashboot-install: destdircheck flashboot
@$(MAKE) -C tmcd/freebsd6 cdboot-install
@$(MAKE) -C os frisbee-mfs-install
@$(MAKE) -C flash client-install
#
# A check to see if this is a 'real' install. Kinda hacky, but as far as I can
# tell, you can't put ifeq()'s inside of targets
......
......@@ -2540,6 +2540,8 @@ outfiles="$outfiles Makeconf GNUmakefile \
xmlrpc/imageid xmlrpc/osid xmlrpc/server xmlrpc/xmlrpcbag \
cdrom/GNUmakefile cdrom/tbbootconfig/GNUmakefile \
cdrom/groklilo/GNUmakefile \
flash/GNUmakefile flash/tbbootconfig/GNUmakefile \
flash/groklilo/GNUmakefile \
dhcpd/dhcpd.conf.template dhcpd/GNUmakefile \
install/GNUmakefile \
install/ops-install install/boss-install install/fs-install \
......
......@@ -921,6 +921,8 @@ outfiles="$outfiles Makeconf GNUmakefile \
xmlrpc/imageid xmlrpc/osid xmlrpc/server xmlrpc/xmlrpcbag \
cdrom/GNUmakefile cdrom/tbbootconfig/GNUmakefile \
cdrom/groklilo/GNUmakefile \
flash/GNUmakefile flash/tbbootconfig/GNUmakefile \
flash/groklilo/GNUmakefile \
dhcpd/dhcpd.conf.template dhcpd/GNUmakefile \
install/GNUmakefile \
install/ops-install install/boss-install install/fs-install \
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ..
SUBDIR = flash
SYSETCDIR = $(DESTDIR)/etc
ETCDIR = $(DESTDIR)$(CLIENT_ETCDIR)
BINDIR = $(DESTDIR)$(CLIENT_BINDIR)
VARDIR = $(DESTDIR)$(CLIENT_VARDIR)
RCDIR = $(DESTDIR)/usr/local/etc/rc.d
INSTALL = /usr/bin/install -c
include $(OBJDIR)/Makeconf
all:
destdircheck:
@if [ -z "$(DESTDIR)" ]; then \
echo "You must define DESTDIR for this target!"; \
false; \
fi
@if [ "$(DESTDIR)" = "/" ]; then \
echo "DESTDIR is '/', really really bad idea!"; \
false; \
fi
client:
$(MAKE) -C ../cdrom/groklilo client
$(MAKE) -C ../cdrom/tbbootconfig client
client-install: destdircheck client
$(MAKE) -C ../cdrom/groklilo client-install
$(MAKE) -C ../cdrom/tbbootconfig client-install
$(INSTALL) -m 644 $(SRCDIR)/rc.conf $(SYSETCDIR)/rc.conf
$(INSTALL) -m 555 $(SRCDIR)/cdroot $(SYSETCDIR)/rc.d/cdroot
$(INSTALL) -m 644 $(SRCDIR)/fstab $(SYSETCDIR)/fstab
$(INSTALL) -m 644 $(SRCDIR)/loader.rc $(DESTDIR)/boot/loader.rc
$(INSTALL) -m 440 $(SRCDIR)/sudoers $(DESTDIR)/usr/local/etc/sudoers
rm -f $(SYSETCDIR)/rc.conf.d/dhclient
clean:
$(MAKE) -C ../cdrom/groklilo clean
$(MAKE) -C ../cdrom/tbbootconfig clean
include $(TESTBED_SRCDIR)/GNUmakerules
[ This README describes how to customize a FreeBSD 6 image for use on a
flash dongle. Mostly this is the same as the cdboot stuff, but based on
a newer FreeBSD. These instructions are for Utah folks as there are a
lot of mysterious pieces with a shady past... ]
*** Start with an initial FreeBSD filesystem.
Ours has just sorta been handed down from generation to generation,
being manually updated along the way. So I could not even begin to
tell you where it came from. The basic theory is: start with a clean
release and remove everything that doesn't matter. Its that last part
that is tricky! :-) Just contact testbed-ops@emulab.net instead.
*** Basic Emulab mods
One you have a base filesystem tree (we'll say it is in /FOO), you
should do some preliminary tweaking that is not part of the Emulab
install.
Set the root password. You can do that by using the -d option to vipw:
vipw -d /FOO/etc
Remove any existing ssh keys in /FOO/etc/ssh. If you want all dongles
to have the same key, either generate one:
/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
of copy in pre-existing ones. Otherwise the system will create keys
when it first boots.
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
Copy a couple of magic programs into /FOO/usr/local/bin:
-rwxr-xr-x 1 root wheel 205084 Jun 26 06:15 hier*
-r-xr-xr-x 1 root wheel 124532 Jun 26 10:48 wget*
Hier is a Utah-local thing. You could probably modify cdroot in this
directory (installed as /FOO/etc/rc.d/cdroot) to use "cp -rp" instead.
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.
We use a special, modified version of the FreeBSD second-level boot loader
(loader) which supports a local 'testbed_boot' command. This can be
found in users.emulab.net:/share/freebsd/6.2/src/sys/boot/i386/emuboot-cd.
The resulting binary will need to be copied into /FOO/boot.
*** Install/update the filesystem tree with the current testbed software
Assuming you have a build tree /OBJ and the source is in /SRC, then do:
cd /OBJ
/SRC/configure --with-TBDEFS=/SRC/defsfile
setenv DESTDIR /FOO
gmake flashboot
sudo gmake flashboot-install
*** Create a bootable flash device
We just want one big filesystem. So stick your dongle in the machine and:
set unit=<unit>
sudo fdisk -I $unit
sudo boot0cfg -B $unit
sudo disklabel -w -B ${unit}s1
sudo newfs /dev/${unit}s1a
(where <unit> is that assigned to the flash drive when plugged in; e.g. "da0")
Make really, really sure you got it right, lest you wipe out your main disk.
Mount it up and copy over the filesystem tree you have:
sudo mkdir /dongle
sudo mount /dev/${unit}s1a /dongle
sudo hier cp /FOO /dongle
Unmount and you are done!
sudo umount /dongle
sudo fsck /dev/${unit}s1a # for good luck
To create future dongles of the same size, I would suggest that you take
a dd image (or a frisbee image if the drive is large) of the unit you just
make and then just lay down that image using a large block size. Flash
drives can be wicked slow, and often the bigger the writes, the faster they
are. In fact, you might want to experiment with making the filesystem
blocksize larger in the "newfs" above to see if you get better performance
with 32K or 64K. You may want to play around with lowering the number of
inodes (-i) in newfs as well; there are only about 8000 files in our
current FS.
*** Test the dongle
Now you can stick it in the machine you want to boot. Of course, you will
have to modify the BIOS on that machine to boot from dongle first (you DID
check to make sure your machine will boot from a flash drive, right?)
# PROVIDE: cdroot
# BEFORE: disks
# KEYWORD: FreeBSD
#
# rc.cdroot
# Inspired by FreeBSD 4.x rc.cdroot and FreesBIE cdboot for 5.x
#
hier=/usr/local/bin/hier
if [ ! -x $hier ]; then
hier=/usr/site/bin/hier
if [ ! -x $hier ]; then
echo "no hier: dropping into /bin/sh"
/bin/sh
fi
fi
# 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
}
mkmfs() {
FS=$1
FSSIZE=$2
DOFSCOPY=$3
if [ $DOFSCOPY -eq 1 ]; then
$hier cp $FS /tmp/$FS
chkerr $? "${FS}: hier save"
fi
echo "Generating ${FS} via md"
MDDEVICE=`/sbin/mdconfig -a -t malloc -s ${FSSIZE}m`
/sbin/newfs -i 1024 /dev/${MDDEVICE} > /dev/null
chkerr $? "${FS}: newfs"
/sbin/mount /dev/${MDDEVICE} ${FS}
chkerr $? "${FS}: mount"
if [ $DOFSCOPY -eq 1 ]; then
$hier mv /tmp/$FS $FS
chkerr $? "${FS}: hier restore"
fi
}
cd /
mkmfs /tmp 4 0
mkmfs /root 1 1
mkmfs /etc 4 1
mkmfs /var 4 1
mkmfs /proj 1 0
mkmfs /users 1 0
mkmfs /groups 1 0
exit 0
# Flash drive:
/dev/da0s1a / ufs ro 0 0
# or CD:
#/dev/acd0a / cd9660 ro 0 0
proc /proc procfs rw 0 0
\ Loader.rc
\ $FreeBSD: src/sys/boot/i386/loader/loader.rc,v 1.1 2003/05/31 05:25:18 scottl Exp $
\
\ Includes additional commands
include /boot/loader.4th
\ Reads and processes loader.rc
start
\ Emulab boot
testbed_boot
sendmail_enable="NONE"
sshd_enable="YES"
nfs_client_enable="YES"
usbd_enable="NO"
ntpd_enable="NO"
ntpdate_enable="YES"
ntpdate_flags="-b ntp1.emulab.net"
syslogd_enable="YES"
inetd_enable="NO"
cron_enable="NO"
ldconfig_paths="/usr/local/lib"
ldconfig_paths_aout=""
blanktime="NO"
update_motd="NO"
rc_info="YES"
#
# FreeBSD has no way to say "DHCP on all available interfaces" without
# spelling out here what all those interfaces are. So here we just say
# to (statically) configure the loopback device. The real network
# interfaces are identified in rc.conf.d/dhclient for use by the
# rc.d/dhclient script.
#
network_interfaces="lo0"
#
# Argh! dhclient in FreeBSD 5 has a new auto-background "feature",
# it dives into the background after 10 seconds regardless of whether
# it has received a response. This is fubar for us. Unfortunately,
# we cannot just crank this number through the roof because it is based
# on a polling interval which actually has a rational purpose. The timeout
# is actually (2 * polling_interval) where polling_interval is how often
# dhclient rechecks an interface without link. We need to keep this value
# reasonable in the event that we boot up and don't immediately have link
# on the control net. So lets try 15 seconds (30 second auto-background
# timeout) and see how things go.
#
dhclient_flags="-i 15"
# For CD
root_rw_mount="NO"
background_fsck="NO"
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
root ALL=(ALL) ALL
%wheel ALL=(ALL) NOPASSWD: ALL
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