# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1245774351 -3600
# Node ID 4155051393333941af13d6e0c637824e5e2db841
# Parent b7f73a7f30789c83b6f41c2bf4e485aeb5c09bfa
Get rid of hardcoded pathes for stubdom and hotplug scripts
- Have the buid system generate a file which exports the install paths
for the hotplug scripts and stubdom / stubdom-dm
- Move file generation code from tools/python/Makefile into a gmake
macro
in Config.mk to avoid maintenance of three duplicates each with its
own
tweaks and bugs
- Export gmake variables into ioemu as shell variables
for upcoming ioemu patches
- Do above as a gmake macro to avoid maintenance of several duplicates
- Adjust hotplug scripts to find the right xen binaries from the
install directory
- Adjust stubdom-dm to use the install directories
Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
---
Config.mk | 22 +++++++++++++++++++++
stubdom/Makefile | 10 ++++++---
stubdom/stubdom-dm | 31 ++++++++++++++++--------------
tools/Makefile | 6 +----
tools/hotplug/Linux/block | 4 +--
tools/hotplug/Linux/network-bridge | 2 -
tools/hotplug/Linux/network-nat | 3 +-
tools/hotplug/Linux/network-route | 3 +-
tools/hotplug/Linux/vif-bridge | 6 ++---
tools/hotplug/Linux/vif-nat | 6 ++---
tools/hotplug/Linux/vif-route | 6 ++---
tools/hotplug/Linux/xen-hotplug-cleanup | 2 -
tools/hotplug/Linux/xen-hotplug-common.sh | 3 +-
tools/hotplug/NetBSD/block-nbsd | 5 +++-
tools/hotplug/NetBSD/vif-bridge-nbsd | 5 +++-
tools/hotplug/NetBSD/vif-ip-nbsd | 5 +++-
tools/hotplug/common/Makefile | 16 ++++++++++-----
tools/python/Makefile | 17 +++-------------
18 files changed, 94 insertions(+), 58 deletions(-)
diff -r b7f73a7f3078 -r 415505139333 Config.mk
--- a/Config.mk Tue Jun 23 17:24:14 2009 +0100
+++ b/Config.mk Tue Jun 23 17:25:51 2009 +0100
@@ -87,6 +87,28 @@ define absolutify_xen_root
export XEN_ROOT
endef
+define buildmakevars2shellvars
+ PREFIX="$(PREFIX)"; \
+ XEN_SCRIPT_DIR="$(XEN_SCRIPT_DIR)"; \
+ export PREFIX; \
+ export XEN_SCRIPT_DIR
+endef
+
+buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1)))
+define buildmakevars2file-closure
+ .PHONY: genpath
+ genpath:
+ rm -f $(1); \
+ echo "SBINDIR=\"$(SBINDIR)\"" >> $(1); \
+ echo "BINDIR=\"$(BINDIR)\"" >> $(1); \
+ echo "LIBEXEC=\"$(LIBEXEC)\"" >> $(1); \
+ echo "LIBDIR=\"$(LIBDIR)\"" >> $(1); \
+ echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> $(1); \
+ echo "XENFIRMWAREDIR=\"$(XENFIRMWAREDIR)\"" >> $(1); \
+ echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> $(1); \
+ echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> $(1)
+endef
+
ifeq ($(debug),y)
CFLAGS += -g
endif
diff -r b7f73a7f3078 -r 415505139333 stubdom/Makefile
--- a/stubdom/Makefile Tue Jun 23 17:24:14 2009 +0100
+++ b/stubdom/Makefile Tue Jun 23 17:25:51 2009 +0100
@@ -77,8 +77,12 @@ TARGET_LDFLAGS += -nostdlib -L$(CROSS_PR
TARGETS=ioemu c caml grub
+STUBDOMPATH="stubdompath.sh"
+genpath-target = $(call buildmakevars2file,$(STUBDOMPATH))
+$(eval $(genpath-target))
+
.PHONY: all
-all: build
+all: genpath build
ifeq ($(STUBDOM_SUPPORTED),1)
build: ioemu-stubdom c-stubdom pv-grub
else
@@ -270,8 +274,7 @@ ioemu: cross-zlib cross-libpci libxc
ioemu: cross-zlib cross-libpci libxc
[ -f ioemu/config-host.mak ] || \
( $(absolutify_xen_root); \
- PREFIX=$(PREFIX); \
- export PREFIX; \
+ $(buildmakevars2shellvars); \
cd ioemu ; \
LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) \
TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" \
@@ -374,6 +377,7 @@ clean:
$(MAKE) -C caml clean
$(MAKE) -C c clean
rm -fr grub-$(XEN_TARGET_ARCH)
+ rm -f $(STUBDOMPATH)
[ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(MAKE) -C
libxc-$(XEN_TARGET_ARCH) clean
-[ ! -d ioemu ] || $(MAKE) -C ioemu clean
diff -r b7f73a7f3078 -r 415505139333 stubdom/stubdom-dm
--- a/stubdom/stubdom-dm Tue Jun 23 17:24:14 2009 +0100
+++ b/stubdom/stubdom-dm Tue Jun 23 17:25:51 2009 +0100
@@ -4,6 +4,9 @@
#
# dm script around stubdomains.
#
+
+. ./stubdompath.sh
+stubdom_configdir="${XEN_CONFIG_DIR}/stubdoms"
# To fit xterms nicely
height=339
@@ -80,7 +83,7 @@ term() {
(
[ -n "$vncpid" ] && kill -9 $vncpid
xm destroy $domname-dm
- rm /etc/xen/stubdoms/$domname-dm
+ rm ${stubdom_configdir}/$domname-dm
) &
# We need to exit immediately so as to let xend do the commands above
exit 0
@@ -97,9 +100,9 @@ done
done
# Generate stubdom config file
-mkdir -p /etc/xen/stubdoms &>/dev/null
-echo "#This file is autogenerated, edit $domname instead!" >
/etc/xen/stubdoms/$domname-dm
-echo "kernel = '/usr/lib/xen/boot/ioemu-stubdom.gz'" >>
/etc/xen/stubdoms/$domname-dm
+mkdir -p ${stubdom_configdir} &>/dev/null
+echo "#This file is autogenerated, edit $domname instead!" >
${stubdom_configdir}/$domname-dm
+echo "kernel = '${XENFIRMWAREDIR}/ioemu-stubdom.gz'" >>
${stubdom_configdir}/$domname-dm
vfb="sdl=$sdl, opengl=$opengl"
test "$DISPLAY" && vfb="$vfb, display=$DISPLAY"
@@ -110,9 +113,9 @@ test "$keymap" && vfb="$vfb, keymap=$key
test "$keymap" && vfb="$vfb, keymap=$keymap"
test "$monitor" && vfb="$vfb, monitor=$monitor"
test "$serial" && vfb="$vfb, serial=$serial"
-echo "vfb = ['$vfb']" >> /etc/xen/stubdoms/$domname-dm
+echo "vfb = ['$vfb']" >> ${stubdom_configdir}/$domname-dm
-echo -n "disk = [ " >> /etc/xen/stubdoms/$domname-dm
+echo -n "disk = [ " >> ${stubdom_configdir}/$domname-dm
j=0
for i in `xenstore-ls /local/domain/$domid/device/vbd | grep 'backend =' | awk
'{print $3}'`
do
@@ -126,13 +129,13 @@ do
vbd_devtype=`xenstore-read $vbd_front/device-type`
if [ $j -ne 0 ]
then
- echo -n "," >> /etc/xen/stubdoms/$domname-dm
+ echo -n "," >> ${stubdom_configdir}/$domname-dm
fi
- echo -n "'$vbd_type:$vbd_disk,$vbd_dev:$vbd_devtype,$vbd_mode'" >>
/etc/xen/stubdoms/$domname-dm
+ echo -n "'$vbd_type:$vbd_disk,$vbd_dev:$vbd_devtype,$vbd_mode'" >>
${stubdom_configdir}/$domname-dm
j=$(( $j + 1 ))
done
-echo " ] " >> /etc/xen/stubdoms/$domname-dm
-echo -n "vif = [ " >> /etc/xen/stubdoms/$domname-dm
+echo " ] " >> ${stubdom_configdir}/$domname-dm
+echo -n "vif = [ " >> ${stubdom_configdir}/$domname-dm
j=0
for i in `xenstore-ls /local/domain/$domid/device/vif | grep 'backend =' | awk
'{print $3}'`
do
@@ -141,13 +144,13 @@ do
vif_mac=`xenstore-read $i/mac`
if [ $j -ne 0 ]
then
- echo -n "," >> /etc/xen/stubdoms/$domname-dm
+ echo -n "," >> ${stubdom_configdir}/$domname-dm
fi
- echo -n "'mac=$vif_mac'" >> /etc/xen/stubdoms/$domname-dm
+ echo -n "'mac=$vif_mac'" >> ${stubdom_configdir}/$domname-dm
j=$(( $j + 1 ))
done
-echo " ] " >> /etc/xen/stubdoms/$domname-dm
-creation="xm create -c /etc/xen/stubdoms/$domname-dm target=$domid memory=32
extra=\"$extra\""
+echo " ] " >> ${stubdom_configdir}/$domname-dm
+creation="xm create -c ${stubdom_configdir}/$domname-dm target=$domid
memory=32 extra=\"$extra\""
(while true ; do sleep 60 ; done) | /bin/sh -c "$creation" &
#xterm -geometry +0+0 -e /bin/sh -c "$creation ; echo ; echo press ENTER to
shut down ; read" &
diff -r b7f73a7f3078 -r 415505139333 tools/Makefile
--- a/tools/Makefile Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/Makefile Tue Jun 23 17:25:51 2009 +0100
@@ -97,10 +97,7 @@ ioemu-dir-find:
fi
set -e; \
$(absolutify_xen_root); \
- PREFIX=$(PREFIX); \
- XEN_SCRIPT_DIR=$(XEN_SCRIPT_DIR); \
- export PREFIX; \
- export XEN_SCRIPT_DIR; \
+ $(buildmakevars2shellvars); \
cd ioemu-dir; \
./xen-setup $(IOEMU_CONFIGURE_CROSS)
@@ -109,6 +106,7 @@ subdir-clean-ioemu-dir:
subdir-clean-ioemu-dir:
set -e; if test -d ioemu-dir/.; then \
$(absolutify_xen_root); \
+ $(buildmakevars2shellvars); \
$(MAKE) -C ioemu-dir clean; \
fi
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/Linux/block
--- a/tools/hotplug/Linux/block Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/Linux/block Tue Jun 23 17:25:51 2009 +0100
@@ -377,5 +377,5 @@ esac
esac
# If we've reached here, $t is neither phy nor file, so fire a helper script.
-[ -x /etc/xen/scripts/block-"$t" ] && \
- /etc/xen/scripts/block-"$t" "$command" $node
+[ -x ${XEN_SCRIPT_DIR}/block-"$t" ] && \
+ ${XEN_SCRIPT_DIR}/block-"$t" "$command" $node
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/Linux/network-bridge
--- a/tools/hotplug/Linux/network-bridge Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/Linux/network-bridge Tue Jun 23 17:25:51 2009 +0100
@@ -2,7 +2,7 @@
#============================================================================
# Default Xen network start/stop script.
# Xend calls a network script when it starts.
-# The script name to use is defined in /etc/xen/xend-config.sxp
+# The script name to use is defined in ${XEN_CONFIG_DIR}/xend-config.sxp
# in the network-script field.
#
# This script creates a bridge (default ${netdev}), adds a device
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/Linux/network-nat
--- a/tools/hotplug/Linux/network-nat Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/Linux/network-nat Tue Jun 23 17:25:51 2009 +0100
@@ -2,7 +2,7 @@
#============================================================================
# Default Xen network start/stop script when using NAT.
# Xend calls a network script when it starts.
-# The script name to use is defined in /etc/xen/xend-config.sxp
+# The script name to use is defined in ${XEN_CONFIG_DIR}/xend-config.sxp
# in the network-script field.
#
# Usage:
@@ -18,6 +18,7 @@
#============================================================================
dir=$(dirname "$0")
+. "$dir/hotplugpath.sh"
. "$dir/xen-script-common.sh"
. "$dir/xen-network-common.sh"
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/Linux/network-route
--- a/tools/hotplug/Linux/network-route Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/Linux/network-route Tue Jun 23 17:25:51 2009 +0100
@@ -2,7 +2,7 @@
#============================================================================
# Default Xen network start/stop script.
# Xend calls a network script when it starts.
-# The script name to use is defined in /etc/xen/xend-config.sxp
+# The script name to use is defined in ${XEN_CONFIG_DIR}/xend-config.sxp
# in the network-script field.
#
# Usage:
@@ -17,6 +17,7 @@
#============================================================================
dir=$(dirname "$0")
+. "$dir/hotplugpath.sh"
. "$dir/xen-script-common.sh"
evalVariables "$@"
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/Linux/vif-bridge
--- a/tools/hotplug/Linux/vif-bridge Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/Linux/vif-bridge Tue Jun 23 17:25:51 2009 +0100
@@ -1,12 +1,12 @@
#!/bin/bash
#============================================================================
-# /etc/xen/vif-bridge
+# ${XEN_SCRIPT_DIR}/vif-bridge
#
# Script for configuring a vif in bridged mode.
# The hotplugging system will call this script if it is specified either in
# the device configuration given to Xend, or the default Xend configuration
-# in /etc/xen/xend-config.sxp. If the script is specified in neither of those
-# places, then this script is the default.
+# in ${XEN_CONFIG_DIR}/xend-config.sxp. If the script is specified in
+# neither of those places, then this script is the default.
#
# Usage:
# vif-bridge (add|remove|online|offline)
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/Linux/vif-nat
--- a/tools/hotplug/Linux/vif-nat Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/Linux/vif-nat Tue Jun 23 17:25:51 2009 +0100
@@ -1,12 +1,12 @@
#!/bin/bash
#============================================================================
-# /etc/xen/vif-nat
+# ${XEN_SCRIPT_DIR}/vif-nat
#
# Script for configuring a vif in routed-nat mode.
# The hotplugging system will call this script if it is specified either in
# the device configuration given to Xend, or the default Xend configuration
-# in /etc/xen/xend-config.sxp. If the script is specified in neither of those
-# places, then vif-bridge is the default.
+# in ${XEN_CONFIG_DIR}/xend-config.sxp. If the script is specified in
+# neither of those places, then vif-bridge is the default.
#
# Usage:
# vif-nat (add|remove|online|offline)
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/Linux/vif-route
--- a/tools/hotplug/Linux/vif-route Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/Linux/vif-route Tue Jun 23 17:25:51 2009 +0100
@@ -1,12 +1,12 @@
#!/bin/bash
#============================================================================
-# /etc/xen/vif-route
+# ${XEN_SCRIPT_DIR}/vif-route
#
# Script for configuring a vif in routed mode.
# The hotplugging system will call this script if it is specified either in
# the device configuration given to Xend, or the default Xend configuration
-# in /etc/xen/xend-config.sxp. If the script is specified in neither of those
-# places, then vif-bridge is the default.
+# in ${XEN_CONFIG_DIR}/xend-config.sxp. If the script is specified in
+# neither of those places, then vif-bridge is the default.
#
# Usage:
# vif-route (add|remove|online|offline)
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/Linux/xen-hotplug-cleanup
--- a/tools/hotplug/Linux/xen-hotplug-cleanup Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/Linux/xen-hotplug-cleanup Tue Jun 23 17:25:51 2009 +0100
@@ -3,7 +3,7 @@ dir=$(dirname "$0")
dir=$(dirname "$0")
. "$dir/xen-hotplug-common.sh"
-# Claim the lock protecting /etc/xen/scripts/block. This stops a race whereby
+# Claim the lock protecting ${XEN_SCRIPT_DIR}/block. This stops a race whereby
# paths in the store would disappear underneath that script as it attempted to
# read from the store checking for device sharing.
# Any other scripts that do similar things will have to have their lock
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/Linux/xen-hotplug-common.sh
--- a/tools/hotplug/Linux/xen-hotplug-common.sh Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/Linux/xen-hotplug-common.sh Tue Jun 23 17:25:51 2009 +0100
@@ -17,13 +17,14 @@
dir=$(dirname "$0")
+. "$dir/hotplugpath.sh"
. "$dir/logging.sh"
. "$dir/xen-script-common.sh"
. "$dir/locking.sh"
exec 2>>/var/log/xen/xen-hotplug.log
-export PATH="/sbin:/bin:/usr/bin:/usr/sbin:$PATH"
+export
PATH="${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/sbin:/bin:/usr/bin:/usr/sbin:$PATH"
export LANG="POSIX"
unset $(set | grep ^LC_ | cut -d= -f1)
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/NetBSD/block-nbsd
--- a/tools/hotplug/NetBSD/block-nbsd Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/NetBSD/block-nbsd Tue Jun 23 17:25:51 2009 +0100
@@ -4,7 +4,10 @@
# Called by xenbackendd
# Usage: block xsdir_backend_path state
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
+DIR=$(dirname "$0")
+. "${DIR}/hotplugpath.sh"
+
+PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
export PATH
error() {
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/NetBSD/vif-bridge-nbsd
--- a/tools/hotplug/NetBSD/vif-bridge-nbsd Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/NetBSD/vif-bridge-nbsd Tue Jun 23 17:25:51 2009 +0100
@@ -4,7 +4,10 @@
# Called by xenbackendd
# Usage: vif-bridge xsdir_backend_path state
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
+DIR=$(dirname "$0")
+. "${DIR}/hotplugpath.sh"
+
+PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
export PATH
xpath=$1
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/NetBSD/vif-ip-nbsd
--- a/tools/hotplug/NetBSD/vif-ip-nbsd Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/NetBSD/vif-ip-nbsd Tue Jun 23 17:25:51 2009 +0100
@@ -4,7 +4,10 @@
# Called by xenbackendd
# Usage: vif-ip xsdir_backend_path state
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
+DIR=$(dirname "$0")
+. "${DIR}/hotplugpath.sh"
+
+PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
export PATH
xpath=$1
diff -r b7f73a7f3078 -r 415505139333 tools/hotplug/common/Makefile
--- a/tools/hotplug/common/Makefile Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/hotplug/common/Makefile Tue Jun 23 17:25:51 2009 +0100
@@ -1,17 +1,22 @@ XEN_ROOT = ../../../
-XEN_ROOT = ../../../
+XEN_ROOT = ../../..
include $(XEN_ROOT)/tools/Rules.mk
+
+HOTPLUGPATH="hotplugpath.sh"
# OS-independent hotplug scripts go in this directory
-# Xen script dir and scripts to go there.
-XEN_SCRIPTS =
+# Xen scripts to go there.
+XEN_SCRIPTS = $(HOTPLUGPATH)
XEN_SCRIPT_DATA =
+genpath-target = $(call buildmakevars2file,$(HOTPLUGPATH))
+$(eval $(genpath-target))
+
.PHONY: all
-all:
+all: build
.PHONY: build
-build:
+build: genpath
.PHONY: install
install: all install-scripts
@@ -31,3 +36,4 @@ install-scripts:
.PHONY: clean
clean:
+ rm -f $(HOTPLUGPATH)
diff -r b7f73a7f3078 -r 415505139333 tools/python/Makefile
--- a/tools/python/Makefile Tue Jun 23 17:24:14 2009 +0100
+++ b/tools/python/Makefile Tue Jun 23 17:25:51 2009 +0100
@@ -14,20 +14,11 @@ CATALOGS = $(patsubst %,xen/xm/messages/
CATALOGS = $(patsubst %,xen/xm/messages/%.mo,$(LINGUAS))
NLSDIR = $(SHAREDIR)/locale
XENPATH = "xen/util/path.py"
-
-.PHONY: build buildpy genpath
-genpath:
- rm -f $(XENPATH)
- echo "SBINDIR=\"$(SBINDIR)\"" >> $(XENPATH)
- echo "BINDIR=\"$(BINDIR)\"" >> $(XENPATH)
- echo "LIBEXEC=\"$(LIBEXEC)\"" >> $(XENPATH)
- echo "LIBDIR=\"$(LIBDIR)\"" >> $(XENPATH)
- echo "SHAREDIR=\"$(SHAREDIR)\"" >> $(XENPATH)
- echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> $(XENPATH)
- echo "XENFIRMWAREDIR=\"$(XENFIRMWAREDIR)\"" >> $(XENPATH)
- echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> $(XENPATH)
- echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> $(XENPATH)
+genpath-target = $(call buildmakevars2file,$(XENPATH))
+$(eval $(genpath-target))
+
+.PHONY: build buildpy
buildpy: genpath
CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|