X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=config%2Flustre-build-linux.m4;h=49f06bdc3ff8d7f6a18637f1e5bdf6dfc3cee4e7;hp=fb58fce0f6a7f42afaddb001d74cbf1354952a26;hb=22e45ed08068b2ecf479cf4d0d294fa471126b0c;hpb=96786e021765b93b3d9607d8e771319dfb2bd675 diff --git a/config/lustre-build-linux.m4 b/config/lustre-build-linux.m4 index fb58fce..49f06bd 100644 --- a/config/lustre-build-linux.m4 +++ b/config/lustre-build-linux.m4 @@ -33,42 +33,55 @@ AC_SUBST(KMODEXT) ]) # +# LB_LINUX_UTSRELEASE +# +# Determine the Linux kernel version string from the utsrelease +# +AC_DEFUN([LB_LINUX_UTSRELEASE], [ + AC_MSG_CHECKING([kernel source version]) + + utsrelease1=${LINUX_OBJ}/include/generated/utsrelease.h + utsrelease2=${LINUX_OBJ}/include/linux/utsrelease.h + utsrelease3=${LINUX_OBJ}/include/linux/version.h + AS_IF([test -r ${utsrelease1} && fgrep -q UTS_RELEASE ${utsrelease1}], [ + utsrelease=${utsrelease1} + ], [test -r ${utsrelease2} && fgrep -q UTS_RELEASE ${utsrelease2}], [ + utsrelease=${utsrelease2} + ], [test -r ${utsrelease3} && fgrep -q UTS_RELEASE ${utsrelease3}], [ + utsrelease=${utsrelease3} + ]) + + AS_IF([test ! -z "${utsrelease}"], [ + UTS_RELEASE=$(awk -F \" '/ UTS_RELEASE / { print [$]2 }' \ + ${utsrelease}) + AS_IF([test -z "$UTS_RELEASE"], [ + AC_MSG_RESULT([Not found]) + AC_MSG_ERROR([*** Cannot determine kernel version.]) + ]) + ], [ + AC_MSG_RESULT([Not found]) + AC_MSG_ERROR([ + *** Cannot find UTS_RELEASE definition. + *** This is often provided by the kernel-devel package.]) + ]) + + AC_MSG_RESULT([${UTS_RELEASE}]) + + LINUX_VERSION=${UTS_RELEASE} + AC_SUBST(LINUX_VERSION) + LINUXRELEASE=${UTS_RELEASE} + AC_SUBST(LINUXRELEASE) +]) + + +# # LB_LINUX_RELEASE # # get the release version of linux # AC_DEFUN([LB_LINUX_RELEASE], -[LINUXRELEASE= -rm -f build/conftest.i -AC_MSG_CHECKING([for Linux release]) -if test -s $LINUX_OBJ/include/$AUTOCONF_HDIR/utsrelease.h ; then - LINUXRELEASEHEADER=$AUTOCONF_HDIR/utsrelease.h -else - LINUXRELEASEHEADER=$VERSION_HDIR/version.h -fi -LB_LINUX_TRY_MAKE([ - #include <$LINUXRELEASEHEADER> -],[ - char *LINUXRELEASE; - LINUXRELEASE=UTS_RELEASE; -],[ - $makerule LUSTRE_KERNEL_TEST=conftest.i -],[ - test -s build/conftest.i -],[ - # LINUXRELEASE="UTS_RELEASE" - eval $(grep "LINUXRELEASE=" build/conftest.i) -],[ - AC_MSG_RESULT([unknown]) - AC_MSG_ERROR([Could not preprocess test program. Consult config.log for details.]) -]) -rm -f build/conftest.i -if test x$LINUXRELEASE = x ; then - AC_MSG_RESULT([unknown]) - AC_MSG_ERROR([Could not determine Linux release version from $LINUXRELEASEHEADER.]) -fi -AC_MSG_RESULT([$LINUXRELEASE]) -AC_SUBST(LINUXRELEASE) +[ +LB_LINUX_UTSRELEASE moduledir='$(CROSS_PATH)/lib/modules/$(LINUXRELEASE)/updates/kernel' AC_SUBST(moduledir) @@ -81,7 +94,7 @@ AC_SUBST(modulenetdir) # ------------ RELEASE -------------------------------- AC_MSG_CHECKING([for Lustre release]) -AC_ARG_WITH([release], +AC_ARG_WITH([release],[ AC_HELP_STRING([--with-release=string], [set the release string (default=$kvers_YYYYMMDDhhmm)]), [RELEASE=$withval], @@ -89,16 +102,17 @@ AC_ARG_WITH([release], if test -n "$DOWNSTREAM_RELEASE"; then RELEASE="${DOWNSTREAM_RELEASE}_" fi - RELEASE="$RELEASE`echo ${LINUXRELEASE} | tr '-' '_'`_$BUILDID") + RELEASE="$RELEASE`echo ${LINUXRELEASE} | tr '-' '_'`_$BUILDID" +]) AC_MSG_RESULT($RELEASE) AC_SUBST(RELEASE) -# check is redhat/suse kernels +# check if the kernel is one from RHEL or SUSE AC_MSG_CHECKING([for RedHat kernel version]) - AS_IF([fgrep -q RHEL_RELEASE ${LINUX_OBJ}/include/linux/version.h], [ + AS_IF([fgrep -q RHEL_RELEASE ${LINUX_OBJ}/include/$VERSION_HDIR/version.h], [ RHEL_KERNEL="yes" RHEL_RELEASE=$(expr 0$(awk -F \" '/ RHEL_RELEASE / { print [$]2 }' \ - ${LINUX_OBJ}/include/linux/version.h) + 1) + ${LINUX_OBJ}/include/$VERSION_HDIR/version.h) + 1) KERNEL_VERSION=$(sed -e 's/\(@<:@23@:>@\.@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/' <<< ${LINUXRELEASE}) RHEL_KERNEL_VERSION=${KERNEL_VERSION}-${RHEL_RELEASE} AC_SUBST(RHEL_KERNEL_VERSION) @@ -298,22 +312,26 @@ CROSS_VARS= CROSS_PATH= AS_IF([test "x$cross_compiling" = xno], [AC_MSG_RESULT([no])], [case $host_vendor in - # The K1OM architecture is an extension of the x86 architecture. - # So, the $host_arch is x86_64. - k1om) + # The K1OM architecture is an extension of the x86 architecture + # and in MPSS 2.1 it's defined in $host_vendor. But in MPSS 3.x + # it's defined in $host_arch. So, try to support both case. + k1om | mpss) AC_MSG_RESULT([Intel(R) Xeon Phi(TM)]) CC_TARGET_ARCH=`$CC -v 2>&1 | grep Target: | sed -e 's/Target: //'` - if test $CC_TARGET_ARCH != x86_64-$host_vendor-linux ; then + AC_SUBST(CC_TARGET_ARCH) + if test \( $CC_TARGET_ARCH != x86_64-k1om-linux \ + -a $CC_TARGET_ARCH != k1om-mpss-linux \) + then AC_MSG_ERROR([Cross compiler not found in PATH.]) fi - CROSS_VARS="ARCH=$host_vendor CROSS_COMPILE=x86_64-$host_vendor-linux-" - CROSS_PATH=${CROSS_PATH:=/opt/intel/mic/lustre/device-k1om} + CROSS_VARS="ARCH=k1om CROSS_COMPILE=${CC_TARGET_ARCH}-" + CROSS_PATH="${CROSS_PATH:=/opt/lustre/${VERSION}/${CC_TARGET_ARCH}}" CCAS=$CC # need to produce special section for debuginfo extraction LDFLAGS="${LDFLAGS} -Wl,--build-id" EXTRA_KLDFLAGS="${EXTRA_KLDFLAGS} -Wl,--build-id" - if test x$enable_server = xyes ; then - AC_MSG_WARN([Disabling server (not supported for x86_64-$host_vendor-linux).]) + if test x$enable_server != xno ; then + AC_MSG_WARN([Disabling server (not supported for k1om architecture).]) enable_server='no' fi ;; @@ -353,7 +371,7 @@ $2 AC_DEFUN([LB_LINUX_COMPILE_IFELSE], [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl rm -f build/conftest.o build/conftest.mod.c build/conftest.ko -SUBARCH=$(echo $target_cpu | sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/') +SUBARCH=$(echo $target_cpu | sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/' -e 's/k1om/x86/') AS_IF([AC_TRY_COMMAND(cp conftest.c build && make -d [$2] ${LD:+"LD=$LD"} CC="$CC" -f $PWD/build/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG LINUXINCLUDE="$EXTRA_LNET_INCLUDE -I$LINUX/arch/$SUBARCH/include -I$LINUX/arch/$SUBARCH/include/generated -Iinclude -I$LINUX/include -Iinclude2 -I$LINUX/include/uapi -I$LINUX/include/generated -I$LINUX/arch/$SUBARCH/include/uapi -Iarch/$SUBARCH/include/generated/uapi -I$LINUX/include/uapi -Iinclude/generated/uapi -include $CONFIG_INCLUDE" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $CROSS_VARS $MODULE_TARGET=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])], [$4], [_AC_MSG_LOG_CONFTEST