kvm: qemu: fix option_rom_setup_reset address
[kvm-userspace.git] / kernel / configure
blob3e5633822080cf3c597e9af7de515e3ea245b42a
1 #!/bin/bash
3 kernelsourcedir=
4 kerneldir=/lib/modules/$(uname -r)/build
5 cc=gcc
6 ld=ld
7 objcopy=objcopy
8 ar=ar
9 want_module=1
10 kvm_trace=
11 cross_prefix=
12 arch=`uname -m`
13 # don't use uname if kerneldir is set
14 no_uname=
15 # we only need depmod_version for kvm.ko install
16 depmod_version=
17 if [ -z "TMPDIR" ] ; then
18 TMPDIR=.
21 usage() {
22 cat <<-EOF
23 Usage: $0 [options]
25 Options include:
26 --arch=ARCH architecture to compile for ($arch)
27 --cross-prefix=PREFIX prefix for cross compile
28 --with-kvm-trace Enable kvm_trace
29 --kerneldir=DIR kernel build directory ($kerneldir)
30 --help this helpful text
31 EOF
32 exit 1
35 while [[ "$1" = -* ]]; do
36 opt="$1"; shift
37 arg=
38 hasarg=
39 if [[ "$opt" = *=* ]]; then
40 arg="${opt#*=}"
41 opt="${opt%%=*}"
42 hasarg=1
44 case "$opt" in
45 --kerneldir)
46 kerneldir="$arg"
47 no_uname=1
49 --with-patched-kernel)
50 want_module=
52 --with-kvm-trace)
53 kvm_trace=y
55 --arch)
56 arch="$arg"
58 --cross-prefix)
59 cross_prefix="$arg"
61 --help)
62 usage
65 usage
67 esac
68 done
70 karch="$arch"
72 case $arch in
73 i?86*|x86_64*)
74 arch=${arch/#i?86/i386}
75 karch="x86"
77 esac
79 processor=${arch#*-}
80 arch=${arch%%-*}
82 # see if we have split build and source directories
83 if [ -d "$kerneldir/include2" ]; then
84 kernelsourcedir=${kerneldir%/*}/source
87 if [ -n "$no_uname" -a "$want_module" ]; then
88 if [ -e "$kerneldir/.kernelrelease" ]; then
89 depmod_version=`cat "$kerneldir/.kernelrelease"`
91 elif [ -e "$kerneldir/include/config/kernel.release" ]; then
92 depmod_version=`cat "$kerneldir/include/config/kernel.release"`
93 elif [ -e "$kerneldir/.config" ]; then
94 depmod_version=$(awk '/Linux kernel version:/ { print $NF }' \
95 "$kerneldir/.config")
96 else
97 echo
98 echo "Error: kernelversion not found"
99 echo "Please make sure your kernel is configured"
100 echo
101 exit 1
105 rm -f include/asm include-compat/asm
106 ln -sf asm-"$karch" include/asm
107 ln -sf asm-"$karch" include-compat/asm
109 cat <<EOF > config.mak
110 ARCH=$arch
111 PROCESSOR=$processor
112 PREFIX=$prefix
113 KERNELDIR=$kerneldir
114 KERNELSOURCEDIR=$kernelsourcedir
115 CROSS_COMPILE=$cross_prefix
116 CC=$cross_prefix$cc
117 LD=$cross_prefix$ld
118 OBJCOPY=$cross_prefix$objcopy
119 AR=$cross_prefix$ar
120 DEPMOD_VERSION=$depmod_version
123 cat <<EOF > config.kbuild
124 EXT_CONFIG_KVM_TRACE=$kvm_trace