summaryrefslogtreecommitdiffstats
path: root/support/scripts
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@free.fr>2014-03-01 15:53:01 +0100
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-03-01 19:47:22 +0100
commita5a309642a056366ee437e2bae6da7dfda4fb667 (patch)
treeba325b831269409ecafbc94e99cdc0b9914e8690 /support/scripts
parent88d0bca0c103f1e8f2e0006948e0cf4860a35a21 (diff)
downloadbuildroot-a5a309642a056366ee437e2bae6da7dfda4fb667.tar.gz
buildroot-a5a309642a056366ee437e2bae6da7dfda4fb667.zip
toolchain/external: check kernel headers version for custom toolchain
Ensure the kernel headers version used in the custom external toolchain, or the manually-specified kernel headers version, matches exactly the one selected by the user. We do not care about the patch-level, since headers are not supposed to change between patchlevels. This applies only to kernels >= 3.0, but those are actually the ones we do care about; we treat all 2.6.x kernels as being a single version, since we do not support any 2.6 kernels for packages with kernel-dependant features. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support/scripts')
-rwxr-xr-xsupport/scripts/check-kernel-headers.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/support/scripts/check-kernel-headers.sh b/support/scripts/check-kernel-headers.sh
new file mode 100755
index 0000000000..d7fe7d4bc2
--- /dev/null
+++ b/support/scripts/check-kernel-headers.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+CC="${1}"
+# Make sure we have enough version components
+HDR_VER="${2}.0.0"
+
+HDR_M="${HDR_VER%%.*}"
+HDR_V="${HDR_VER#*.}"
+HDR_m="${HDR_V%%.*}"
+
+# We do not want to account for the patch-level, since headers are
+# not supposed to change for different patchlevels, so we mask it out.
+# This only applies to kernels >= 3.0, but those are the only one
+# we actually care about; we treat all 2.6.x kernels equally.
+
+exec ${CC} -E -x c -o - - >/dev/null 2>&1 <<_EOF_
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE & ~0xFF) != KERNEL_VERSION(${HDR_M},${HDR_m},0)
+#error Incorrect kernel header version.
+#endif
+_EOF_
OpenPOWER on IntegriCloud