Whamcloud - gitweb
LU-16322: build: Add client build support for openEuler 87/49187/4
authorXinliang Liu <xinliang.liu@linaro.org>
Wed, 26 Oct 2022 08:58:14 +0000 (08:58 +0000)
committerOleg Drokin <green@whamcloud.com>
Sat, 7 Jan 2023 07:56:33 +0000 (07:56 +0000)
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 <xinliang.liu@linaro.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49187
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
config/lustre-build-linux.m4
contrib/lbuild/funcs.sh
contrib/lbuild/lbuild
contrib/lbuild/lbuild-oe2203 [new file with mode: 0644]
lustre.spec.in
lustre/ChangeLog
lustre/autoconf/lustre-core.m4
lustre/kernel_patches/targets/5.10-oe2203.target.in [new file with mode: 0644]

index 43947bb..8e0c05f 100644 (file)
@@ -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)
index f448e03..949beeb 100644 (file)
@@ -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
 
index d236071..f6a750f 100755 (executable)
@@ -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 (file)
index 0000000..2abdcb6
--- /dev/null
@@ -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
+}
index 16055a7..5384d26 100644 (file)
 # 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}
 %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
index cc70146..de63f6f 100644 (file)
@@ -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),
index 109a90c..2977a4a 100644 (file)
@@ -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 (file)
index 0000000..5ba89d2
--- /dev/null
@@ -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