Commit 346c0562 authored by Mike Hibler's avatar Mike Hibler

Frisbee MFS changes:

 * support FreeBSD 6
 * client-side changes to support enable/disable of ACPI via slicefix
 * use dynamically linked Emulab binaries in frisbee MFS (for size)
parent 747c20a6
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
# Testbed Makefile
......@@ -215,11 +215,21 @@ frisbee-mfs: mfsoscheck
@$(MAKE) -C os frisbee-mfs
@$(MAKE) -C tmcd frisbee-mfs
frisbee-mfs-nostatic: mfsoscheck
@NOSTATIC=1 $(MAKE) -C cdrom/groklilo client
@NOSTATIC=1 $(MAKE) -C os frisbee-mfs
@NOSTATIC=1 $(MAKE) -C tmcd frisbee-mfs
frisbee-mfs-install: destdircheck frisbee-mfs
@CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C cdrom/groklilo client-install
@$(MAKE) -C os frisbee-mfs-install
@$(MAKE) -C tmcd frisbee-mfs-install
frisbee-mfs-nostatic-install: destdircheck frisbee-mfs-nostatic
@CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C cdrom/groklilo client-install
@$(MAKE) -C os frisbee-mfs-install
@$(MAKE) -C tmcd frisbee-mfs-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
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2004, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -12,6 +12,13 @@ SUBDIR = cdrom/groklilo
include $(OBJDIR)/Makeconf
ifeq ($(NOSTATIC),)
# for now we link everything static
LDSTATIC = -static
else
LDSTATIC =
endif
all: groklilo
include $(TESTBED_SRCDIR)/GNUmakerules
......@@ -19,7 +26,7 @@ include $(TESTBED_SRCDIR)/GNUmakerules
CFLAGS += -O -g -Wall -I${OBJDIR} -UINBOOTLOADER
groklilo: groklilo.c
$(CC) $(CFLAGS) -static -g -o groklilo $< $(LFLAGS)
$(CC) $(CFLAGS) $(LDSTATIC) -g -o groklilo $< $(LFLAGS)
client: groklilo
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004, 2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2004, 2006, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -26,6 +26,13 @@ endif
include $(OBJDIR)/Makeconf
ifeq ($(NOSTATIC),)
# for now we link everything static
LDSTATIC = -static
else
LDSTATIC =
endif
all: frisbee frisbeed
include $(TESTBED_SRCDIR)/GNUmakerules
......@@ -54,8 +61,8 @@ SERVERFLAGS = $(CFLAGS)
SERVERLIBS = $(PTHREADLIBS)
SERVEROBJS = server.o $(SHAREDOBJS)
CFLAGS = -O2 -g -Wall -fno-builtin-log -static $(PTHREADCFLAGS) -DSTATS
LDFLAGS = -static
CFLAGS = -O2 -g -Wall -fno-builtin-log $(LDSTATIC) $(PTHREADCFLAGS) -DSTATS
LDFLAGS = $(LDSTATIC)
#
# Define this if your implementation of cond_vars works well
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2004, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -11,11 +11,18 @@ SUBDIR = os/growdisk
include $(OBJDIR)/Makeconf
ifeq ($(NOSTATIC),)
# for now we link everything static
LDSTATIC = -static
else
LDSTATIC =
endif
all: growdisk
include $(TESTBED_SRCDIR)/GNUmakerules
CFLAGS = -O -g -static -I$(SRCDIR)/../imagezip
CFLAGS = -O -g $(LDSTATIC) -I$(SRCDIR)/../imagezip
growdisk: growdisk.o
$(CC) $(CFLAGS) growdisk.o -o growdisk
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
SRCDIR = @srcdir@
......@@ -13,6 +13,13 @@ SYSTEM := $(shell uname -s)
include $(OBJDIR)/Makeconf
ifeq ($(NOSTATIC),)
# for now we link everything static
LDSTATIC = -static
else
LDSTATIC =
endif
all: server fullclient client
fullclient: tmcc
client: tmcc-nossl findif dostype
......@@ -80,7 +87,7 @@ tmcd: tmcd.c ${TMCDLIBS} decls.h version.o $(SSLOBJ)
$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS)
tmcc: tmcc.c decls.h $(SSLOBJ)
$(CC) $(CFLAGS) $(SSLFLAGS) -static -g -o tmcc $< $(SSLOBJ) \
$(CC) $(CFLAGS) $(SSLFLAGS) $(LDSTATIC) -g -o tmcc $< $(SSLOBJ) \
$(LFLAGS) $(TMLIBS)
tmcc-shared: tmcc.c decls.h $(SSLOBJ)
......@@ -88,10 +95,10 @@ tmcc-shared: tmcc.c decls.h $(SSLOBJ)
$(LFLAGS) $(TMLIBS)
tmcc-nossl-debug: tmcc.c decls.h
$(CC) $(CFLAGS) -static -g -o $@ $< $(LFLAGS) $(TMSLIBS)
$(CC) $(CFLAGS) $(LDSTATIC) -g -o $@ $< $(LFLAGS) $(TMSLIBS)
findif-debug: findif.o
$(CC) $(CFLAGS) -g -o $@ findif.o $(LFLAGS) -static
$(CC) $(CFLAGS) -g -o $@ findif.o $(LFLAGS) $(LDSTATIC)
dostype-debug: dostype.o
$(CC) $(CFLAGS) -g -o $@ dostype.o $(LFLAGS)
......@@ -139,7 +146,7 @@ ${OBJDIR}/lib/libtb/%:
cd ${OBJDIR}/lib/tbdb && gmake $<
clean: subdir-clean
rm -f *.o core tmcd tmcc tmcc-nossl findif dostype version.c
rm -f *.o core tmcd tmcc tmcc-nossl findif dostype *-debug version.c
subdir-clean:
@$(MAKE) -C $(MDSUBDIR) clean
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
......@@ -49,6 +49,15 @@ if [ x"$new_host_name" = x ]; then
exit 0
fi
#
# XXX compenstate for a stupid long time bug in the dhclient-script
#
curhname=`hostname`
if [ $reason = BOUND -a -z "$curhname" -a -n "$new_host_name" ]; then
echo "`date`: hostname is $new_host_name" >>$LOGDIR/dhclient-exit.log 2>&1
hostname $new_host_name
fi
#
# Remember our server IP, real hostname, router IP, etc.
#
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
# Optional flag argument says "do not reboot"
......@@ -85,6 +85,8 @@ DISK=`echo $LOADINFO | awk -F= '{ printf $5 }' | awk -F' ' '{ print $1 }'`
DISK=${DISK:-'ad0'}
ZFILL=`echo $LOADINFO | awk -F= '{ printf $6 }' | awk -F' ' '{ print $1 }'`
ZFILL=${ZFILL:-'0'}
ACPI=`echo $LOADINFO | awk -F= '{ printf $7 }' | awk -F' ' '{ print $1 }'`
ACPI=${ACPI:-'unknown'}
if [ "$PARTITION" != "0" ]; then
SLICE="-s $PARTITION"
......@@ -218,6 +220,7 @@ if [ x"$ADDRESS" != x ]; then
echo "Resizing final disk partition"
$BINDIR/growdisk -vW /dev/$DISK
echo "Adjusting slice-related files"
export SLICEFIX_ACPI=$ACPI
$BINDIR/slicefix $PARTITION $DISK
echo "Image load complete at `date`"
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# Copyright (c) 2000-2005, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -27,6 +27,22 @@ case $# in
exit 1
esac
#
# Handle pseudo arguments in the environment.
#
ACPI=${SLICEFIX_ACPI:-'unknown'}
case $ACPI in
0|no|NO)
ACPI=no
;;
1|yes|YES)
ACPI=yes
;;
*)
ACPI=unknown
;;
esac
dofreebsd() {
#
# ARGH! FreeBSD 5, which primarily uses UFS2, internally converts
......@@ -63,7 +79,7 @@ dofreebsd() {
#
# This is clearly not a solution.
#
version=`uname -v | sed -e 's/FreeBSD \([0-9]\).*/\1/'`
vers=`uname -v | sed -e 's/FreeBSD \([0-9]\).*/\1/'`
# see if there is a root ('a') partition on this BSD slice
`disklabel ${disk}s${part} 2>&1 | grep -s -E '^[ ]+a:' >/dev/null` || {
......@@ -86,6 +102,7 @@ dofreebsd() {
#
changedisk=0
changeentropy=0
changeacpi=0
# If our disk does not appear anywhere in fstab, we need to fix it
grep "^/dev/${disk}s" /mnt/etc/fstab >/dev/null 2>&1
......@@ -102,7 +119,40 @@ dofreebsd() {
changeentropy=1
fi
if [ $changedisk -eq 0 -a $changeentropy -eq 0 ]; then
#
# See if we need to change the ACPI setting.
#
# If ACPI was not specified via TMCD, leave it along.
#
# If "acpi_load" does not appear at all in the loader.conf file,
# assume the OS cannot handle it (or that we do not know how to
# change it) and leave it alone.
#
if [ $ACPI != "unknown" ]; then
grep "acpi_load=" /mnt/boot/loader.conf >/dev/null 2>&1
case $? in
0)
grep "^acpi_load=\"YES\"" /mnt/boot/loader.conf >/dev/null 2>&1
case $? in
0)
if [ $ACPI = "no" ]; then
changeacpi=1
fi
;;
*)
if [ $ACPI = "yes" ]; then
changeacpi=1
fi
;;
esac
;;
*)
;;
esac
fi
if [ $changedisk -eq 0 -a $changeentropy -eq 0 -a $changeacpi -eq 0 ]; then
echo " no changes necessary"
umount $rootdev
return 0
fi
......@@ -134,11 +184,39 @@ dofreebsd() {
dd if=/dev/random of=/mnt/entropy bs=4096 count=1 >/dev/null 2>&1
fi
if [ $changeacpi -eq 1 ]; then
if [ $ACPI = "no" ]; then
on="dis"
else
on="en"
fi
echo " ${on}abling ACPI"
sed -E -i .orig -e "/[Aa][Cc][Pp][Ii]/d" /mnt/boot/loader.conf || {
echo "Failed to update /boot/loader.conf"
umount $rootdev
return 1
}
if [ $ACPI = "no" ]; then
cat <<EOF1 >>/mnt/boot/loader.conf
# disable ACPI
acpi_load="NO"
hint.acpi.0.disabled=1
loader.acpi_disabled_by_user=1
EOF1
else
cat <<EOF2 >>/mnt/boot/loader.conf
# enable ACPI
acpi_load="YES"
hint.acpi.0.disabled=0
EOF2
fi
fi
umount $rootdev
# XXX need to fixup FS, see big comment above
if [ "x$version" = "x5" ]; then
echo "WARNING: FBSD5 may have modified the UFS1 root FS"
if [ "x$vers" != "x4" ]; then
echo "WARNING: FBSD${vers} may have modified the UFS1 root FS"
fi
return 0
......
# Common to both MFSes
sendmail_enable="NONE"
inetd_enable="NO"
cron_enable="NO"
ldconfig_paths=""
ldconfig_paths_aout=""
blanktime="NO"
update_motd="NO"
background_fsck="NO"
rc_info="YES"
network_interfaces="lo0"
syslogd_enable="NO"
# Specific to frisbee MFS
cron_enable="NO"
devd_enable="NO"
#
# 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"
# Common to both MFSes
sendmail_enable="NONE"
inetd_enable="NO"
ldconfig_paths=""
ldconfig_paths_aout=""
blanktime="NO"
update_motd="NO"
background_fsck="NO"
rc_info="YES"
syslogd_enable="NO"
# Specific to frisbee MFS
cron_enable="NO"
devd_enable="NO"
#
# 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"
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -90,3 +90,13 @@ sysetc-install: dir-install netif-emulab
script-install: dir-install
# $(INSTALL) -m 755 $(SRCDIR)/prepare $(BINDIR)/prepare
#
# NOTES:
# * We still use rc.conf.d/dhclient right now (til we switch to 6.x rc.d files)
#
frisbee-mfs-install:
(cd ../freebsd5; $(MAKE) all frisbee-mfs-install)
rm -f $(SYSETCDIR)/testbed/dhclient
rm -f $(DESTDIR)/usr/local/etc/dhclient*
ln -s /etc/dhclient* $(DESTDIR)/usr/local/etc/
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