kvm: qemu: stop vga dirty logging while munging mappings
[kvm-userspace.git] / configure
blob63f956c670c37b43369ee11de7d705e951085640
1 #!/bin/bash
3 prefix=/usr/local
4 kernelsourcedir=
5 kerneldir=/lib/modules/$(uname -r)/build
6 cc=gcc
7 ld=ld
8 objcopy=objcopy
9 ar=ar
10 want_module=1
11 qemu_cflags=
12 qemu_ldflags=
13 kvm_trace=
14 qemu_opts=()
15 cross_prefix=
16 arch=`uname -m`
17 target_exec=
19 usage() {
20 cat <<-EOF
21 Usage: $0 [options]
23 Options include:
24 --arch=ARCH architecture to compile for ($arch)
25 --cross-prefix=PREFIX prefix for cross compile
26 --prefix=PREFIX where to install things ($prefix)
27 --with-patched-kernel don't use external module
28 --with-kvm-trace Enable kvm_trace
29 --kerneldir=DIR kernel build directory ($kerneldir)
30 --qemu-cflags=CFLAGS CFLAGS to add to qemu configuration
31 --qemu-ldflags=LDFLAGS LDFLAGS to add to qemu configuration
33 Any additional option is given to qemu's configure verbatim; including:
35 EOF
36 cd qemu
37 ./configure --help | egrep "enable-|disable-" \
38 | grep -v user | grep -v system | grep -v kqemu | grep -v kvm \
39 | sed -e "s/^ / /g" \
40 | sed -e"s/ enable/enable/g" | sed -e "s/ disable/disable/g"
41 exit 1
44 while [[ "$1" = -* ]]; do
45 opt="$1"; shift
46 arg=
47 hasarg=
48 if [[ "$opt" = *=* ]]; then
49 arg="${opt#*=}"
50 opt="${opt%%=*}"
51 hasarg=1
53 case "$opt" in
54 --prefix)
55 prefix="$arg"
57 --kerneldir)
58 kerneldir="$arg"
60 --with-patched-kernel)
61 want_module=
63 --with-kvm-trace)
64 kvm_trace=y
66 --qemu-cflags)
67 qemu_cflags="$arg"
69 --qemu-ldflags)
70 qemu_ldflags="$arg"
72 --arch)
73 arch="$arg"
75 --cross-prefix)
76 cross_prefix="$arg"
78 --help)
79 usage
82 qemu_opts=("${qemu_opts[@]}" "$opt${hasarg:+=$arg}")
84 esac
85 done
88 #set kenel directory
89 libkvm_kerneldir=$(readlink -f kernel)
91 case $arch in
92 i?86*|x86_64*)
93 arch=${arch/#i?86/i386}
94 target_exec="x86_64-softmmu"
95 qemu_cflags="$qemu_cflags -DCONFIG_X86"
97 ia64*)
98 target_exec="ia64-softmmu"
100 powerpc*)
101 target_exec="ppcemb-softmmu"
102 qemu_cflags="$qemu_cflags -I $PWD/libfdt"
103 qemu_ldflags="$qemu_ldflags -L $PWD/libfdt"
105 esac
107 processor=${arch#*-}
108 arch=${arch%%-*}
110 # see if we have split build and source directories
111 if [ -d "$kerneldir/include2" ]; then
112 kernelsourcedir=${kerneldir%/*}/source
115 #configure user dir
116 (cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
117 --arch="$arch" --processor="$processor" \
118 ${cross_prefix:+"--cross-prefix=$cross_prefix"})
120 #configure qemu
121 (cd qemu; ./configure --target-list=$target_exec \
122 --disable-kqemu \
123 --disable-gcc-check \
124 --extra-cflags="-I $PWD/../libkvm $qemu_cflags" \
125 --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \
126 --kerneldir="$libkvm_kerneldir" \
127 --prefix="$prefix" \
128 ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
129 ${cross_prefix:+"--cpu=$arch"} "${qemu_opts[@]}"
130 ) || usage
133 cat <<EOF > config.mak
134 ARCH=$arch
135 PROCESSOR=$processor
136 PREFIX=$prefix
137 KERNELDIR=$kerneldir
138 KERNELSOURCEDIR=$kernelsourcedir
139 LIBKVM_KERNELDIR=$libkvm_kerneldir
140 WANT_MODULE=$want_module
141 CROSS_COMPILE=$cross_prefix
142 CC=$cross_prefix$cc
143 LD=$cross_prefix$ld
144 OBJCOPY=$cross_prefix$objcopy
145 AR=$cross_prefix$ar
148 cat <<EOF > kernel/config.kbuild
149 EXT_CONFIG_KVM_TRACE=$kvm_trace