This new patch removes gcc 3.x checks, as well as adds environment variables $CFLAGS & $LDFLAGS to include libs to qemu for cross compile. I was going to add this in another patch. But they should probably go in now. So an example for power is to include zlib so before running configure you do: export LDFLAGS="-L/home/public/zlib-ppc/lib" export CFLAGS="-I/home/public/zlib-ppc/include"
Signed-on-by: Jerone Young <[EMAIL PROTECTED]> diff -r ff2feafadcac configure --- a/configure Fri Oct 12 07:35:25 2007 -0500 +++ b/configure Mon Oct 15 21:52:51 2007 -0500 @@ -3,32 +3,29 @@ 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) +cc=gcc 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 compiler --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 compiler for qemu (needs to be gcc 3.x) + Not valid if used with --cross-prefix --disable-gcc-check don't insist on gcc-3.x - - this will break running without kvm + CAUTION: using this option may break build 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 @@ -48,11 +45,17 @@ while [[ "$1" = -* ]]; do want_module= ;; --qemu-cc) - qemu_cc="$arg" + cc="$arg" ;; --disable-gcc-check) disable_gcc_check=1 ;; + --arch) + arch="$arg" + ;; + --cross-prefix) + cross_prefix="$arg" + ;; --help) usage ;; @@ -62,39 +65,54 @@ 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" \ +#see if using a cross compiler or not +qemu_opts= +user_opts= +if [[ -z $cross_prefix ]]; then + qemu_opts+=" --cc=$cc" + user_opts+=" --cc=$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 + target_exec="x86_64-softmmu" + qemu_opts+=" --enable-alsa" +fi + +qemudir=`pwd`/qemu + +#configure user dir +(cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \ + $user_opts --arch="$arch") +(cd qemu; ./configure --target-list=$target_exec \ + --disable-kqemu --extra-cflags="-I $PWD/../user $CFLAGS" \ + --extra-ldflags="-L $PWD/../user $LDFLAGS" \ --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$cc EOF - On Mon, 2007-10-15 at 15:51 -0500, Anthony Liguori wrote: > Jerone Young wrote: > > On Mon, 2007-10-15 at 15:13 -0500, Anthony Liguori wrote: > > > >> Jerone Young wrote: > >> > >>> This patch is an improved version of patches sent last week to enable > >>> the top level configuration file for cross compile. This currently > >>> allows x86 & x86-64 to cross compile. But will soon be sending patches > >>> for powerpc embedded once this is accepted. This patches to latest git > >>> and is in git format ;-) > >>> > >>> Signed-off-by: Jerone Young <[EMAIL PROTECTED]> > >>> > >>> ------------------------------------------------------------------------ > >>> > >> Why are you only passing --enable-alsa only x86? > >> > > > > Because for our powerpc stuff we actually want different options. ALSA > > is not a dependency we want. > > > > Well, you don't want the dependency, but does that mean noone will ever > want the dependency on anything but x86? > > I'm curious why --enable-alsa is here in the first place. QEMU will use > SDL audio by default. Perhaps Avi can shed light on why added in the > first place? > > Regards, > > Anthony Liguori > > > >>> +fi > >>> + > >>> +qemudir=`pwd`/qemu > >>> + > >>> +#configure user dir > >>> +(cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" > >>> \ > >>> + $user_opts --arch="$arch") > >>> +(cd qemu; ./configure --target-list=$target_exec \ > >>> --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" > >>> > >>> > >> I don't think this is right. You're using two different --cpu options > >> for i386 and x86_64. There really shouldn't be a --cpu option at all > >> for x86. > >> > > > > So the --cpu option is actually a hidden option in qemu & is not on the > > qemu help page .. who know why it isn't but the it's in the code. > > > > It makes since though that if you are going to specify cross-prefix= > > then there is little reason to specify the cpu on the qemu line. As it > > should detect everything from cross compiler. > > > > I'll test this out and send a new patch with the 2 changes. > > > > > >> Regards, > >> > >> Anthony Liguori > >> > >> > >>> ) > >>> > >>> > >>> - > >>> cat <<EOF > config.mak > >>> +ARCH=$arch > >>> PREFIX=$prefix > >>> KERNELDIR=$kerneldir > >>> WANT_MODULE=$want_module > >>> +CC=$cross_prefix$cc > >>> 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@lists.sourceforge.net > >>> 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/ > >> _______________________________________________ > >> kvm-devel mailing list > >> kvm-devel@lists.sourceforge.net > >> 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/ > _______________________________________________ > kvm-devel mailing list > kvm-devel@lists.sourceforge.net > 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/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel