All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: [PATCH 1/5] Enable top level configure script for cross compile
Date: Mon, 08 Oct 2007 00:10:05 -0500	[thread overview]
Message-ID: <1191820205.8106.25.camel@laptop> (raw)

[-- Attachment #1: Type: text/plain, Size: 156 bytes --]

This patch adds cross compile capability to the top level configure
script.

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>


[-- Attachment #2: enable_cross_comp_main_configure_script --]
[-- Type: text/x-patch, Size: 2753 bytes --]

diff -r f48e521e0add configure
--- a/configure	Wed Oct 03 21:00:03 2007 -0500
+++ b/configure	Thu Oct 04 14:59:16 2007 -0500
@@ -5,13 +5,17 @@ want_module=1
 want_module=1
 qemu_cc=$(ls /usr/bin/gcc3* /usr/bin/gcc-3* 2>/dev/null | tail -n1)
 disable_gcc_check=
+cross_prefix=
+arch=`uname -m`
+target_cpu=
 
 usage() {
     cat <<-EOF
 	Usage: $0 [options]
 
 	Options include:
-
+	    --arch=ARCH            architecture to compile for ($arch)
+	    --cross-prefix=PREFIX  prefix for cross compiler
 	    --prefix=PREFIX        where to install things ($prefix)
 	    --with-patched-kernel  don't use external module
 	    --kerneldir=DIR        kernel build directory ($kerneldir)
@@ -53,6 +57,15 @@ while [[ "$1" = -* ]]; do
 	--disable-gcc-check)
 	    disable_gcc_check=1
 	    ;;
+	--arch)
+	    arch="$arg"
+	    ;;
+	--cross-prefix)
+	    cross_prefix="$arg"
+            ;;
+	--target-cpu)
+	    target_cpu="$arg"
+	    ;; 
 	--help)
 	    usage
 	    ;;
@@ -62,7 +75,7 @@ while [[ "$1" = -* ]]; do
     esac
 done
 
-if [[ -z "$qemu_cc" ]]; then
+if [[ -z "$qemu_cc" ]] && [[ -z "$cross_prefix" ]]; then
     echo "$0: cannot locate gcc 3.x. please install it or specify with --qemu-cc"
     exit 1
 fi
@@ -72,29 +85,48 @@ if (( want_module )); then
     libkvm_kerneldir=$(readlink -f kernel)
 fi
 
-target_cpu() {
-    if [[ $(uname -m) = i?86 ]]; then
-	echo x86_64
-    else
-	uname -m
+#if arch is an x86 arch set to i386
+if [[ $arch = i?86 ]]; then
+  arch="i386"
+fi
+
+#see if using a cross compiler or not
+compiler=
+qemu_opts=
+user_opts=
+if [[ -z $cross_prefix ]]; then
+    qemu_opts+=" --cc=$qemu_cc"
+    user_opts+=" --cc=$qemu_cc"
+else
+    qemu_opts+=" --cross-prefix=$cross_prefix"
+    user_opts+=" --cross-prefix=$cross_prefix"
+fi
+
+#set parameters compiling
+if [ "$arch" = "i386" -o "$arch" = "x86_64" ]; then
+    if [[ -z $target_cpu ]]; then
+        target_cpu="x86_64"
     fi
-}
+    qemu_opts+=" --enable-alsa"
+fi
 
-(cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir")
-(cd qemu; ./configure --target-list=$(target_cpu)-softmmu --cc="$qemu_cc" \
+#configure user dir
+(cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
+          $user_opts --arch="$arch")
+(cd qemu; ./configure --target-list=$target_cpu-softmmu \
     --disable-kqemu --extra-cflags="-I $PWD/../user" \
     --extra-ldflags="-L $PWD/../user" \
     --enable-kvm --kernel-path="$libkvm_kerneldir" \
-    --enable-alsa \
     ${disable_gcc_check:+"--disable-gcc-check"} \
-    --prefix="$prefix"
+    --prefix="$prefix" \
+    $qemu_opts --cpu="$arch"
 )
 
 
-
 cat <<EOF > config.mak
+ARCH=$arch
 PREFIX=$prefix
 KERNELDIR=$kerneldir
 WANT_MODULE=$want_module
+CC=$cross_prefix$qemu_cc
 EOF
-

[-- Attachment #3: Type: text/plain, Size: 314 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

             reply	other threads:[~2007-10-08  5:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08  5:10 Jerone Young [this message]
2007-10-08  7:49 ` [PATCH 1/5] Enable top level configure script for cross compile Christian Ehrhardt
     [not found]   ` <4709E0ED.7010709-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-10-08  8:26     ` Jerone Young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1191820205.8106.25.camel@laptop \
    --to=jyoung5-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.