From eefaca6f9fdb11e0701b678ed5a7ab30a58f2f7d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 3 Jul 2017 10:13:06 +1000 Subject: [PATCH] tools: add a script to sync the kernel header files Signed-off-by: Peter Hutterer --- tools/sync-with-kernel-headers.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 tools/sync-with-kernel-headers.sh diff --git a/tools/sync-with-kernel-headers.sh b/tools/sync-with-kernel-headers.sh new file mode 100755 index 0000000..89635b6 --- /dev/null +++ b/tools/sync-with-kernel-headers.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Syncs the repository with the input.h and input-event-codes.h headers from +# a checked out source directory. +# +# Usage: +# sync-with-kernel-headers.sh path/to/kernel v4.12 + +KERNEL_TREE="$1" +GIT_DIR="$KERNEL_TREE/.git" +TAG="$2" + +export GIT_DIR + +if [ -z "$TAG" ] || ! [ -d "$GIT_DIR" ]; then + echo "Usage: `basename $0` path/to/kernel tag" + exit 1 +fi +if ! [ -d .git ]; then + echo "Run me from the top-level git tree" + exit 1 +fi + +files="linux/input.h linux/input-event-codes.h" + + +for file in $files; do + git cat-file -p "$TAG:include/uapi/$file" > "include/$file" +done +