kernel/conftest.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/kernel/conftest.sh b/kernel/conftest.sh index 9720cab..88a02e8 100755 --- a/kernel/conftest.sh +++ b/kernel/conftest.sh @@ -157,6 +157,7 @@ build_cflags() { CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS $AUTOCONF_CFLAGS" CFLAGS="$CFLAGS -I$HEADERS -I$HEADERS/uapi" + CFLAGS="$CFLAGS -I$OUTPUT/include/generated/uapi" if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include" @@ -1647,7 +1648,7 @@ case "$6" in FILE="linux/version.h" SELECTED_MAKEFILE="" - if [ -f $HEADERS/$FILE -o -f $OUTPUT/include/$FILE ]; then + if [ -f $HEADERS/$FILE -o -f $OUTPUT/include/$FILE -o -f $OUTPUT/include/generated/uapi/$FILE ]; then # # We are either looking at a configured kernel source # tree or at headers shipped for a specific kernel. @@ -1697,11 +1698,18 @@ case "$6" in # kernel older than 2.6.6, that's all we require to # build the module. # + K_VERSION=$(grep "^VERSION =" $MAKEFILE | cut -d " " -f 3) PATCHLEVEL=$(grep "^PATCHLEVEL =" $MAKEFILE | cut -d " " -f 3) SUBLEVEL=$(grep "^SUBLEVEL =" $MAKEFILE | cut -d " " -f 3) - if [ -n "$PATCHLEVEL" -a $PATCHLEVEL -ge 6 \ - -a -n "$SUBLEVEL" -a $SUBLEVEL -le 5 ]; then + kernel_is() { + local operator value1 value2 + operator=$1; shift + : $(( value1 = K_VERSION * 65536 + PATCHLEVEL * 256 + SUBLEVEL )) + : $(( value2 = ${1:-${K_VERSION}} * 65536 + ${2:-${PATCHLEVEL}} * 256 + ${3:-${SUBLEVEL}} )) + [ "${value1}" ${operator} "${value2}" ] + } + if kernel_is -le 2 6 5; then SELECTED_MAKEFILE=Makefile.kbuild RET=0 fi @@ -1796,11 +1804,12 @@ case "$6" in # This source tree is not configured, but includes # the top-level Makefile. # + K_VERSION=$(grep "^VERSION =" $MAKEFILE | cut -d " " -f 3) PATCHLEVEL=$(grep "^PATCHLEVEL =" $MAKEFILE | cut -d " " -f 3) SUBLEVEL=$(grep "^SUBLEVEL =" $MAKEFILE | cut -d " " -f 3) - if [ -n "$PATCHLEVEL" -a -n "$SUBLEVEL" ]; then - echo 2.$PATCHLEVEL.$SUBLEVEL + if [ -n "$K_VERSION" -a -n "$PATCHLEVEL" -a -n "$SUBLEVEL" ]; then + echo $K_VERSION.$PATCHLEVEL.$SUBLEVEL RET=0 fi fi