-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drbd: build dkms package for RPM distros
Also build the DKMS package for RPM distros that support it. This is by default available on amazonlinux, RHEL derived distros can use EPEL to get the required dkms base package. To make the dkms config available for builds, we move it to misc/. One subtle change is that we now have a symlink in debian/ pointing to misc/. The default options for "tar --transform" break this link, as the transformation is also applied to the symlink target. So we have to tell tar to ignore symlink targets for this command.
- Loading branch information
Showing
4 changed files
with
85 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../misc/dkms.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,10 @@ Release: 1 | |
# always require a suitable userland | ||
Requires: drbd-utils >= 9.27.0 | ||
|
||
# Store the version, as later macros may mangle it | ||
%global drbd_version %version | ||
%global tarball_version %(echo "%{version}" | sed -e "s,%{?dist}$,," -e "s,~,-,") | ||
Source: http://oss.linbit.com/drbd/drbd-%{tarball_version}.tar.gz | ||
Source: http://pkg.linbit.com/downloads/drbd/9/drbd-%{tarball_version}.tar.gz | ||
|
||
License: GPLv2+ | ||
Group: System Environment/Kernel | ||
|
@@ -27,6 +29,9 @@ BuildRequires: %kernel_module_package_buildreqs | |
# rpmbuild --with gcov to set GCOV_PROFILE=y for make | ||
%bcond_with gcov | ||
|
||
# rpmbuild --with dkms to build drbd-dkms package | ||
%bcond_with dkms | ||
|
||
# rpmbuild --define "ofed_kernel_dir /usr/src/ofa_kernel/x86_64/4.18.0-147.5.1..." | ||
# to build against an some mlnx-ofa_kernel-devel | ||
%if %{defined ofed_kernel_dir} | ||
|
@@ -38,6 +43,19 @@ BuildRequires: %kernel_module_package_buildreqs | |
%global dash_ofed -ofed | ||
%endif | ||
|
||
%if %{with dkms} | ||
# Define this package here before kernel macros mess with the version | ||
%package -n drbd-dkms | ||
Summary: %{summary} | ||
BuildArch: noarch | ||
Requires: dkms | ||
Requires: /usr/bin/diff | ||
Requires: /usr/bin/patch | ||
|
||
%description -n drbd-dkms | ||
This package contains the sources for DRBD for building with DKMS. | ||
%endif | ||
|
||
%description | ||
This package contains the kernel modules | ||
for the DRBD core and various transports. | ||
|
@@ -174,9 +192,34 @@ xargs -r printf "override %%-16s * weak-updates/%%s\n" \ | |
install -D misc/SECURE-BOOT-KEY-linbit.com.der $RPM_BUILD_ROOT/etc/pki/linbit/SECURE-BOOT-KEY-linbit.com.der | ||
%endif | ||
|
||
%if %{with dkms} | ||
# For DKMS, install the original source | ||
%{__install} -d %{buildroot}%{_usrsrc}/drbd-%{drbd_version}-%{release}/src | ||
%{__install} misc/dkms.conf %{buildroot}%{_usrsrc}/drbd-%{drbd_version}-%{release}/dkms.conf | ||
tar -xvf %{S:0} -C %{buildroot}%{_usrsrc}/drbd-%{drbd_version}-%{release}/src --strip-components=1 drbd-%{tarball_version}/drbd | ||
%endif | ||
|
||
%clean | ||
rm -rf %{buildroot} | ||
|
||
%if %{with dkms} | ||
%files -n drbd-dkms | ||
%{_usrsrc}/drbd-%{drbd_version}-%{release} | ||
|
||
%post -n drbd-dkms | ||
DKMS_NAME=drbd | ||
DKMS_VERSION=%{drbd_version}-%{release} | ||
if [ $1 -gt 1 ] ; then | ||
UPGRADE="1" | ||
fi | ||
/usr/lib/dkms/common.postinst $DKMS_NAME $DKMS_VERSION /usr/share/$DKMS_NAME-$DKMS_VERSION "" $UPGRADE | ||
|
||
%preun -n drbd-dkms | ||
DKMS_NAME=drbd | ||
DKMS_VERSION=%{drbd_version}-%{release} | ||
dkms remove -m $DKMS_NAME -v $DKMS_VERSION --all | ||
%endif | ||
|
||
%changelog | ||
* Mon Nov 18 2024 Philipp Reisner <[email protected]> - 9.2.12 | ||
- New upstream release. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
PACKAGE_VERSION="#MODULE_VERSION#" | ||
PACKAGE_NAME="drbd" | ||
MAKE="make -C src/drbd KDIR=/lib/modules/$kernelver/build" | ||
CLEAN="make -C src/drbd clean KDIR=/lib/modules/$kernelver/build" | ||
AUTOINSTALL="yes" | ||
|
||
BUILT_MODULE_NAME[0]="drbd" | ||
BUILT_MODULE_NAME[1]="drbd_transport_tcp" | ||
BUILT_MODULE_NAME[2]="drbd_transport_lb-tcp" | ||
BUILT_MODULE_LOCATION[0]="./src/drbd/build-current/" | ||
BUILT_MODULE_LOCATION[1]="./src/drbd/build-current/" | ||
BUILT_MODULE_LOCATION[2]="./src/drbd/build-current/" | ||
DEST_MODULE_LOCATION[0]="/kernel/drivers/block/drbd" | ||
DEST_MODULE_LOCATION[1]="/kernel/drivers/block/drbd" | ||
DEST_MODULE_LOCATION[2]="/kernel/drivers/block/drbd" | ||
|
||
IDX=3 | ||
|
||
if grep -q ^CONFIG_INFINIBAND= /lib/modules/$kernelver/build/.config; then | ||
BUILT_MODULE_NAME[$IDX]="drbd_transport_rdma" | ||
BUILT_MODULE_LOCATION[$IDX]="./src/drbd/build-current/" | ||
DEST_MODULE_LOCATION[$IDX]="/kernel/drivers/block/drbd" | ||
IDX=$(($IDX + 1)) | ||
fi | ||
|
||
test -z $BUILD_OFED && | ||
test -e /usr/src/ofa_kernel/default/Module.symvers && | ||
modinfo mlx_compat &>/dev/null && | ||
MAKE+=" BUILD_OFED=1" | ||
|
||
# See drbd/Kbuild: this is that check for the kernel version, but worse: check for kernel >= 4.17 | ||
IFS=".-" read -ra KVER <<< "$kernelver" | ||
if [ "${KVER[0]}" -ge 4 ] && ( [ "${KVER[0]}" -gt 4 ] || [ "${KVER[1]}" -ge 17 ] ) ; then | ||
if grep -q ^CONFIG_TLS= /lib/modules/$kernelver/build/.config && ! grep -q ^CONFIG_NET_HANDSHAKE= /lib/modules/$kernelver/build/.config ; then | ||
BUILT_MODULE_NAME[$IDX]="handshake" | ||
BUILT_MODULE_LOCATION[$IDX]="./src/drbd/build-current/drbd-kernel-compat/handshake" | ||
DEST_MODULE_LOCATION[$IDX]="/kernel/net/handshake" | ||
fi | ||
fi |