From: Anthony Liguori <anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
To: jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [PATCH] [v5] Add cross compile top level configure script
Date: Tue, 16 Oct 2007 16:15:10 -0500 [thread overview]
Message-ID: <471529DE.9070101@codemonkey.ws> (raw)
In-Reply-To: <1192568610.6079.40.camel@thinkpad>
Jerone Young wrote:
> This patch takes feedback from Anthony Liguouri.
> - remove --cc option added in v4 of patch (keep old behavior)
> - do not specify cc= everytime on the qemu configuration line, this
> allows qemu to autodetect gcc 3.x
>
> This simplifies the patch more. While preserving behavior.
>
This one looks a lot better to me.
Thanks,
Anthony Liguori
> Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>
> diff --git a/configure b/configure
> --- a/configure
> +++ b/configure
> @@ -3,32 +3,32 @@ prefix=/usr/local
> prefix=/usr/local
> kerneldir=/lib/modules/$(uname -r)/build
> want_module=1
> -qemu_cc=$(ls /usr/bin/gcc3* /usr/bin/gcc-3* 2>/dev/null | tail -n1)
> +qemu_cc=
> +qemu_cflags=
> +qemu_ldflags=
> disable_gcc_check=
> +cross_prefix=
> +arch=`uname -m`
> +target_exec=
>
> usage() {
> cat <<-EOF
> Usage: $0 [options]
>
> Options include:
> -
> + --arch=ARCH architecture to compile for ($arch)
> + --cross-prefix=PREFIX prefix for cross compile
> --prefix=PREFIX where to install things ($prefix)
> --with-patched-kernel don't use external module
> --kerneldir=DIR kernel build directory ($kerneldir)
> - --qemu-cc="$qemu_cc" compiler for qemu (needs gcc3.x) ($qemu_cc)
> + --qemu-cc=CC specify compiler for qemu (must be gcc-3.x)
> + --qemu-cflags=CFLAGS CFLAGS to add to qemu configuration
> + --qemu-ldflags=LDFLAGS LDFLAGS to add to qemu configuration
> --disable-gcc-check don't insist on gcc-3.x
> - - this will break running without kvm
> + CAUTION: this will break running without kvm
> EOF
> exit 1
> }
> -
> -
> -# prefer gcc if its version is 3.* ( over a compat-gcc )
> -# do it before parsing command line arguments to enable the user
> -# to specify a specific gcc he/she likes.
> -if gcc -v 2>&1 | grep -q 'gcc *version *3\.[2-4]\.[0-9]'; then
> - qemu_cc=gcc
> -fi
>
> while [[ "$1" = -* ]]; do
> opt="$1"; shift
> @@ -50,9 +50,21 @@ while [[ "$1" = -* ]]; do
> --qemu-cc)
> qemu_cc="$arg"
> ;;
> + --qemu-cflags)
> + qemu_cflags="$arg"
> + ;;
> + --qemu-ldflags)
> + qemu_ldflags="$arg"
> + ;;
> --disable-gcc-check)
> disable_gcc_check=1
> ;;
> + --arch)
> + arch="$arg"
> + ;;
> + --cross-prefix)
> + cross_prefix="$arg"
> + ;;
> --help)
> usage
> ;;
> @@ -62,39 +74,47 @@ while [[ "$1" = -* ]]; do
> esac
> done
>
> -if [[ -z "$qemu_cc" ]]; then
> - echo "$0: cannot locate gcc 3.x. please install it or specify with --qemu-cc"
> - exit 1
> -fi
>
> +#set kenel directory
> libkvm_kerneldir="$kerneldir"
> if (( want_module )); then
> libkvm_kerneldir=$(readlink -f kernel)
> fi
>
> -target_cpu() {
> - if [[ $(uname -m) = i?86 ]]; then
> - echo x86_64
> - else
> - uname -m
> - fi
> -}
> +#if arch is an x86 arch set to i386
> +if [[ $arch = i?86 ]]; then
> + arch="i386"
> +fi
>
> -(cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir")
> -(cd qemu; ./configure --target-list=$(target_cpu)-softmmu --cc="$qemu_cc" \
> - --disable-kqemu --extra-cflags="-I $PWD/../user" \
> - --extra-ldflags="-L $PWD/../user" \
> +#set parameters compiling
> +qemu_opts=
> +if [ "$arch" = "i386" -o "$arch" = "x86_64" ]; then
> + target_exec="x86_64-softmmu"
> + qemu_opts+=" --enable-alsa"
> +fi
> +
> +#configure user dir
> +(cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
> + --arch="$arch" \
> + ${cross_prefix:+"--cross-prefix=$cross_prefix"})
> +
> +#configure qemu
> +(cd qemu; ./configure --target-list=$target_exec \
> + --disable-kqemu --extra-cflags="-I $PWD/../user $qemu_cflags" \
> + --extra-ldflags="-L $PWD/../user $qemu_ldflags" \
> --enable-kvm --kernel-path="$libkvm_kerneldir" \
> - --enable-alsa \
> ${disable_gcc_check:+"--disable-gcc-check"} \
> - --prefix="$prefix"
> + --prefix="$prefix" \
> + ${qemu_cc:+"--cc=$qemu_cc"} \
> + ${cross_prefix:+"--cross-prefix=$cross_prefix --cpu=$arch"} \
> + $qemu_opts
> )
>
>
> -
> cat <<EOF > config.mak
> +ARCH=$arch
> PREFIX=$prefix
> KERNELDIR=$kerneldir
> WANT_MODULE=$want_module
> +CROSS_COMPILE=$cross_prefix
> EOF
> -
>
>
>
> -------------------------------------------------------------------------
> 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/
> _______________________________________________
> kvm-devel mailing list
> kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>
>
-------------------------------------------------------------------------
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/
next prev parent reply other threads:[~2007-10-16 21:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-16 21:03 [PATCH] [v5] Add cross compile top level configure script Jerone Young
2007-10-16 21:15 ` Anthony Liguori [this message]
2007-10-17 15:54 ` Avi Kivity
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=471529DE.9070101@codemonkey.ws \
--to=anthony-rdkfgonbjusknkdkm+me6a@public.gmane.org \
--cc=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.