kvm: qemu: add PPC 440EP bamboo board device tree source & binary into qemu
[kvm-userspace.git] / configure
blob8b5004c2843d48f062c0d9e10d022e57244022f1
1 #!/bin/bash
3 prefix=/usr/local
4 kerneldir=/lib/modules/$(uname -r)/build
5 want_module=1
6 qemu_cc=
7 qemu_cflags=
8 qemu_ldflags=
9 qemu_opts=
10 cross_prefix=
11 arch=`uname -m`
12 target_exec=
14 usage() {
15 cat <<-EOF
16 Usage: $0 [options]
18 Options include:
19 --arch=ARCH architecture to compile for ($arch)
20 --cross-prefix=PREFIX prefix for cross compile
21 --prefix=PREFIX where to install things ($prefix)
22 --with-patched-kernel don't use external module
23 --kerneldir=DIR kernel build directory ($kerneldir)
24 --qemu-cc=CC specify compiler for qemu (must be gcc-3.x)
25 --qemu-cflags=CFLAGS CFLAGS to add to qemu configuration
26 --qemu-ldflags=LDFLAGS LDFLAGS to add to qemu configuration
28 Any additional option is given to qemu's configure verbatim; including:
30 --disable-gcc-check don't insist on gcc-3.x
31 CAUTION: this will break running without kvm
32 EOF
33 cd qemu
34 ./configure --help | egrep "enable-|disable-" \
35 | grep -v user | grep -v system | grep -v kqemu | grep -v kvm \
36 | sed -e "s/^ / /g" \
37 | sed -e"s/ enable/enable/g" | sed -e "s/ disable/disable/g"
38 exit 1
41 while [[ "$1" = -* ]]; do
42 opt="$1"; shift
43 arg=
44 if [[ "$opt" = *=* ]]; then
45 arg="${opt#*=}"
46 opt="${opt%%=*}"
48 case "$opt" in
49 --prefix)
50 prefix="$arg"
52 --kerneldir)
53 kerneldir="$arg"
55 --with-patched-kernel)
56 want_module=
58 --qemu-cc)
59 qemu_cc="$arg"
61 --qemu-cflags)
62 qemu_cflags="$arg"
64 --qemu-ldflags)
65 qemu_ldflags="$arg"
67 --arch)
68 arch="$arg"
70 --cross-prefix)
71 cross_prefix="$arg"
73 --help)
74 usage
77 qemu_opts="$qemu_opts $opt"
79 esac
80 done
83 #set kenel directory
84 libkvm_kerneldir="$kerneldir"
85 if (( want_module )); then
86 libkvm_kerneldir=$(readlink -f kernel)
89 #if arch is an x86 arch set to i386
90 if [[ $arch = i?86 ]]; then
91 arch="i386"
94 #set parameters compiling
95 if [ "$arch" = "i386" -o "$arch" = "x86_64" ]; then
96 target_exec="x86_64-softmmu"
97 qemu_cflags="$qemu_cflags -DCONFIG_X86"
100 if [ "$arch" = "ia64" ]; then
101 target_exec="ia64-softmmu"
104 if [ "$arch" = "powerpc" ]; then
105 target_exec="ppcemb-softmmu"
106 qemu_cflags="$qemu_cflags -I $PWD/libfdt"
107 qemu_ldflags="$qemu_ldflags -L $PWD/libfdt"
110 #configure user dir
111 (cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
112 --arch="$arch" \
113 ${cross_prefix:+"--cross-prefix=$cross_prefix"})
115 #configure qemu
116 (cd qemu; ./configure --target-list=$target_exec \
117 --disable-kqemu \
118 --extra-cflags="-I $PWD/../libkvm $qemu_cflags" \
119 --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \
120 --kernel-path="$libkvm_kerneldir" \
121 --prefix="$prefix" \
122 ${qemu_cc:+"--cc=$qemu_cc"} \
123 ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
124 ${cross_prefix:+"--cpu=$arch"} $qemu_opts
125 ) || usage
128 cat <<EOF > config.mak
129 ARCH=$arch
130 PREFIX=$prefix
131 KERNELDIR=$kerneldir
132 WANT_MODULE=$want_module
133 CROSS_COMPILE=$cross_prefix