diff options
author | Andre Przywara <andre.przywara@arm.com> | 2016-05-16 14:44:54 +0100 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2016-05-17 14:32:29 +0100 |
commit | 45b624bec1db1806043e4687f9e843d3382418cd (patch) | |
tree | 2ffaa3f76d8d7524e35540887e86101904a5ea96 | |
parent | b37ed70efed0c6a38c76655136ff900479d30408 (diff) | |
download | kvmtool-45b624bec1db1806043e4687f9e843d3382418cd.tar.gz |
kvmtool: add script for updating kernel headers
From time to time (when new KVM kernel features get enabled in kvmtool),
we need to update the public kernel headers from a recent Linux tree.
Provide a script that makes sure we get the right files and that also
covers every architecture.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rwxr-xr-x | util/update_headers.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/util/update_headers.sh b/util/update_headers.sh new file mode 100755 index 00000000..2d936468 --- /dev/null +++ b/util/update_headers.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +######################################################################## +# Updates the kvmtool tree with up-to-date public header files from +# a Linux source tree. +# If no directory is given on the command line, it will try to find one +# using the lib/modules/`uname -r`/source link. +######################################################################## + +if [ "$#" -ge 1 ] +then + LINUX_ROOT="$1" +else + LINUX_ROOT=/lib/modules/$(uname -r)/source +fi + +if [ ! -d $LINUX_ROOT/include/uapi/linux ] +then + echo "$LINUX_ROOT does not seem to be valid Linux source tree." + echo "usage: $0 [path-to-Linux-source-tree]" + exit 1 +fi + +cp $LINUX_ROOT/include/uapi/linux/kvm.h include/linux + +for arch in arm arm64 mips powerpc x86 +do + case "$arch" in + arm) KVMTOOL_PATH=arm/aarch32 ;; + arm64) KVMTOOL_PATH=arm/aarch64 ;; + *) KVMTOOL_PATH=$arch ;; + esac + cp $LINUX_ROOT/arch/$arch/include/uapi/asm/kvm.h \ + $KVMTOOL_PATH/include/asm +done |