Update both files for disk io limits.
[qemu-dev-zwu.git] / kvm / configure
bloba41ab723b7df643db27afde0addb999bc021024c
1 #!/bin/bash
3 prefix=/usr/local
4 kerneldir=/lib/modules/$(uname -r)/build
5 cc=gcc
6 ld=ld
7 objcopy=objcopy
8 ar=ar
9 want_module=1
10 qemu_cflags=
11 qemu_ldflags=
12 kvm_trace=
13 qemu_opts=()
14 cross_prefix=
15 arch=`uname -m`
16 target_exec=
17 # don't use uname if kerneldir is set
18 no_uname=
19 if [ -z "TMPDIR" ] ; then
20 TMPDIR=.
23 if [ ! -e kernel/Makefile ]; then
24 want_module=
27 usage() {
28 cat <<-EOF
29 Usage: $0 [options]
31 Options include:
32 --arch=ARCH architecture to compile for ($arch)
33 --cross-prefix=PREFIX prefix for cross compile
34 --prefix=PREFIX where to install things ($prefix)
35 --with-patched-kernel don't use external module
36 --with-kvm-trace Enable kvm_trace
37 --kerneldir=DIR kernel build directory ($kerneldir)
38 --qemu-cflags=CFLAGS CFLAGS to add to qemu configuration
39 --qemu-ldflags=LDFLAGS LDFLAGS to add to qemu configuration
41 EOF
42 exit 1
45 while [[ "$1" = -* ]]; do
46 opt="$1"; shift
47 arg=
48 hasarg=
49 if [[ "$opt" = *=* ]]; then
50 arg="${opt#*=}"
51 opt="${opt%%=*}"
52 hasarg=1
54 case "$opt" in
55 --prefix)
56 prefix="$arg"
58 --kerneldir)
59 kerneldir="$arg"
60 no_uname=1
62 --with-patched-kernel)
63 want_module=
65 --with-kvm-trace)
66 kvm_trace=y
68 --qemu-cflags)
69 qemu_cflags="$arg"
71 --qemu-ldflags)
72 qemu_ldflags="$arg"
74 --arch)
75 arch="$arg"
77 --cross-prefix)
78 cross_prefix="$arg"
80 --help)
81 usage
84 qemu_opts=("${qemu_opts[@]}" "$opt${hasarg:+=$arg}")
86 esac
87 done
90 #set kenel directory
91 libkvm_kerneldir=$(readlink -f kernel)
93 case $arch in
94 i?86*|x86_64*)
95 arch=${arch/#i?86/i386}
96 target_exec="x86_64-softmmu"
97 qemu_cflags="$qemu_cflags -DCONFIG_X86"
99 ia64*)
100 target_exec="ia64-softmmu"
102 powerpc*)
103 target_exec="ppcemb-softmmu"
104 qemu_cflags="$qemu_cflags -I $PWD/libfdt"
105 qemu_ldflags="$qemu_ldflags -L $PWD/libfdt"
107 esac
109 processor=${arch#*-}
110 arch=${arch%%-*}
112 #configure kernel module
113 [ -e kernel/Makefile ] && (cd kernel;
114 ./configure \
115 --kerneldir="$kerneldir" \
116 --arch="$arch" \
117 $([ -z ${want_module} ] && echo "--with-patched-kernel") \
118 ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
119 ${kvm_trace:+"--with-kvm-trace"}
122 #configure user dir
123 (cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
124 --arch="$arch" --processor="$processor" \
125 ${cross_prefix:+"--cross-prefix=$cross_prefix"})
129 cat <<EOF > config.mak
130 ARCH=$arch
131 PROCESSOR=$processor
132 PREFIX=$prefix
133 KERNELDIR=$kerneldir
134 KERNELSOURCEDIR=$kernelsourcedir
135 LIBKVM_KERNELDIR=$libkvm_kerneldir
136 WANT_MODULE=$want_module
137 CROSS_COMPILE=$cross_prefix
138 CC=$cross_prefix$cc
139 LD=$cross_prefix$ld
140 OBJCOPY=$cross_prefix$objcopy
141 AR=$cross_prefix$ar