X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=config%2Flustre-build-linux.m4;h=e1b46a374080a2c1b37d62246dc74f697c884470;hp=a780455c48304465d77cf925431c23e8e0e9c6b1;hb=2250e072c37855d611aa64027945981fe2c8f4d7;hpb=a0f7434c4ddd9965b82a87245b9fe586abf56e81 diff --git a/config/lustre-build-linux.m4 b/config/lustre-build-linux.m4 index a780455..e1b46a3 100644 --- a/config/lustre-build-linux.m4 +++ b/config/lustre-build-linux.m4 @@ -73,54 +73,97 @@ AC_SUBST(LINUXRELEASE) # get the release version of linux # AC_DEFUN([LB_LINUX_RELEASE], [ -LB_LINUX_UTSRELEASE - -# ------------ RELEASE -------------------------------- -AC_MSG_CHECKING([for Lustre release]) -AC_ARG_WITH([release], - AC_HELP_STRING([--with-release=string], - [set the release string (default=$kvers_YYYYMMDDhhmm)]), - [RELEASE=$withval], [ - RELEASE="$(echo $LINUXRELEASE | tr '-' '_')"]) -AC_MSG_RESULT($RELEASE) -AC_SUBST(RELEASE) - -# check if the kernel is one from RHEL or SUSE -AC_CACHE_CHECK([for RedHat kernel release number], lb_cv_rhel_kernel_version, [ -lb_cv_rhel_kernel_version="" -AS_IF([fgrep -q RHEL_RELEASE $LINUX_OBJ/include/$VERSION_HDIR/version.h], [ - lb_cv_rhel_kernel_version=$(awk '/ RHEL_MAJOR / { print [$]3 }' \ - $LINUX_OBJ/include/$VERSION_HDIR/version.h)$(awk \ - '/ RHEL_MINOR / { print [$]3 }' \ - $LINUX_OBJ/include/$VERSION_HDIR/version.h) -]) -]) -AS_IF([test -n "$lb_cv_rhel_kernel_version"], [ - RHEL_KERNEL="yes" - RHEL_RELEASE_NO=$lb_cv_rhel_kernel_version -], [ + LB_LINUX_UTSRELEASE + + # Define default states RHEL_KERNEL="no" - LB_CHECK_CONFIG([SUSE_KERNEL], [SUSE_KERNEL="yes"], [SUSE_KERNEL="no"]) -]) + SUSE_KERNEL="no" + UBUNTU_KERNEL="no" + DEBIAN_KERNEL="no" + # And if any of the above kernels has been detected yet + KERNEL_FOUND="no" + + # Check for RedHat first (no need to check KERNEL_FOUND + AC_CACHE_CHECK([for RedHat kernel release number], lb_cv_rhel_kernel_version, [ + lb_cv_rhel_kernel_version="" + AS_IF([fgrep -q RHEL_RELEASE $LINUX_OBJ/include/$VERSION_HDIR/version.h], [ + lb_cv_rhel_kernel_version=$(awk '/ RHEL_MAJOR / { print [$]3 }' \ + $LINUX_OBJ/include/$VERSION_HDIR/version.h)$(awk \ + '/ RHEL_MINOR / { print [$]3 }' \ + $LINUX_OBJ/include/$VERSION_HDIR/version.h) + ]) + ]) + AS_IF([test -n "$lb_cv_rhel_kernel_version"], [ + RHEL_KERNEL="yes" + KERNEL_FOUND="yes" + RHEL_RELEASE_NO=$lb_cv_rhel_kernel_version + ]) + + # Check for SuSE + AS_IF([test "x$KERNEL_FOUND" = "xno"], [ + LB_CHECK_CONFIG([SUSE_KERNEL], [ + SUSE_KERNEL="yes" + KERNEL_FOUND="yes" + ], []) + ]) + + # Check for Ubuntu + AS_IF([test "x$KERNEL_FOUND" = "xno"], [ + AC_CACHE_CHECK([for Ubuntu kernel signature], lb_cv_ubuntu_kernel_sig, [ + lb_cv_ubuntu_kernel_sig="no" + AS_IF([fgrep -q "CONFIG_VERSION_SIGNATURE \"Ubuntu" $LINUX_OBJ/include/generated/autoconf.h], [ + lb_cv_ubuntu_kernel_sig="yes" + ]) + ]) + AS_IF([test "x$lb_cv_ubuntu_kernel_sig" = "xyes"], [ + UBUNTU_KERNEL="yes" + KERNEL_FOUND="yes" + ]) + ]) -AC_MSG_CHECKING([for Linux kernel module package directory]) -AC_ARG_WITH([kmp-moddir], - AC_HELP_STRING([--with-kmp-moddir=string], - [set the kmod updates or extra directory]), - [KMP_MODDIR=$withval],[ - AS_IF([test x$RHEL_KERNEL = xyes], [KMP_MODDIR="extra"], - [test x$SUSE_KERNEL = xyes], [KMP_MODDIR="updates"])]) -AC_MSG_RESULT($KMP_MODDIR) -AC_SUBST(KMP_MODDIR) + # Check for Debian + AS_IF([test "x$KERNEL_FOUND" = "xno"], [ + AC_CACHE_CHECK([for Debian kernel signature], lb_cv_debian_kernel_sig, [ + lb_cv_debian_kernel_sig="no" + AS_IF([grep -q "LINUX_PACKAGE_ID\s*\"\s*Debian" $LINUX_OBJ/include/generated/package.h], [ + lb_cv_debian_kernel_sig="yes" + ]) + ]) + AS_IF([test "x$lb_cv_debian_kernel_sig" = "xyes"], [ + DEBIAN_KERNEL="yes" + KERNEL_FOUND="yes" + ]) + ]) -moduledir='/lib/modules/$(LINUXRELEASE)/$(KMP_MODDIR)/kernel' -AC_SUBST(moduledir) + # If still no kernel was found, a warning is issued + AS_IF([test "x$KERNEL_FOUND" = "xno"], [ + AC_MSG_WARN([Kernel Distro seems to be neither RedHat, SuSE, Ubuntu nor Debian]) + ]) + + AC_MSG_CHECKING([for Linux kernel module package directory]) + AC_ARG_WITH([kmp-moddir], + AC_HELP_STRING([--with-kmp-moddir=string], + [set the kmod updates or extra directory]), + [KMP_MODDIR=$withval + IN_KERNEL=''],[ + AS_IF([test x$RHEL_KERNEL = xyes], [KMP_MODDIR="extra/kernel"], + [test x$SUSE_KERNEL = xyes], [KMP_MODDIR="updates/kernel"], + [test x$UBUNTU_KERNEL = xyes], [KMP_MODDIR="updates/kernel"], + [test x$DEBIAN_KERNEL = xyes], [KMP_MODDIR="updates/kernel"], + [AC_MSG_WARN([Kernel Distro seems to be neither RedHat, SuSE, Ubuntu nor Debian])] + ) + IN_KERNEL="${PACKAGE}"]) + AC_MSG_RESULT($KMP_MODDIR) + + moduledir="/lib/modules/${LINUXRELEASE}/${KMP_MODDIR}" -modulefsdir='$(moduledir)/fs/$(PACKAGE)' -AC_SUBST(modulefsdir) + modulefsdir="${moduledir}/fs/${IN_KERNEL}" + AC_SUBST(modulefsdir) -modulenetdir='$(moduledir)/net/$(PACKAGE)' -AC_SUBST(modulenetdir) + modulenetdir="${moduledir}/net/${IN_KERNEL}" + AC_SUBST(modulenetdir) + + AC_SUBST(KMP_MODDIR) ]) # @@ -183,11 +226,13 @@ AC_DEFUN([LB_ARG_CANON_PATH], [ # Find paths for linux, handling kernel-source rpms # AC_DEFUN([LB_LINUX_PATH], [ -for DEFAULT_LINUX in /lib/modules/$(uname -r)/{source,build} /usr/src/linux; do +for DEFAULT_LINUX in /usr/src/linux-source-* /lib/modules/$(uname -r)/{source,build} /usr/src/linux $(find /usr/src/kernels/ -maxdepth 1 -name @<:@0-9@:>@\* | xargs -r ls -d | tail -n 1); do AS_IF([readlink -q -e $DEFAULT_LINUX >/dev/null], [break]) done if test "$DEFAULT_LINUX" = "/lib/modules/$(uname -r)/source"; then PATHS="/lib/modules/$(uname -r)/build" +else + PATHS="/usr/src/linux-headers-$(uname -r)" fi PATHS+=" $DEFAULT_LINUX" for DEFAULT_LINUX_OBJ in $PATHS; do @@ -230,8 +275,6 @@ LB_CHECK_FILE([$LINUX_CONFIG], [], [AC_MSG_ERROR([ Kernel config could not be found. - -If you are building from a kernel-source rpm consult build/README.kernel-source ]) ]) AC_SUBST(LINUX_CONFIG) @@ -243,7 +286,7 @@ LB_CHECK_FILE([/boot/kernel.h], AC_ARG_WITH([kernel-source-header], AC_HELP_STRING([--with-kernel-source-header=path], - [Use a different kernel version header. Consult build/README.kernel-source for details.]), + [Use a different kernel version header.]), [LB_ARG_CANON_PATH([kernel-source-header], [KERNEL_SOURCE_HEADER])]) # ----------- make dep run? ------------------ @@ -390,8 +433,7 @@ LC_MODULE_LOADING AC_DEFUN([LB_USES_DPKG], [ AC_CACHE_CHECK([if this distro uses dpkg], lb_cv_uses_dpkg, [ lb_cv_uses_dpkg="no" -AS_CASE([$(lsb_release -i -s 2>/dev/null)], - [Ubuntu | Debian], [lb_cv_uses_dpkg="yes"]) +AS_CASE([$(which dpkg 2>/dev/null)],[*/dpkg], [lb_cv_uses_dpkg="yes"]) ]) uses_dpkg=$lb_cv_uses_dpkg ]) @@ -474,6 +516,7 @@ config_im_$1, [ m4_define([LB_LANG_PROGRAM], [ #include +#include $1 int main (void) @@ -483,7 +526,8 @@ dnl Don't move the `;' right after for the same reason. $2 ; return 0; -}]) +}; +MODULE_LICENSE("GPL");]) # # LB_LINUX_COMPILE_IFELSE @@ -499,8 +543,8 @@ $2 AC_DEFUN([LB_LINUX_COMPILE_IFELSE], [m4_ifvaln([$1], [AC_LANG_CONFTEST([AC_LANG_SOURCE([$1])])])dnl rm -f build/conftest.o build/conftest.mod.c build/conftest.ko -SUBARCH=$(echo $target_cpu | sed -e 's/powerpc64le/powerpc/' -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/' -e 's/k1om/x86/' -e 's/aarch64/arm64/') -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_CHECK_INCLUDE -I$LINUX/arch/$SUBARCH/include -Iinclude -Iarch/$SUBARCH/include/generated -I$LINUX/include -Iinclude2 -I$LINUX/include/uapi -Iinclude/generated -I$LINUX/arch/$SUBARCH/include/uapi -Iarch/$SUBARCH/include/generated/uapi -I$LINUX/include/uapi -Iinclude/generated/uapi ${SPL_OBJ:+-include $SPL_OBJ/spl_config.h} ${ZFS_OBJ:+-include $ZFS_OBJ/zfs_config.h} ${SPL:+-I$SPL -I$SPL/include } ${ZFS:+-I$ZFS -I$ZFS/include} -include $CONFIG_INCLUDE" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $MODULE_TARGET=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])], +SUBARCH=$(echo $target_cpu | sed -e 's/powerpc.*/powerpc/' -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/' -e 's/k1om/x86/' -e 's/aarch64.*/arm64/' -e 's/armv7.*/arm/') +AS_IF([AC_TRY_COMMAND(cp conftest.c build && make -d [$2] LDFLAGS= ${LD:+LD="$LD"} CC="$CC" -f $PWD/build/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG LINUXINCLUDE="$EXTRA_CHECK_INCLUDE -I$LINUX/arch/$SUBARCH/include -Iinclude -Iarch/$SUBARCH/include/generated -I$LINUX/include -Iinclude2 -I$LINUX/include/uapi -Iinclude/generated -I$LINUX/arch/$SUBARCH/include/uapi -Iarch/$SUBARCH/include/generated/uapi -I$LINUX/include/uapi -Iinclude/generated/uapi ${SPL_OBJ:+-include $SPL_OBJ/spl_config.h} ${ZFS_OBJ:+-include $ZFS_OBJ/zfs_config.h} ${SPL:+-I$SPL -I$SPL/include } ${ZFS:+-I$ZFS -I$ZFS/include} -include $CONFIG_INCLUDE" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $MODULE_TARGET=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])], [$4], [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])dnl])