From d622b26d8d8a7f13b3a078d4dd58e795b77d232f Mon Sep 17 00:00:00 2001 From: Xinliang Liu Date: Wed, 26 Oct 2022 08:58:14 +0000 Subject: [PATCH] LU-16322: build: Add client build support for openEuler The kernel of current openEuler LTS version 22.03 is based on Linux 5.10.0 which is already supported in Lustre master. Thus we only need to add build support for openEuler client. OpenEuler Linux although is not compatible with RHEL, but it uses the same package manager DNF/tools as RHEL and references the package naming of RHEL. Thus we can reuse most of the RHEL build logic/scripts for openEuler client building. OpenEuler Linux is becoming the mainstream Linux distro in China. So adding support for it makes sense for the users. For more details about it see: https://www.openeuler.org/en/. Test-Parameters: trivial Change-Id: I8e8b59d36e566c6e49b12346c2fde985153f014d Signed-off-by: Xinliang Liu Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49187 Reviewed-by: Oleg Drokin Reviewed-by: Jian Yu Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo --- config/lustre-build-linux.m4 | 20 +++++++++-- contrib/lbuild/funcs.sh | 6 ++++ contrib/lbuild/lbuild | 3 ++ contrib/lbuild/lbuild-oe2203 | 39 ++++++++++++++++++++++ lustre.spec.in | 20 +++++++---- lustre/ChangeLog | 1 + lustre/autoconf/lustre-core.m4 | 1 + .../kernel_patches/targets/5.10-oe2203.target.in | 21 ++++++++++++ 8 files changed, 103 insertions(+), 8 deletions(-) create mode 100644 contrib/lbuild/lbuild-oe2203 create mode 100644 lustre/kernel_patches/targets/5.10-oe2203.target.in diff --git a/config/lustre-build-linux.m4 b/config/lustre-build-linux.m4 index 43947bb..8e0c05f 100644 --- a/config/lustre-build-linux.m4 +++ b/config/lustre-build-linux.m4 @@ -92,6 +92,7 @@ AC_DEFUN([LB_LINUX_RELEASE], [ RHEL_KERNEL="no" SUSE_KERNEL="no" UBUNTU_KERNEL="no" + OPENEULER_KERNEL="no" # And if any of the above kernels has been detected yet KERNEL_FOUND="no" @@ -151,9 +152,23 @@ AC_DEFUN([LB_LINUX_RELEASE], [ ]) ]) + # Check for openEuler + AS_IF([test "x$KERNEL_FOUND" = "xno"], [ + AC_CACHE_CHECK([for openEuler kernel signature], lb_cv_openeuler_kernel_sig, [ + lb_cv_openeuler_kernel_sig="no" + AS_IF([fgrep -q 'openEuler' $LINUX_OBJ/include/linux/kabi.h], [ + lb_cv_openeuler_kernel_sig="yes" + ]) + ]) + AS_IF([test "x$lb_cv_openeuler_kernel_sig" = "xyes"], [ + OPENEULER_KERNEL="yes" + KERNEL_FOUND="yes" + ]) + ]) + # 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 nor Ubuntu]) + AC_MSG_WARN([Kernel Distro seems to be neither RedHat, SuSE, openEuler nor Ubuntu]) ]) AC_MSG_CHECKING([for Linux kernel module package directory]) @@ -163,9 +178,10 @@ AC_DEFUN([LB_LINUX_RELEASE], [ [KMP_MODDIR=$withval IN_KERNEL=''],[ AS_IF([test x$RHEL_KERNEL = xyes], [KMP_MODDIR="extra/kernel"], + [test x$OPENEULER_KERNEL = xyes], [KMP_MODDIR="extra/kernel"], [test x$SUSE_KERNEL = xyes], [KMP_MODDIR="updates/kernel"], [test x$UBUNTU_KERNEL = xyes], [KMP_MODDIR="updates/kernel"], - [AC_MSG_WARN([Kernel Distro seems to be neither RedHat, SuSE nor Ubuntu])] + [AC_MSG_WARN([Kernel Distro seems to be neither RedHat, SuSE, openEuler nor Ubuntu])] ) IN_KERNEL="${PACKAGE}"]) AC_MSG_RESULT($KMP_MODDIR) diff --git a/contrib/lbuild/funcs.sh b/contrib/lbuild/funcs.sh index f448e03..949beeb 100644 --- a/contrib/lbuild/funcs.sh +++ b/contrib/lbuild/funcs.sh @@ -154,6 +154,11 @@ autodetect_distro() { "Fedora") name="fc" ;; + "openEuler") + name="oe" + # Change from YY.MM to YYMM, let DISTROMAJ contain MM part + version=${version/./} + ;; *) fatal 1 "I don't know what distro name $name and version $version is.\nEither update autodetect_distro() or use the --distro argument." ;; @@ -205,6 +210,7 @@ autodetect_target() { sles15.3) target="$(uname -r | cut -d . -f 1,2)-sles15sp3";; sles15.4) target="$(uname -r | cut -d . -f 1,2)-sles15sp4";; fc18) target="3.x-fc18";; + oe2203) target="5.10-oe2203";; *) fatal 1 "I don't know what distro $distro is.\nEither update autodetect_target() or use the --target argument.";; esac diff --git a/contrib/lbuild/lbuild b/contrib/lbuild/lbuild index d236071..f6a750f 100755 --- a/contrib/lbuild/lbuild +++ b/contrib/lbuild/lbuild @@ -329,6 +329,9 @@ check_options() { 3.0-sles11) CANONICAL_TARGET="sles11" ;; + 5.10-oe2203) + CANONICAL_TARGET="oe2203" + ;; esac local timestampnodig=$(echo $TIMESTAMP | sed -e s/[0-9]*//g) diff --git a/contrib/lbuild/lbuild-oe2203 b/contrib/lbuild/lbuild-oe2203 new file mode 100644 index 0000000..2abdcb6 --- /dev/null +++ b/contrib/lbuild/lbuild-oe2203 @@ -0,0 +1,39 @@ +source ${LBUILD_DIR}/lbuild-rhel + +# increment this if you have made a change that should force a new kernel +# to build built +BUILD_GEN+=".0" + +SPEC_NAME="kernel.spec" +DEVEL_PATH_ARCH_DELIMETER="." +USE_KABI=false +RPM_HELPERS_DIR="/usr/lib/rpm/openEuler" + +# force local definition of %dist into ~/.rpmmacros +# to avoid verbose extended strings like ".el9.centos" +# in kernel version and rpm names +# +RMAC=$HOME/.rpmmacros +grep '^%dist' $RMAC &> /dev/null || echo '%dist .oe2203' >> $RMAC + +unpack_linux_devel_rpm-oe2203() { + local callers_rpm="$1" + + unpack_linux_devel_rpm-rhel "$callers_rpm" +} + +find_linux_rpm-oe2203() { + local prefix="$1" + local wanted_kernel="$2" + local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"} + + find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms" +} + +apply_kmod_requires_conflicts() { + if $PATCHLESS; then + # don't allow the patched kernel to be considered as + # a valid kernel for the patchless client + echo "Conflicts: kernel-lustre" >> rpm/kmp-lustre.preamble + fi +} diff --git a/lustre.spec.in b/lustre.spec.in index 16055a7..5384d26 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -136,7 +136,7 @@ # requires want to set a version including epoch %global krequires %(echo %{kver} | sed -e 's/\.x86_64$//' -e 's/\.i[3456]86$//' -e 's/-smp$//' -e 's/-bigsmp$//' -e 's/[-.]ppc64$//' -e 's/\.aarch64$//' -e 's/-default$//' -e 's/-%{_flavor}//') -%if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora" +%if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora" || "%{_vendor}" == "openEuler" %global requires_kmod_name kmod-%{lustre_name} %global requires_kmod_osd_zfs_name kmod-%{lustre_name}-osd-zfs %if %{with lustre_tests} @@ -175,6 +175,11 @@ %define with_systemd 1 %endif +# openEuler comes with systemd +%if "%{_vendor}" == "openEuler" +%define with_systemd 1 +%endif + %{!?mpi_name: %global mpi_name openmpi} Summary: Lustre File System @@ -207,6 +212,9 @@ BuildRequires: libtool libyaml-devel zlib-devel libnl3-devel flex bison BuildRequires: redhat-rpm-config BuildRequires: pkgconfig %else +%if "%{_vendor}" == "openEuler" +BuildRequires: openEuler-rpm-config +%endif BuildRequires: pkg-config %endif %if %{with gss} @@ -220,20 +228,20 @@ Provides: lustre-server = %{version}-%{release} %endif Obsoletes: lustre-client < %{version} Provides: lustre-client = %{version}-%{release} -%if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora" +%if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora" || "%{_vendor}" == "openEuler" #suse don't support selinux BuildRequires: libselinux-devel %endif %if %{with lustre_modules} %if %{with mofed} BuildRequires: mlnx-ofa_kernel-devel -%if "%{_vendor}" == "redhat" +%if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler" Requires: kmod-mlnx-ofa_kernel %else Requires: mlnx-ofa_kernel-kmp %endif %endif -%if 0%{?rhel} >= 8 +%if 0%{?rhel} >= 8 || "%{_vendor}" == "openEuler" BuildRequires: kernel-rpm-macros %endif %if 0%{?suse_version} >= 1530 @@ -381,7 +389,7 @@ Requires: attr, rsync, perl, lsof, /usr/bin/getconf BuildRequires: mpich-devel %endif %if "%{mpi_name}" == "openmpi" -%if "%{_vendor}" == "redhat" || 0%{?suse_version} < 1500 +%if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler" || 0%{?suse_version} < 1500 BuildRequires: openmpi-devel %else BuildRequires: openmpi2-devel @@ -633,7 +641,7 @@ echo '%{_sysconfdir}/ha.d/resource.d/Lustre' >>lustre.files echo '%{_unitdir}/lnet.service' >>lustre.files %endif -%if "%{_vendor}" == "redhat" +%if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler" # The following scripts are Red Hat specific %if %{with servers} echo '%{_sysconfdir}/init.d/lustre' >>lustre.files diff --git a/lustre/ChangeLog b/lustre/ChangeLog index cc70146..de63f6f 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -58,6 +58,7 @@ TBD Whamcloud 5.8.0-53 (Ubuntu 20.04.2 HWE) 5.11.0-31 (Ubuntu 20.04.3 HWE) 5.11.0 (vanilla kernel.org) + 5.10.0-60.56.0.84.oe2203 (openEuler 22.03 LTS) * Recommended e2fsprogs version: 1.46.5.wc1 or newer * Recommended ZFS version: 2.1.5 * NFS export disabled when stack size < 8192 (32-bit Lustre clients), diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 109a90c..2977a4a 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -3412,6 +3412,7 @@ lustre/kernel_patches/targets/5.3-sles15sp2.target lustre/kernel_patches/targets/5.3-sles15sp3.target lustre/kernel_patches/targets/5.14-sles15sp4.target lustre/kernel_patches/targets/3.x-fc18.target +lustre/kernel_patches/targets/5.10-oe2203.target lustre/ldlm/Makefile lustre/ldlm/autoMakefile lustre/ec/autoMakefile diff --git a/lustre/kernel_patches/targets/5.10-oe2203.target.in b/lustre/kernel_patches/targets/5.10-oe2203.target.in new file mode 100644 index 0000000..5ba89d2 --- /dev/null +++ b/lustre/kernel_patches/targets/5.10-oe2203.target.in @@ -0,0 +1,21 @@ +lnxmaj="5.10.0" +lnxrel="60.56.0.84.oe2203" + +KERNEL_SRPM=kernel-${lnxmaj}-${lnxrel}.src.rpm +SERIES="" +EXTRA_VERSION=${lnxrel}_lustre.@VERSION@ +LUSTRE_VERSION=@VERSION@ + +DEVEL_PATH_ARCH_DELIMETER="." +OFED_VERSION=inkernel + +#SMP_ARCHS="i686 x86_64 ia64 ppc64" +# openEuler doesn't use smp specific kernels +SMP_ARCHS="" + +for cc in gcc ; do + if which $cc >/dev/null 2>/dev/null ; then + export CC=$cc + break + fi +done -- 1.8.3.1