5 kerneldir
=/lib
/modules
/$
(uname
-r)/build
18 # don't use uname if kerneldir is set
21 if [ -z "TMPDIR" ] ; then
30 --arch=ARCH architecture to compile for ($arch)
31 --cross-prefix=PREFIX prefix for cross compile
32 --prefix=PREFIX where to install things ($prefix)
33 --with-patched-kernel don't use external module
34 --with-kvm-trace Enable kvm_trace
35 --kerneldir=DIR kernel build directory ($kerneldir)
36 --qemu-cflags=CFLAGS CFLAGS to add to qemu configuration
37 --qemu-ldflags=LDFLAGS LDFLAGS to add to qemu configuration
39 Any additional option is given to qemu's configure verbatim; including:
43 .
/configure
--help |
egrep "enable-|disable-" \
44 |
grep -v user |
grep -v system |
grep -v kqemu |
grep -v kvm \
46 |
sed -e"s/ enable/enable/g" |
sed -e "s/ disable/disable/g"
50 while [[ "$1" = -* ]]; do
54 if [[ "$opt" = *=* ]]; then
67 --with-patched-kernel)
89 qemu_opts
=("${qemu_opts[@]}" "$opt${hasarg:+=$arg}")
96 libkvm_kerneldir
=$
(readlink
-f kernel
)
100 arch
=${arch/#i?86/i386}
101 target_exec
="x86_64-softmmu"
102 qemu_cflags
="$qemu_cflags -DCONFIG_X86"
105 target_exec
="ia64-softmmu"
108 target_exec
="ppcemb-softmmu"
109 qemu_cflags
="$qemu_cflags -I $PWD/libfdt"
110 qemu_ldflags
="$qemu_ldflags -L $PWD/libfdt"
117 # see if we have split build and source directories
118 if [ -d "$kerneldir/include2" ]; then
119 kernelsourcedir
=${kerneldir%/*}/source
122 if [ -n "$no_uname" -a "$want_module" ]; then
123 if [ -e "$kerneldir/.kernelrelease" ]; then
124 depmod_version
=`cat "$kerneldir/.kernelrelease"`
126 elif [ -e "$kerneldir/include/config/kernel.release" ]; then
127 depmod_version
=`cat "$kerneldir/include/config/kernel.release"`
128 elif [ -e "$kerneldir/.config" ]; then
129 depmod_version
=$
(awk '/Linux kernel version:/ { print $NF }' \
130 "$kerneldir/.config")
133 echo "Error: kernelversion not found"
134 echo "Please make sure your kernel is configured"
141 (cd user
; .
/configure
--prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
142 --arch="$arch" --processor="$processor" \
143 ${cross_prefix:+"--cross-prefix=$cross_prefix"})
146 (cd qemu
; .
/configure
--target-list=$target_exec \
148 --extra-cflags="-I $PWD/../libkvm $qemu_cflags" \
149 --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \
150 --kerneldir="$libkvm_kerneldir" \
152 ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
153 ${cross_prefix:+"--cpu=$arch"} "${qemu_opts[@]}"
157 cat <<EOF > config.mak
162 KERNELSOURCEDIR=$kernelsourcedir
163 LIBKVM_KERNELDIR=$libkvm_kerneldir
164 WANT_MODULE=$want_module
165 CROSS_COMPILE=$cross_prefix
168 OBJCOPY=$cross_prefix$objcopy
170 DEPMOD_VERSION=$depmod_version
173 cat <<EOF > kernel/config.kbuild
174 EXT_CONFIG_KVM_TRACE=$kvm_trace