From 1ff0b555d3c6ba291adf0c4c76e222acfeb52f1d Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Mon, 16 Feb 2015 22:35:25 +0100 Subject: scripts/update-linux-headers.sh: pull virtio hdrs It doesn't make sense to copy values manually: the only issue with getting headers from linux seems to be dealing with linux/types, we can easily fix that automatically while importing. Signed-off-by: Michael S. Tsirkin Reviewed-by: Thomas Huth --- scripts/update-linux-headers.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'scripts') diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index c8e026d..8926dec 100755 --- a/scripts/update-linux-headers.sh +++ b/scripts/update-linux-headers.sh @@ -28,6 +28,36 @@ if [ -z "$output" ]; then output="$PWD" fi +cp_virtio() { + from=$1 + to=$2 + virtio=$(find "$from" -name '*virtio*h') + if [ "$virtio" ]; then + rm -rf "$to" + mkdir -p "$to" + for f in $virtio; do + if + grep '#include' "$f" | grep -v -e 'linux/virtio' \ + -e 'linux/types' \ + -e 'linux/if_ether' \ + > /dev/null + then + echo "Unexpected #include in input file $f". + exit 2 + fi + + header=$(basename "$f"); + sed -e 's/__u\([0-9][0-9]*\)/uint\1_t/g' \ + -e 's/__le\([0-9][0-9]*\)/uint\1_t/g' \ + -e 's/__be\([0-9][0-9]*\)/uint\1_t/g' \ + -e 's/]*\)>/"standard-headers\/linux\/\1"/' \ + -e 's/__bitwise__//' \ + -e 's/__attribute__((packed))/QEMU_PACKED/' \ + "$f" > "$to/$header"; + done + fi +} + # This will pick up non-directories too (eg "Kconfig") but we will # ignore them in the next loop. ARCHLIST=$(cd "$linux/arch" && echo *) @@ -76,4 +106,15 @@ else cp "$linux/COPYING" "$output/linux-headers" fi + +cp_virtio "$tmpdir/include/linux/" "$output/include/standard-headers/linux" + +cat <$output/include/standard-headers/linux/types.h +#include +#include "qemu/compiler.h" +EOF +cat <$output/include/standard-headers/linux/if_ether.h +#define ETH_ALEN 6 +EOF + rm -rf "$tmpdir" -- cgit v1.1 From 05e492b0dbe42232b2ee9edffb016c68e6519a61 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Mon, 16 Feb 2015 22:36:32 +0100 Subject: update-linux-headers: use standard-headers Drop the linux-specific virtio headers, use the copy from standard-headers instead. Signed-off-by: Michael S. Tsirkin --- scripts/update-linux-headers.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index 8926dec..5ab3914 100755 --- a/scripts/update-linux-headers.sh +++ b/scripts/update-linux-headers.sh @@ -91,7 +91,7 @@ done rm -rf "$output/linux-headers/linux" mkdir -p "$output/linux-headers/linux" -for header in kvm.h kvm_para.h vfio.h vhost.h virtio_config.h virtio_ring.h \ +for header in kvm.h kvm_para.h vfio.h vhost.h \ psci.h; do cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux" done @@ -106,6 +106,12 @@ else cp "$linux/COPYING" "$output/linux-headers" fi +cat <$output/linux-headers/linux/virtio_config.h +#include "standard-headers/linux/virtio_config.h" +EOF +cat <$output/linux-headers/linux/virtio_ring.h +#include "standard-headers/linux/virtio_ring.h" +EOF cp_virtio "$tmpdir/include/linux/" "$output/include/standard-headers/linux" -- cgit v1.1 From 44fb1dd4cef6d8be87cef7437fb350d0ebf2f837 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Mon, 16 Feb 2015 22:36:48 +0100 Subject: scripts: add arch specific standard-headers Copy arch specific virtio headers. ATM this applies to s390 only. Signed-off-by: Michael S. Tsirkin --- scripts/update-linux-headers.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index 5ab3914..9680e27 100755 --- a/scripts/update-linux-headers.sh +++ b/scripts/update-linux-headers.sh @@ -87,6 +87,8 @@ for arch in $ARCHLIST; do if [ $arch = powerpc ]; then cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/" fi + + cp_virtio "$tmpdir/include/asm" "$output/include/standard-headers/asm-$arch" done rm -rf "$output/linux-headers/linux" -- cgit v1.1 From c16758cb4f273f72606cd9002fa31c2651822fcd Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Wed, 18 Feb 2015 16:37:35 +0100 Subject: update-linux-headers.sh: s/__inline__/inline/ Thomas Huth noticed that some linux headers use __inline__, change to inline to be consistent with the rest of QEMU. Reported-by: Thomas Huth Signed-off-by: Michael S. Tsirkin --- scripts/update-linux-headers.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index 9680e27..f208ec9 100755 --- a/scripts/update-linux-headers.sh +++ b/scripts/update-linux-headers.sh @@ -53,6 +53,7 @@ cp_virtio() { -e 's/]*\)>/"standard-headers\/linux\/\1"/' \ -e 's/__bitwise__//' \ -e 's/__attribute__((packed))/QEMU_PACKED/' \ + -e 's/__inline__/inline/' \ "$f" > "$to/$header"; done fi -- cgit v1.1