|
|
3b6e9c |
%global commit 3f9bde55d3d6bd6083af31a11eb2ac066904f581
|
|
|
3b6e9c |
%global gittag 8.1.0.316
|
|
|
3b6e9c |
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
|
|
530be8 |
%define spec_release 8
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%define kmod_name kvdo
|
|
|
3b6e9c |
%define kmod_driver_version %{gittag}
|
|
|
3b6e9c |
%define kmod_rpm_release %{spec_release}
|
|
|
530be8 |
%define kmod_kernel_version 5.14.0-31.el9
|
|
|
3b6e9c |
%define kmod_headers_version %(rpm -qa kernel-devel | sed 's/^kernel-devel-//')
|
|
|
3b6e9c |
%define kmod_kbuild_dir .
|
|
|
3b6e9c |
%define kmod_devel_package 0
|
|
|
3b6e9c |
|
|
|
3b6e9c |
Source0: https://github.com/dm-vdo/%{kmod_name}/archive/%{commit}/%{kmod_name}-%{shortcommit}.tar.gz
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%define findpat %( echo "%""P" )
|
|
|
3b6e9c |
|
|
|
3b6e9c |
Name: kmod-kvdo
|
|
|
3b6e9c |
Version: %{kmod_driver_version}
|
|
|
3b6e9c |
Release: %{kmod_rpm_release}%{?dist}
|
|
|
3b6e9c |
Summary: Kernel Modules for Virtual Data Optimizer
|
|
|
3b6e9c |
License: GPLv2+
|
|
|
3b6e9c |
URL: http://github.com/dm-vdo/kvdo
|
|
|
3b6e9c |
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
|
|
3b6e9c |
BuildRequires: elfutils-libelf-devel
|
|
|
3b6e9c |
BuildRequires: glibc
|
|
|
3b6e9c |
BuildRequires: kernel-devel >= %{kmod_kernel_version}
|
|
|
3b6e9c |
|
|
|
3b6e9c |
# Disable the kernel-debug requirement for now
|
|
|
3b6e9c |
|
|
|
3b6e9c |
BuildRequires: libuuid-devel
|
|
|
3b6e9c |
BuildRequires: redhat-rpm-config
|
|
|
3b6e9c |
ExcludeArch: i686
|
|
|
3b6e9c |
ExcludeArch: ppc
|
|
|
3b6e9c |
ExcludeArch: ppc64
|
|
|
3b6e9c |
ExcludeArch: s390
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%global kernel_source() /usr/src/kernels/%{kmod_headers_version}
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%global _use_internal_dependency_generator 0
|
|
|
3b6e9c |
Provides: kernel-modules = %{kmod_kernel_version}.%{_target_cpu}
|
|
|
3b6e9c |
Provides: kmod-%{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
|
|
|
3b6e9c |
Requires(post): %{_sbindir}/weak-modules
|
|
|
3b6e9c |
Requires(postun): %{_sbindir}/weak-modules
|
|
|
3b6e9c |
Requires: kernel >= %{kmod_kernel_version}
|
|
|
3b6e9c |
Requires: kernel-core-uname-r >= %{kmod_kernel_version}
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%description
|
|
|
3b6e9c |
Virtual Data Optimizer (VDO) is a device mapper target that delivers
|
|
|
3b6e9c |
block-level deduplication, compression, and thin provisioning.
|
|
|
3b6e9c |
|
|
|
3b6e9c |
This package provides the kernel modules for VDO.
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%pre
|
|
|
3b6e9c |
# During the install, check whether kvdo or uds is loaded. A warning here
|
|
|
3b6e9c |
# indicates that a previous install was not completely removed. This message
|
|
|
3b6e9c |
# is purely informational to the user.
|
|
|
3b6e9c |
for module in kvdo uds; do
|
|
|
3b6e9c |
if grep -q "^${module}" /proc/modules; then
|
|
|
3b6e9c |
if [ "${module}" == "kvdo" ]; then
|
|
|
3b6e9c |
echo "WARNING: Found ${module} module previously loaded (Version: $(cat /sys/kvdo/version 2>/dev/null || echo Unknown)). A reboot is recommended before attempting to use the newly installed module."
|
|
|
3b6e9c |
else
|
|
|
3b6e9c |
echo "WARNING: Found ${module} module previously loaded. A reboot is recommended before attempting to use the newly installed module."
|
|
|
3b6e9c |
fi
|
|
|
3b6e9c |
fi
|
|
|
3b6e9c |
done
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%post
|
|
|
3b6e9c |
modules=( $(find /lib/modules/%{kmod_headers_version}/extra/kmod-%{kmod_name} | grep '\.ko$') )
|
|
|
3b6e9c |
printf '%s\n' "${modules[@]}" >> /var/lib/rpm-kmod-posttrans-weak-modules-add
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%pretrans -p <lua>
|
|
|
3b6e9c |
posix.unlink("/var/lib/rpm-kmod-posttrans-weak-modules-add")
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%posttrans
|
|
|
3b6e9c |
if [ -f "/var/lib/rpm-kmod-posttrans-weak-modules-add" ]; then
|
|
|
3b6e9c |
modules=( $(cat /var/lib/rpm-kmod-posttrans-weak-modules-add) )
|
|
|
3b6e9c |
rm -rf /var/lib/rpm-kmod-posttrans-weak-modules-add
|
|
|
3b6e9c |
printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --dracut=/usr/bin/dracut --add-modules
|
|
|
3b6e9c |
fi
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%preun
|
|
|
3b6e9c |
rpm -ql kmod-kvdo-%{kmod_driver_version}-%{kmod_rpm_release}%{?dist}.$(arch) | grep '\.ko$' > /var/run/rpm-kmod-%{kmod_name}-modules
|
|
|
3b6e9c |
# Check whether kvdo or uds is loaded, and if so attempt to remove it. A
|
|
|
3b6e9c |
# failure to unload means there is still something using the module. To make
|
|
|
3b6e9c |
# sure the user is aware, we print a warning with recommended instructions.
|
|
|
3b6e9c |
for module in kvdo uds; do
|
|
|
3b6e9c |
if grep -q "^${module}" /proc/modules; then
|
|
|
3b6e9c |
warnMessage="WARNING: ${module} in use. Changes will take effect after a reboot."
|
|
|
3b6e9c |
modprobe -r ${module} 2>/dev/null || echo ${warnMessage} && /usr/bin/true
|
|
|
3b6e9c |
fi
|
|
|
3b6e9c |
done
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%postun
|
|
|
3b6e9c |
modules=( $(cat /var/run/rpm-kmod-%{kmod_name}-modules) )
|
|
|
3b6e9c |
rm /var/run/rpm-kmod-%{kmod_name}-modules
|
|
|
3b6e9c |
printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --dracut=/usr/bin/dracut --remove-modules
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%files
|
|
|
3b6e9c |
%defattr(644,root,root,755)
|
|
|
3b6e9c |
/lib/modules/%{kmod_headers_version}
|
|
|
3b6e9c |
/etc/depmod.d/%{kmod_name}.conf
|
|
|
3b6e9c |
/usr/share/doc/kmod-%{kmod_name}/greylist.txt
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%prep
|
|
|
3b6e9c |
%setup -n %{kmod_name}-%{commit}
|
|
|
3b6e9c |
%{nil}
|
|
|
3b6e9c |
set -- *
|
|
|
3b6e9c |
mkdir source
|
|
|
3b6e9c |
mv "$@" source/
|
|
|
3b6e9c |
mkdir obj
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%build
|
|
|
3b6e9c |
rm -rf obj
|
|
|
3b6e9c |
cp -r source obj
|
|
|
3b6e9c |
make -C %{kernel_source} M=$PWD/obj/%{kmod_kbuild_dir} V=1 \
|
|
|
3b6e9c |
NOSTDINC_FLAGS="-I $PWD/obj/include -I $PWD/obj/include/uapi"
|
|
|
3b6e9c |
# mark modules executable so that strip-to-file can strip them
|
|
|
3b6e9c |
find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -exec chmod u+x '{}' +
|
|
|
3b6e9c |
|
|
|
3b6e9c |
whitelist="/lib/modules/kabi-current/kabi_whitelist_%{_target_cpu}"
|
|
|
3b6e9c |
|
|
|
3b6e9c |
for modules in $( find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -printf "%{findpat}\n" | sed 's|\.ko$||' | sort -u ) ; do
|
|
|
3b6e9c |
# update depmod.conf
|
|
|
3b6e9c |
module_weak_path=$(echo $modules | sed 's/[\/]*[^\/]*$//')
|
|
|
3b6e9c |
if [ -z "$module_weak_path" ]; then
|
|
|
3b6e9c |
module_weak_path=%{name}
|
|
|
3b6e9c |
else
|
|
|
3b6e9c |
module_weak_path=%{name}/$module_weak_path
|
|
|
3b6e9c |
fi
|
|
|
3b6e9c |
echo "override $(echo $modules | sed 's/.*\///') $(echo %{kmod_headers_version} | sed 's/\.[^\.]*$//').* weak-updates/$module_weak_path" >> source/depmod.conf
|
|
|
3b6e9c |
|
|
|
3b6e9c |
# update greylist
|
|
|
3b6e9c |
nm -u obj/%{kmod_kbuild_dir}/$modules.ko | sed 's/.*U //' | sed 's/^\.//' | sort -u | while read -r symbol; do
|
|
|
3b6e9c |
grep -q "^\s*$symbol\$" $whitelist || echo "$symbol" >> source/greylist
|
|
|
3b6e9c |
done
|
|
|
3b6e9c |
done
|
|
|
3b6e9c |
sort -u source/greylist | uniq > source/greylist.txt
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%install
|
|
|
3b6e9c |
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
|
|
|
3b6e9c |
export INSTALL_MOD_DIR=extra/%{name}
|
|
|
3b6e9c |
make -C %{kernel_source} modules_install V=1 \
|
|
|
3b6e9c |
M=$PWD/obj/%{kmod_kbuild_dir}
|
|
|
3b6e9c |
# Cleanup unnecessary kernel-generated module dependency files.
|
|
|
3b6e9c |
find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \;
|
|
|
3b6e9c |
|
|
|
3b6e9c |
install -m 644 -D source/depmod.conf $RPM_BUILD_ROOT/etc/depmod.d/%{kmod_name}.conf
|
|
|
3b6e9c |
install -m 644 -D source/greylist.txt $RPM_BUILD_ROOT/usr/share/doc/kmod-%{kmod_name}/greylist.txt
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%clean
|
|
|
3b6e9c |
rm -rf $RPM_BUILD_ROOT
|
|
|
3b6e9c |
|
|
|
3b6e9c |
%changelog
|
|
|
530be8 |
* Wed Dec 15 2021 - Andy Walsh <awalsh@redhat.com> - 8.1.0.316-8
|
|
|
530be8 |
- Rebuilt for latest kernel.
|
|
|
530be8 |
- Related: rhbz#2000926
|
|
|
530be8 |
|
|
|
530be8 |
* Tue Dec 07 2021 - Andy Walsh <awalsh@redhat.com> - 8.1.0.316-7
|
|
|
530be8 |
- Rebuilt for latest kernel.
|
|
|
530be8 |
- Related: rhbz#2000926
|
|
|
530be8 |
|
|
|
530be8 |
* Tue Dec 07 2021 - Andy Walsh <awalsh@redhat.com> - 8.1.0.316-6
|
|
|
530be8 |
- Rebuilt for latest kernel.
|
|
|
530be8 |
- Related: rhbz#2000926
|
|
|
530be8 |
|
|
|
d5d045 |
* Thu Nov 11 2021 - Andy Walsh <awalsh@redhat.com> - 8.1.0.316-5
|
|
|
3b6e9c |
- Rebuilt for latest kernel.
|
|
|
d5d045 |
- Related: rhbz#2000926
|
|
|
3b6e9c |
|
|
|
d5d045 |
* Wed Oct 13 2021 - Andy Walsh <awalsh@redhat.com> - 8.1.0.316-4
|
|
|
3b6e9c |
- Rebuilt for latest kernel.
|
|
|
d5d045 |
- Related: rhbz#2000926
|
|
|
d5d045 |
|
|
|
d5d045 |
* Thu Sep 30 2021 - Andy Walsh <awalsh@redhat.com> - 8.1.0.316-3
|
|
|
d5d045 |
- Rebuilt for latest kernel.
|
|
|
d5d045 |
- Related: rhbz#2000926
|
|
|
3b6e9c |
|
|
|
3b6e9c |
* Mon Aug 09 2021 - Andy Walsh <awalsh@redhat.com> - 8.1.0.316-2
|
|
|
3b6e9c |
- Rebased to upstream candidate.
|
|
|
3b6e9c |
- Resolves: rhbz#1955374
|
|
|
3b6e9c |
|
|
|
3b6e9c |
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 8.1.0.316-1.1
|
|
|
3b6e9c |
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
|
|
3b6e9c |
Related: rhbz#1991688
|
|
|
3b6e9c |
|
|
|
3b6e9c |
* Sat Aug 07 2021 - Andy Walsh <awalsh@redhat.com> - 8.1.0.316-1
|
|
|
3b6e9c |
- Rebased to upstream candidate.
|
|
|
3b6e9c |
- Resolves: rhbz#1955374
|
|
|
3b6e9c |
|
|
|
3b6e9c |
* Thu Jul 29 2021 - Andy Walsh <awalsh@redhat.com> - 8.1.0.264-1
|
|
|
3b6e9c |
- Rebased to upstream candidate.
|
|
|
3b6e9c |
- Related: rhbz#1955374
|
|
|
3b6e9c |
- Fixed GCC implicit-fallthrough errors when building for latest kernel
|
|
|
3b6e9c |
- Resolves: rhbz#1984814
|
|
|
3b6e9c |
|
|
|
3b6e9c |
* Tue May 04 2021 - Andy Walsh <awalsh@redhat.com> - 8.1.0.4-1
|
|
|
3b6e9c |
- Initial build for EL9
|
|
|
3b6e9c |
- Related: rhbz#1955374
|