Skip to contentSkip to conversation

fix/adjust pv driver's mkbuildtree

PATCH New Jan Beulich 1 participant 1 message Jan 18, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix/adjust pv driver's mkbuildtree

Allow invoking the script from other than the current directory (the script now infers the tree is where the script lives). Print which trees are actually being used.

Fix the linking of sources from Linux tree's drivers/xen/ - this was needlessly invoking lndir on various sub-directories, in some cases even twice.

Adjust the script to be able to deal with Linux 2.6.24's unified x86 include directory.

unmodified_drivers/linux-2.6/mkbuildtree +32 -27
Index: 2008-01-07/unmodified_drivers/linux-2.6/mkbuildtree
===================================================================
@@ -8,27 +8,28 @@ else
     echo "This may be overridden on the command line (i386,x86_64,ia64)."
 fi
 
-C=$PWD
+C=$(cd $(dirname $0) && pwd)
+R=${C%/*/*}
 
 if [ -n "$XEN" -a -d "$XEN" ]; then
   XEN=$(cd $XEN && pwd)
 else
-  XEN=$C/../../xen
+  XEN=$R/xen
 fi
+echo "Xen tree: $XEN"
 
 if [ -n "$XL" -a -d "$XL" ]; then
   XL=$(cd $XL && pwd)
 else
-  XL=$C/../../linux-2.6.18-xen.hg
+  XL=$R/linux-2.6.18-xen.hg
 fi
+echo "Linux tree: $XL"
 
-for d in $(find ${XL}/drivers/xen/ -maxdepth 1 -type d | sed -e 1d); do
-    if ! echo $d | egrep -q back; then
-        lndir $d $(basename $d) > /dev/null 2>&1
-    fi
-    if ! echo $d | egrep -q ball; then
-        lndir $d $(basename $d) > /dev/null 2>&1
-    fi
+cd $C
+
+for d in $(find ${XL}/drivers/xen/ -mindepth 1 -maxdepth 1 -type d); do
+    test -d $(basename $d) || continue
+    lndir $d $(basename $d) > /dev/null 2>&1
 done
 
 ln -sf ${XL}/drivers/xen/core/gnttab.c platform-pci
@@ -44,23 +45,27 @@ ln -nsf ${XEN}/include/public include/xe
 # Need to be quite careful here: we don't want the files we link in to
 # risk overriding the native Linux ones (in particular, system.h must
 # be native and not xenolinux).
-case "$uname"
-in
-"x86_64")
-    ln -sf ${XL}/include/asm-x86_64/mach-xen/asm/hypervisor.h include/asm
-    ln -sf ${XL}/include/asm-x86_64/mach-xen/asm/hypercall.h include/asm
-    ln -sf ${XL}/include/asm-x86_64/mach-xen/asm/synch_bitops.h include/asm
-    ln -sf ${XL}/include/asm-x86_64/mach-xen/asm/maddr.h include/asm
-    ln -sf ${XL}/include/asm-x86_64/mach-xen/asm/gnttab_dma.h include/asm
-    mkdir -p include/asm-i386
-    lndir -silent ${XL}/include/asm-i386 include/asm-i386
-  ;;
-i[34567]86)
-    ln -sf ${XL}/include/asm-i386/mach-xen/asm/hypervisor.h include/asm
-    ln -sf ${XL}/include/asm-i386/mach-xen/asm/hypercall.h include/asm
-    ln -sf ${XL}/include/asm-i386/mach-xen/asm/synch_bitops.h include/asm
-    ln -sf ${XL}/include/asm-i386/mach-xen/asm/maddr.h include/asm
-    ln -sf ${XL}/include/asm-i386/mach-xen/asm/gnttab_dma.h include/asm
+case "$uname" in
+i[34567]86|x86_64)
+    if [ -d ${XL}/include/asm-x86 ]; then
+        ln -sf ${XL}/include/asm-x86/mach-xen/asm/hypervisor.h include/asm
+        ln -sf ${XL}/include/asm-x86/mach-xen/asm/hypercall*.h include/asm
+        ln -sf ${XL}/include/asm-x86/mach-xen/asm/synch_bitops*.h include/asm
+        ln -sf ${XL}/include/asm-x86/mach-xen/asm/maddr*.h include/asm
+        ln -sf ${XL}/include/asm-x86/mach-xen/asm/gnttab_dma.h include/asm
+    else
+        if [ $uname = x86_64 ]; then
+            mkdir -p include/asm-i386
+            lndir -silent ${XL}/include/asm-i386 include/asm-i386
+        else
+            uname=i386
+        fi
+        ln -sf ${XL}/include/asm-$uname/mach-xen/asm/hypervisor.h include/asm
+        ln -sf ${XL}/include/asm-$uname/mach-xen/asm/hypercall.h include/asm
+        ln -sf ${XL}/include/asm-$uname/mach-xen/asm/synch_bitops.h include/asm
+        ln -sf ${XL}/include/asm-$uname/mach-xen/asm/maddr.h include/asm
+        ln -sf ${XL}/include/asm-$uname/mach-xen/asm/gnttab_dma.h include/asm
+    fi
   ;;
 "ia64")
     ln -sf ${XL}/include/asm-ia64/hypervisor.h include/asm