From 726fc5b8425eb7bbaab4bdde38d977382dc17a9d Mon Sep 17 00:00:00 2001 From: Stefaan De Roeck Date: Sun, 12 Oct 2008 19:01:58 +0000 Subject: [PATCH] linux-alternate-kernel-builddir-20081012 LICENSE IPL10 FIXES 121354 add support for KBUILD_OUTPUT=... builds. --- acinclude.m4 | 24 +++++++++++++++++------- src/cf/linux-test1.m4 | 4 ++-- src/config/Makefile.config.in | 1 + src/libafs/MakefileProto.LINUX.in | 3 ++- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 3ff726315f..985b6efbd8 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -190,6 +190,10 @@ AC_ARG_WITH([linux-kernel-headers], [AS_HELP_STRING([--with-linux-kernel-headers=path], [use the kernel headers found at path (optional, defaults to /usr/src/linux-2.4, then /usr/src/linux)])]) +AC_ARG_WITH([linux-kernel-build], + [AS_HELP_STRING([--with-linux-kernel-build=path], + [use the kernel build found at path(optional, defaults to + /usr/src/linux-2.4, then /usr/src/linux)])]) AC_ARG_WITH([bsd-kernel-headers], [AS_HELP_STRING([--with-bsd-kernel-headers=path], [use the kernel headers found at path (optional, defaults to @@ -334,15 +338,20 @@ case $system in LINUX_KERNEL_PATH="/usr/src/linux" fi fi - if test -f "$LINUX_KERNEL_PATH/include/linux/utsrelease.h"; then - linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/utsrelease.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1` + if test "$with_linux_kernel_build" != "x"; then + LINUX_KERNEL_BUILD="$with_linux_kernel_build" + else + LINUX_KERNEL_BUILD=$LINUX_KERNEL_PATH + fi + if test -f "$LINUX_KERNEL_BUILD/include/linux/utsrelease.h"; then + linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/utsrelease.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1` LINUX_VERSION="$linux_kvers" else - if test -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then - linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1` + if test -f "$LINUX_KERNEL_BUILD/include/linux/version.h"; then + linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1` if test "x$linux_kvers" = "x"; then - if test -f "$LINUX_KERNEL_PATH/include/linux/version-up.h"; then - linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1` + if test -f "$LINUX_KERNEL_BUILD/include/linux/version-up.h"; then + linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1` if test "x$linux_kvers" = "x"; then AC_MSG_ERROR(Linux headers lack version definition [2]) @@ -361,7 +370,7 @@ case $system in enable_kernel_module="no" fi fi - if test ! -f "$LINUX_KERNEL_PATH/include/linux/autoconf.h"; then + if test ! -f "$LINUX_KERNEL_BUILD/include/linux/autoconf.h"; then enable_kernel_module="no" fi if test "x$enable_kernel_module" = "xno"; then @@ -1574,6 +1583,7 @@ AC_SUBST(ENABLE_KERNEL_MODULE) AC_SUBST(ENABLE_PTHREADED_UBIK) AC_SUBST(LIB_AFSDB) AC_SUBST(LINUX_KERNEL_PATH) +AC_SUBST(LINUX_KERNEL_BUILD) AC_SUBST(HOST_CPU) AC_SUBST(BSD_KERNEL_PATH) AC_SUBST(BSD_KERNEL_BUILD) diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4 index 8c82baa87a..98bdc45c93 100644 --- a/src/cf/linux-test1.m4 +++ b/src/cf/linux-test1.m4 @@ -27,8 +27,8 @@ $2 MODULE_LICENSE("http://www.openafs.org/dl/license10.html"); _ACEOF - echo make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&AS_MESSAGE_LOG_FD && - make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&AS_MESSAGE_LOG_FD 2>conftest.err && + echo make -C $LINUX_KERNEL_BUILD M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&AS_MESSAGE_LOG_FD && + make -C $LINUX_KERNEL_BUILD M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&AS_MESSAGE_LOG_FD 2>conftest.err && ! grep -i "^WARNING: .* undefined!$" conftest.err >/dev/null 2>&1 then [$3] else diff --git a/src/config/Makefile.config.in b/src/config/Makefile.config.in index e4f6dbae09..3078b2d6f6 100644 --- a/src/config/Makefile.config.in +++ b/src/config/Makefile.config.in @@ -49,6 +49,7 @@ LEX = @LEX@ LIB_AFSDB = @LIB_AFSDB@ LIBS = @LIBS@ LINUX_KERNEL_PATH = @LINUX_KERNEL_PATH@ +LINUX_KERNEL_BUILD = @LINUX_KERNEL_BUILD@ LINUX_LIBAFS_NAME = @LINUX_LIBAFS_NAME@ LINUX_KERNEL_PACKAGING = @LINUX_KERNEL_PACKAGING@ LINUX_VERSION = @LINUX_VERSION@ diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in index 050212402a..7d58fdfc49 100644 --- a/src/libafs/MakefileProto.LINUX.in +++ b/src/libafs/MakefileProto.LINUX.in @@ -64,6 +64,7 @@ COMMON_KERN_CFLAGS=$(KERN_DBG) $(KERN_OPTMZ) @LINUX_GCC_KOPTS@ COMMON_DEFINES=-D__KERNEL__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} LINUX_KERNEL_PATH=@LINUX_KERNEL_PATH@ +LINUX_KERNEL_BUILD=@LINUX_KERNEL_BUILD@ # System specific build commands and flags @@ -299,7 +300,7 @@ ${LIBAFS} ${LIBAFS_MP} ${LIBAFS_EP} ${LIBAFS_BM}: ${LINUX_LIBAFS_NAME}.ko .FORCE: ${LINUX_LIBAFS_NAME}.ko afspag.ko: .FORCE env EXTRA_CFLAGS="${EXTRA_CFLAGS}" @TOP_SRCDIR@/libafs/make_kbuild_makefile.pl ${KDIR} $@ @TOP_OBJDIR@/src/config/Makefile.config Makefile.afs Makefile.common - env EXTRA_CFLAGS="${EXTRA_CFLAGS}" $(MAKE) -C ${LINUX_KERNEL_PATH} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules + env EXTRA_CFLAGS="${EXTRA_CFLAGS}" $(MAKE) -C ${LINUX_KERNEL_BUILD} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)