-
Notifications
You must be signed in to change notification settings - Fork 1
/
kmod-erofs.spec
95 lines (75 loc) · 3.36 KB
/
kmod-erofs.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
%define kmod_name erofs
%define kmod_driver_version 1
%define kmod_kernel_version 3.10.0-123.el7
%define kmod_headers_version %(rpm -qa kernel-devel | sed 's/^kernel-devel-//' | head -n1)
%define erofs_kcfgs CONFIG_EROFS_FS_XATTR=y CONFIG_EROFS_FS_SECURITY=y CONFIG_EROFS_FS_POSIX_ACL=y
Name: kmod-erofs
Version: %{kmod_driver_version}
Release: 1%{?dist}
Summary: Kernel Modules for EROFS filesystem driver
License: GPLv2
URL: https://erofs.docs.kernel.org
Source0: kmod-%{kmod_name}-%{kmod_driver_version}.tar.gz
BuildRequires: kernel-abi-whitelists >= %{kmod_kernel_version}
BuildRequires: kernel-devel >= %{kmod_kernel_version}
BuildRequires: kernel-devel-uname-r >= %{kmod_kernel_version}.%{_arch}
BuildRequires: gcc
BuildRequires: kmod
BuildRequires: make
BuildRequires: redhat-rpm-config
Provides: kmod-%{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
Obsoletes: kmod-%{kmod_name} < %{?epoch:%{epoch}:}%{version}-%{release}
Requires(post): %{_sbindir}/depmod
Requires(postun): %{_sbindir}/depmod
Requires(post): %{_sbindir}/weak-modules
Requires(postun): %{_sbindir}/weak-modules
Requires: kernel >= %{kmod_kernel_version}
Requires: kernel-uname-r >= %{kmod_kernel_version}.%{_arch}
# If there are multiple kmods for the same driver from different vendors,
# they should conflict with each other.
Conflicts: kmod-%{kmod_name}
%description
This package provides the kernel modules for EROFS filesystem driver.
%prep
%setup -n kmod-%{kmod_name}-%{kmod_driver_version}
%build
pushd src
%{__make} -C /usr/src/kernels/%{kmod_headers_version} M=$PWD %{?_smp_mflags} CONFIG_EROFS_FS=m %{?erofs_kcfgs} modules
#%{__make} -C %{kernel_source} M=$PWD CONFIG_EROFS_FS=m modules
popd
%install
mkdir -p %{buildroot}/lib/modules/%{kmod_headers_version}/extra/fs/%{kmod_name}
%{__install} -D -t %{buildroot}/lib/modules/%{kmod_headers_version}/extra/fs/%{kmod_name} src/%{kmod_name}.ko
# Make .ko objects temporarily executable for automatic stripping
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d
for kmod in $(find %{buildroot}/lib/modules/%{kmod_headers_version}/extra -type f -name \*.ko -printf "%%P\n" | sort)
do
echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{kmod_name}.conf
echo "override $(basename $kmod .ko) * extra/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{kmod_name}.conf
done
%clean
%{__rm} -rf %{buildroot}
%post
depmod -a > /dev/null 2>&1
if [ -x "/usr/sbin/weak-modules" ]; then
printf '%s\n' "/lib/modules/%{kmod_headers_version}/extra/fs/%{kmod_name}/%{kmod_name}.ko" | /usr/sbin/weak-modules --no-initramfs --add-modules
fi
%preun
echo "/lib/modules/%{kmod_headers_version}/extra/fs/%{kmod_name}/%{kmod_name}.ko" >> /var/run/rpm-%{kmod_name}-modules.list
%postun
depmod -a > /dev/null 2>&1
if [ -x "/usr/sbin/weak-modules" ]; then
modules=( $(cat /var/run/rpm-%{kmod_name}-modules.list) )
printf '%s\n' "${modules[@]}" | /usr/sbin/weak-modules --no-initramfs --remove-modules
fi
rm /var/run/rpm-%{kmod_name}-modules.list
%files
%defattr(644,root,root,755)
/lib/modules/%{kmod_headers_version}
%license LICENSES
%config(noreplace) %{_sysconfdir}/depmod.d/%{kmod_name}.conf
%changelog
* Wed May 29 2024 Gao Xiang <xiang@kernel.org> - 1
- Initial version
- kABI tracking kmod package (kernel >= 3.10.0-123.el7)