kvm: Pass CPUState to kvm_vcpu_ioctl()
[qemu/opensuse.git] / scripts / update-linux-headers.sh
blob4c7b566fdfbf7cfc3d9b41be590167b4f7793925
1 #!/bin/sh -e
3 # Update Linux kernel headers QEMU requires from a specified kernel tree.
5 # Copyright (C) 2011 Siemens AG
7 # Authors:
8 # Jan Kiszka <jan.kiszka@siemens.com>
10 # This work is licensed under the terms of the GNU GPL version 2.
11 # See the COPYING file in the top-level directory.
13 tmpdir=`mktemp -d`
14 linux="$1"
15 output="$2"
17 if [ -z "$linux" ] || ! [ -d "$linux" ]; then
18 cat << EOF
19 usage: update-kernel-headers.sh LINUX_PATH [OUTPUT_PATH]
21 LINUX_PATH Linux kernel directory to obtain the headers from
22 OUTPUT_PATH output directory, usually the qemu source tree (default: $PWD)
23 EOF
24 exit 1
27 if [ -z "$output" ]; then
28 output="$PWD"
31 # This will pick up non-directories too (eg "Kconfig") but we will
32 # ignore them in the next loop.
33 ARCHLIST=$(cd "$linux/arch" && echo *)
35 for arch in $ARCHLIST; do
36 # Discard anything which isn't a KVM-supporting architecture
37 if ! [ -e "$linux/arch/$arch/include/asm/kvm.h" ] &&
38 ! [ -e "$linux/arch/$arch/include/uapi/asm/kvm.h" ] ; then
39 continue
42 # Blacklist architectures which have KVM headers but are actually dead
43 if [ "$arch" = "ia64" ]; then
44 continue
47 make -C "$linux" INSTALL_HDR_PATH="$tmpdir" SRCARCH=$arch headers_install
49 rm -rf "$output/linux-headers/asm-$arch"
50 mkdir -p "$output/linux-headers/asm-$arch"
51 for header in kvm.h kvm_para.h; do
52 cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
53 done
54 if [ $arch = x86 ]; then
55 cp "$tmpdir/include/asm/hyperv.h" "$output/linux-headers/asm-x86"
57 done
59 rm -rf "$output/linux-headers/linux"
60 mkdir -p "$output/linux-headers/linux"
61 for header in kvm.h kvm_para.h vfio.h vhost.h virtio_config.h virtio_ring.h; do
62 cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux"
63 done
64 rm -rf "$output/linux-headers/asm-generic"
65 mkdir -p "$output/linux-headers/asm-generic"
66 for header in kvm_para.h; do
67 cp "$tmpdir/include/asm-generic/$header" "$output/linux-headers/asm-generic"
68 done
69 if [ -L "$linux/source" ]; then
70 cp "$linux/source/COPYING" "$output/linux-headers"
71 else
72 cp "$linux/COPYING" "$output/linux-headers"
75 rm -rf "$tmpdir"