]> xenbits.xensource.com Git - people/liuw/stubdom.git/commitdiff
Get rid of hardcoded pathes for stubdom and hotplug scripts
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 23 Jun 2009 16:25:51 +0000 (17:25 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 23 Jun 2009 16:25:51 +0000 (17:25 +0100)
- 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@amd.com>
Makefile
stubdom-dm

index cd7234980d27e537a963355ee6b5f3bbe576c125..cdedf8f2ca07108afd0f8f1313e756831c74be6e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -77,8 +77,12 @@ TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib
 
 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 @@ libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a:: c
 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
 
index 5161e1d0ee7b4dbef2060ba4b0d39c0a70a0bf48..76068a0bd0b2d680507250b36d936e5791b671f9 100644 (file)
@@ -5,6 +5,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 @@ do
 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 "$vncpasswd" && vfb="$vfb, vncpasswd=$vncpasswd"
 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" &