Travis Betak
2006-Sep-01 21:04 UTC
[Xen-devel] [PATCH] Clean up unmodified_drivers mkbuildtree script
The current mkbuildtree script uses `uname -m` when linking the
directories from the xen-sparse directory to unmodified_drivers. This
doesn''t work out well if you are building 32-bit modules on a 64-bit
system.
This patch makes the architecture to be linked against a command line
option -- currently i386 or x86_64. It also cleans up the indentation a
bit.
Any comments? Better ideas?
Signed-off-by: Travis Betak <travis.betak@amd.com>
---
diff -r 3e6325b73474 unmodified_drivers/linux-2.6/mkbuildtree
--- a/unmodified_drivers/linux-2.6/mkbuildtree Fri Sep 01 16:11:51 2006 +0100
+++ b/unmodified_drivers/linux-2.6/mkbuildtree Fri Sep 01 16:02:29 2006 -0500
@@ -1,4 +1,15 @@
#! /bin/sh
+
+usage()
+{
+ echo "Usage: mkbuildtree <arch>"
+ echo "supported architectures are i386 and x86_64"
+ exit 1
+}
+
+if [ ! $1 ] ; then
+ usage;
+fi
C=$PWD
@@ -26,24 +37,22 @@ ln -sf ${XEN}/include/public include/xen
# 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).
-uname=`uname -m`
-case "$uname"
+case "$1"
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-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-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-i386 include/asm-i386
+ ;;
+i386)
+ 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
+ ;;
*)
- echo unknown architecture $uname
- exit 1
- ;;
+ usage;
+ ;;
esac
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Keir Fraser
2006-Sep-02 14:48 UTC
Re: [Xen-devel] [PATCH] Clean up unmodified_drivers mkbuildtree script
On 1/9/06 10:04 pm, "Travis Betak" <travis.betak@amd.com> wrote:> The current mkbuildtree script uses `uname -m` when linking the > directories from the xen-sparse directory to unmodified_drivers. This > doesn''t work out well if you are building 32-bit modules on a 64-bit > system. > > This patch makes the architecture to be linked against a command line > option -- currently i386 or x86_64. It also cleans up the indentation a > bit. > > Any comments? Better ideas?Default to `uname -m` if no argument is provided to the script, and print a message to explain that this is what you are doing. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2006-Sep-04 07:37 UTC
Re: [Xen-devel] [PATCH] Clean up unmodified_drivers mkbuildtree script
On Fri, 2006-09-01 at 16:04 -0500, Travis Betak wrote:> The current mkbuildtree script uses `uname -m` when linking the > directories from the xen-sparse directory to unmodified_drivers. This > doesn''t work out well if you are building 32-bit modules on a 64-bit > system. > > This patch makes the architecture to be linked against a command line > option -- currently i386 or x86_64. It also cleans up the indentation a > bit. > > Any comments? Better ideas?You could copy headers for all architectures to asm-$ARCH and have asm be a symlink created at build time based on $ARCH, similar to how the asm symlink in Linux is handled. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Travis Betak
2006-Sep-05 18:37 UTC
Re: [Xen-devel] [PATCH] Clean up unmodified_drivers mkbuildtree script
On Sat, 2 Sep 2006, Keir Fraser wrote:> > On 1/9/06 10:04 pm, "Travis Betak" <travis.betak@amd.com> wrote: > >> The current mkbuildtree script uses `uname -m` when linking the >> directories from the xen-sparse directory to unmodified_drivers. This >> doesn''t work out well if you are building 32-bit modules on a 64-bit >> system. >> >> This patch makes the architecture to be linked against a command line >> option -- currently i386 or x86_64. It also cleans up the indentation a >> bit. >> >> Any comments? Better ideas? > > Default to `uname -m` if no argument is provided to the script, and print a > message to explain that this is what you are doing.Keir, Here''s an updated patch that now includes your suggestion for defaulting to `uname -m` when no argument is passed to the script along with a statement about defaulting. Signed-off-by: Travis Betak <travis.betak@amd.com> --- diff -r 2d8d6ce64454 unmodified_drivers/linux-2.6/mkbuildtree --- a/unmodified_drivers/linux-2.6/mkbuildtree Tue Sep 05 06:14:31 2006 -0700 +++ b/unmodified_drivers/linux-2.6/mkbuildtree Tue Sep 05 13:36:16 2006 -0500 @@ -1,4 +1,12 @@ #! /bin/sh + +if [ $1 ]; then + uname="$1" +else + uname=`uname -m` + echo "Defaulting to this machine''s architecture, $uname, for linking." + echo "This may be overridden with a command line argument (i386 or x86_64)." +fi C=$PWD @@ -26,24 +34,23 @@ ln -sf ${XEN}/include/public include/xen # 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). -uname=`uname -m` 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-i386 include/asm-i386 - ;; + 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-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/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 + ;; *) - echo unknown architecture $uname - exit 1 - ;; + echo "unknown architecture $uname, only i386 and x86_64 are supported" + exit 1 + ;; esac _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel