qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

Add kernel header update script

This helper pulls the required kernel headers for KVM and vhost into a
specified directory. The update is triggered via

scripts/update-linux-headers.sh LINUX_PATH

and will place the output under linux-headers/linux and linux-headers/asm-*.
It also imports the COPYING to care for headers without an explicit license.

CC: Alexander Graf <agraf@suse.de>
CC: Christoph Hellwig <hch@lst.de>
CC: Peter Maydell <peter.maydell@linaro.org>
CC: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

authored by

Jan Kiszka and committed by
Marcelo Tosatti
87fdd476 42cc8fa6

+57
+2
linux-headers/README
··· 1 + Automatically imported Linux kernel headers. 2 + Only use scripts/update-linux-headers.sh to update!
+55
scripts/update-linux-headers.sh
··· 1 + #!/bin/sh -e 2 + # 3 + # Update Linux kernel headers QEMU requires from a specified kernel tree. 4 + # 5 + # Copyright (C) 2011 Siemens AG 6 + # 7 + # Authors: 8 + # Jan Kiszka <jan.kiszka@siemens.com> 9 + # 10 + # This work is licensed under the terms of the GNU GPL version 2. 11 + # See the COPYING file in the top-level directory. 12 + 13 + tmpdir=`mktemp -d` 14 + linux="$1" 15 + output="$2" 16 + 17 + if [ -z "$linux" ] || ! [ -d "$linux" ]; then 18 + cat << EOF 19 + usage: update-kernel-headers.sh LINUX_PATH [OUTPUT_PATH] 20 + 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 25 + fi 26 + 27 + if [ -z "$output" ]; then 28 + output="$PWD" 29 + fi 30 + 31 + for arch in x86 powerpc s390; do 32 + make -C "$linux" INSTALL_HDR_PATH="$tmpdir" SRCARCH=$arch headers_install 33 + 34 + rm -rf "$output/linux-headers/asm-$arch" 35 + mkdir -p "$output/linux-headers/asm-$arch" 36 + for header in kvm.h kvm_para.h; do 37 + cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch" 38 + done 39 + if [ $arch = x86 ]; then 40 + cp "$tmpdir/include/asm/hyperv.h" "$output/linux-headers/asm-x86" 41 + fi 42 + done 43 + 44 + rm -rf "$output/linux-headers/linux" 45 + mkdir -p "$output/linux-headers/linux" 46 + for header in kvm.h kvm_para.h vhost.h virtio_config.h virtio_ring.h; do 47 + cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux" 48 + done 49 + if [ -L "$linux/source" ]; then 50 + cp "$linux/source/COPYING" "$output/linux-headers" 51 + else 52 + cp "$linux/COPYING" "$output/linux-headers" 53 + fi 54 + 55 + rm -rf "$tmpdir"