From d37b0ab99eaeeac391088848c275d2757b6ff17d Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Wed, 22 May 2019 12:24:14 -0700 Subject: [PATCH] LU-12269 kernel: new kernel [RHEL 8.0 4.18.0-80.el8] This patch makes changes to support new RHEL 8.0 release for Lustre client. Test-Parameters: trivial Change-Id: I89b4f1e59f8b25bf9d37d3564e2d05d6e87d9b38 Signed-off-by: Jian Yu Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/34862 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: Li Dongyang Reviewed-by: Oleg Drokin --- contrib/lbuild/funcs.sh | 1 + contrib/lbuild/lbuild | 3 + contrib/lbuild/lbuild-rhel8 | 128 +++++++++++++++++++++ contrib/lbuild/rhel8/.gitignore | 2 + contrib/lbuild/rhel8/kmodtool.patch | 17 +++ contrib/lbuild/rhel8/rpmmacros.template | 36 ++++++ contrib/scripts/gerrit_checkpatch.py | 2 +- lustre-dkms.spec.in | 2 +- lustre/ChangeLog | 1 + lustre/autoconf/lustre-core.m4 | 1 + lustre/kernel_patches/targets/4.18-rhel8.target.in | 26 +++++ lustre/scripts/zfsobj2fid | 2 +- 12 files changed, 218 insertions(+), 3 deletions(-) create mode 100644 contrib/lbuild/lbuild-rhel8 create mode 100644 contrib/lbuild/rhel8/.gitignore create mode 100644 contrib/lbuild/rhel8/kmodtool.patch create mode 100644 contrib/lbuild/rhel8/rpmmacros.template create mode 100644 lustre/kernel_patches/targets/4.18-rhel8.target.in diff --git a/contrib/lbuild/funcs.sh b/contrib/lbuild/funcs.sh index 88788ae..be8f696 100644 --- a/contrib/lbuild/funcs.sh +++ b/contrib/lbuild/funcs.sh @@ -198,6 +198,7 @@ autodetect_target() { rhel6.6) target="2.6-rhel6.6";; rhel6*) target="2.6-rhel6";; rhel7*) target="3.10-rhel7";; + rhel8*) target="4.18-rhel8";; sles10*) target="2.6-sles10";; sles11.4) target="$(uname -r | cut -d . -f 1,2)-sles11sp4";; sles11.3) target="$(uname -r | cut -d . -f 1,2)-sles11sp3";; diff --git a/contrib/lbuild/lbuild b/contrib/lbuild/lbuild index 707cda3..7acbb3f 100755 --- a/contrib/lbuild/lbuild +++ b/contrib/lbuild/lbuild @@ -317,6 +317,9 @@ check_options() { 3.12-sles12 | 4.4-sles12) CANONICAL_TARGET="sles12" ;; + 4.18-rhel8*) + CANONICAL_TARGET="rhel8" + ;; 3.10-rhel7*) CANONICAL_TARGET="rhel7" ;; diff --git a/contrib/lbuild/lbuild-rhel8 b/contrib/lbuild/lbuild-rhel8 new file mode 100644 index 0000000..d70a238 --- /dev/null +++ b/contrib/lbuild/lbuild-rhel8 @@ -0,0 +1,128 @@ +# vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4: + +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 + +# force local definition of %dist into ~/.rpmmacros +# to avoid verbose extended strings like ".el8.centos" +# in kernel version and rpm names +# +RMAC=$HOME/.rpmmacros +grep '^%dist' $RMAC &> /dev/null || echo '%dist .el8' >> $RMAC + +# We modify the RHEL8 kmodtool script, because it expects +# the kernel source to be in the correct packaged RHEL location. +# lbuild does not put the source in correct packaged RHEL location. +RHEL_KMODTOOL=/usr/lib/rpm/redhat/kmodtool +LBUILD_KMODTOOL="${LBUILD_DIR}/rhel8/kmodtool" +cp $RHEL_KMODTOOL $LBUILD_KMODTOOL +pushd ${LBUILD_DIR}/rhel8 +patch -p1 < kmodtool.patch +# Replace the hardcoded /usr/src/kernels with our build path +tmp="${TOPDIR}/reused/usr/src/kernels" +tmp="${tmp//\//\\/}" +sed -i "s/\/usr\/src\/kernels/${tmp}/g" ${LBUILD_DIR}/rhel8/kmodtool +chmod 755 kmodtool +popd +# Next we replace %kernel_module_package with one that is nearly +# identical, but calls lbuild's modified kmodtool script. +# We need to cleanout the previous entry +sed -i "/^%kernel_module_package/,/^)}$/d" $RMAC +sed -e "s|REPLACE_ME|$LBUILD_KMODTOOL|" -e "s/\/usr\/src\/kernels/${tmp}/g" \ + ${LBUILD_DIR}/rhel8/rpmmacros.template > ${LBUILD_DIR}/rhel8/rpmmacros +cat ${LBUILD_DIR}/rhel8/rpmmacros >> $RMAC + +patch_spec() { + local buildid="$1" + + # the el8 .spec file requires patch names to begin with "patch-3." + # so rename the lustre patch from lbuild to one the .spec will like + mv $TOPDIR/SOURCES/linux-${lnxmaj}-lustre.patch \ + $TOPDIR/SOURCES/patch-${lnxmaj}-lustre.patch + + # edit the SPEC with our changes + patch_spec_common "$buildid" + sed -i -e '/^# empty final patch to facilitate testing of kernel patches/i\ +# adds Lustre patches\ +Patch99995: patch-%{version}-lustre.patch' \ + -e '/^ApplyOptionalPatch linux-kernel-test.patch/i\ +\ +# lustre patch\ +ApplyOptionalPatch patch-%{version}-lustre.patch\ +' \ + -e '/rm -f include\/generated\/kernel.cross/i\ + # lustre kernel config.\ + if [ -f %{_topdir}/lustre/lustre/kernel_patches/kernel_configs/kernel-%{version}-4.18-rhel8-%{_target_cpu}.config ]; then\ + echo "# $Arch" > configs/kernel-%{version}-%{_target_cpu}.config\ + cat %{_topdir}/lustre/lustre/kernel_patches/kernel_configs/kernel-%{version}-4.18-rhel8-%{_target_cpu}.config >> configs/kernel-%{version}-%{_target_cpu}.config\ + fi'\ + -e '/^# Dynamically generate kernel/a echo "CONFIG_BH_LRU_SIZE=16" >> config-generic'\ + -e '/^%define listnewconfig_fail 1/s/1/0/'\ + SPECS/$SPEC_NAME 2>&1 || \ + fatal 1 "Error while editing SPECS/$SPEC_NAME" + + + return 0 + +} + +unpack_linux_devel_rpm-rhel8() { + local callers_rpm="$1" + + unpack_linux_devel_rpm-rhel "$callers_rpm" + + + return 0 + +} + +get_rpmbuildopts() { + + if $KERNEL_LUSTRE_NAMING; then + echo -e "--define \"variant -lustre\" \c" + fi + echo "--with firmware" + + return 0 + +} + +find_linux_rpm-rhel8() { + local prefix="$1" + local wanted_kernel="$2" + local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"} + + find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms" + +} + +kernel_srpm_location() { + + echo "http://vault.centos.org/centos/8/updates/Source/SPackages/" + +} + +kernel_debuginfo_location() { + + echo "http://debuginfo.centos.org/8/x86_64/" + +} + +cleanup_rpmmacros() { + sed -i "/^%kernel_module_package/,/^)}$/d" $RMAC +} + +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/contrib/lbuild/rhel8/.gitignore b/contrib/lbuild/rhel8/.gitignore new file mode 100644 index 0000000..a4c26d4 --- /dev/null +++ b/contrib/lbuild/rhel8/.gitignore @@ -0,0 +1,2 @@ +kmodtool +rpmmacros diff --git a/contrib/lbuild/rhel8/kmodtool.patch b/contrib/lbuild/rhel8/kmodtool.patch new file mode 100644 index 0000000..52ce2c1 --- /dev/null +++ b/contrib/lbuild/rhel8/kmodtool.patch @@ -0,0 +1,17 @@ +lbuild does not install the kernel source in the standard RHEL7 location. +RHEL's kmodtool (starting in RHEL7) expects the source to be in the standard +location, and when it fails to find it it adds an extra $arch onto the end +of verrel. With lbuild, verrel already contains the arch, so we change the +kmodtool script so that it does not add another. + +--- old/kmodtool 2016-06-07 14:36:20.810907740 -0700 ++++ new/kmodtool 2016-06-07 14:37:55.335652424 -0700 +@@ -62,7 +62,7 @@ get_kernel_release () + local versuffix=${verrel#$verprefix} + verrel=$(ls -Ud /usr/src/kernels/$verprefix*$versuffix.$arch | sort -V | tail -n 1) + verrel=${verrel##*/} +- [[ -z $verrel ]] && verrel=$1.$arch ++ [[ -z $verrel ]] && verrel=$1 + echo "$verrel" + } + diff --git a/contrib/lbuild/rhel8/rpmmacros.template b/contrib/lbuild/rhel8/rpmmacros.template new file mode 100644 index 0000000..e34f609 --- /dev/null +++ b/contrib/lbuild/rhel8/rpmmacros.template @@ -0,0 +1,36 @@ +%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \ + %global kmodtool %{-s*}%{!-s:REPLACE_ME} \ + %global kmod_version %{-v*}%{!-v:%{version}} \ + %global kmod_release %{-r*}%{!-r:%{release}} \ + %global latest_kernel %(rpm -q --qf '%{VERSION}-%{RELEASE}.%{ARCH}\\\\n' `rpm -q kernel-devel | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1) \ + %{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \ + %global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \ + flavors="default" \ + if [ -z "%*" ]; then \ + flavors_to_build=$flavors \ + elif [ -z "%{-x}" ]; then \ + flavors_to_build="%*" \ + else \ + flavors_to_build=" $flavors "\ + for i in %* \ + do \ + flavors_to_build=${flavors_to_build//$i /} + done \ + fi \ + echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \ + echo "%%global kernel_source() /usr/src/kernels/%kverrel\\\$([ %%%%{1} = default ] || echo ".%%%%{1}")" \ + echo "%%global kernel_module_package_moddir() extra" \ + if [ ! -z "%{-f*}" ] \ + then \ + filelist="%{-f*}" \ + fi \ + if [ ! -z "%{-p*}" ] \ + then \ + preamble="%{-p*}" \ + fi \ + if [ -z "%{kmodtool_generate_buildreqs}" ] \ + then \ + nobuildreqs="yes" \ + fi \ + override_filelist="$filelist" override_preamble="$preamble" nobuildreqs="$nobuildreqs" kmod_version=%kmod_version kmod_release=%kmod_release %{kmodtool} rpmtemplate %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \ +)} diff --git a/contrib/scripts/gerrit_checkpatch.py b/contrib/scripts/gerrit_checkpatch.py index 28b0073..9dbf138 100755 --- a/contrib/scripts/gerrit_checkpatch.py +++ b/contrib/scripts/gerrit_checkpatch.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # # GPL HEADER START # diff --git a/lustre-dkms.spec.in b/lustre-dkms.spec.in index 76ecf36..e93c851 100644 --- a/lustre-dkms.spec.in +++ b/lustre-dkms.spec.in @@ -26,7 +26,7 @@ %if %{_vendor}=="redhat" || %{_vendor}=="fedora" %global kmod_name kmod-%{lustre_name} - %define mkconf_options + %define mkconf_options %{nil} %else #for Suse / Ubuntu %global kmod_name %{lustre_name}-kmp %define mkconf_options "-k updates" diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 049c909..513d81b 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -19,6 +19,7 @@ TBD Whamcloud 3.10.0-957.12.1.el7 (RHEL7.6) 4.14.0-49.13.1.el7a (RHEL7.5) 4.14.0-115.2.2.el7a (RHEL7.6) + 4.18.0-80.el8 (RHEL8.0) 4.4.120-92.70 (SLES12 SP2) 4.4.176-94.88 (SLES12 SP3) 4.12.14-95.13 (SLES12 SP4) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index db957d7..45271d6 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -3633,6 +3633,7 @@ lustre/doc/Makefile lustre/include/Makefile lustre/include/lustre/Makefile lustre/include/uapi/linux/lustre/Makefile +lustre/kernel_patches/targets/4.18-rhel8.target lustre/kernel_patches/targets/3.10-rhel7.6.target lustre/kernel_patches/targets/3.10-rhel7.5.target lustre/kernel_patches/targets/4.14-rhel7.5.target diff --git a/lustre/kernel_patches/targets/4.18-rhel8.target.in b/lustre/kernel_patches/targets/4.18-rhel8.target.in new file mode 100644 index 0000000..ec52c4f --- /dev/null +++ b/lustre/kernel_patches/targets/4.18-rhel8.target.in @@ -0,0 +1,26 @@ +lnxmaj="4.18.0" +lnxrel="80.el8" + +KERNEL_SRPM=kernel-${lnxmaj}-${lnxrel}.src.rpm +SERIES="" +EXTRA_VERSION=${lnxrel}_lustre.@VERSION@ +LUSTRE_VERSION=@VERSION@ + +DEVEL_PATH_ARCH_DELIMETER="." +OFED_VERSION=inkernel + +BASE_ARCHS="i686 x86_64 ia64 ppc64" +BIGMEM_ARCHS="" +BOOT_ARCHS="" +JENSEN_ARCHS="" +#SMP_ARCHS="i686 x86_64 ia64 ppc64" +# RHEL8 doesn't use smp specific kernels +SMP_ARCHS="" +UP_ARCHS="" + +for cc in gcc ; do + if which $cc >/dev/null 2>/dev/null ; then + export CC=$cc + break + fi +done diff --git a/lustre/scripts/zfsobj2fid b/lustre/scripts/zfsobj2fid index e229e29..f7ae96b 100755 --- a/lustre/scripts/zfsobj2fid +++ b/lustre/scripts/zfsobj2fid @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # Copyright (c) 2014, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. -- 1.8.3.1