wuzhouhui
2019-Apr-12 14:04 UTC
[CentOS] rpmbuild how to know we are building kernel module package
Hi,
When I build a mpt3sas rpm package, I found something interesting:
1. package name is prefixed with kmod- automatically
2. so many requirements are added automatically, most of them are kabi
So my question is rpmbuild how to know he is building kernel module package?
Based on which condition?
Here is mpt3sas.spec:
Name: mpt3sas
Version: 26.00.00.00
Release: 1
Summary: RHEL Driver Update Program package
Group: System/Kernel
License: GPLv2
URL: http://www.lsilogic.com
Distribution: LSI Corporation
Source0: %{name}-%{version}.tar.bz2
Source1: %{name}.files
Source2: %{name}.conf
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: %kernel_module_package_buildreqs
%global kernel_version `uname -r`
%kernel_module_package -f %{SOURCE1} default
%description
LSI MPT Fusion HBA drivers (12gb SAS)
%prep
%setup
set -- *
mkdir source
mv "$@" source/
mkdir obj
%build
for flavor in %flavors_to_build; do
rm -rf obj/$flavor
cp -r source obj/$flavor
make -C %{kernel_source $flavor} M=$PWD/obj/$flavor
done
%install
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=extra/%{name}
for flavor in %flavors_to_build ; do
make -C %{kernel_source $flavor} modules_install \
M=$PWD/obj/$flavor
# Cleanup unnecessary kernel-generated module dependency files.
find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \;
done
sed -e s/this_weakupdate/`uname -r | cut -f1 -d-`/ \
../../SOURCES/mpt3sas.conf > \
../../SOURCES/mpt3sas.a
mv ../../SOURCES/mpt3sas.a ../../SOURCES/mpt3sas.conf
install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT/etc/depmod.d/%{name}.conf
install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT/etc/modules-load.d/%{name}.conf
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
Gordon Messmer
2019-Apr-12 15:12 UTC
[CentOS] rpmbuild how to know we are building kernel module package
On 4/12/19 7:04 AM, wuzhouhui wrote:> So my question is rpmbuild how to know he is building kernel module package? > Based on which condition?I believe the %kernel_module_package macro defined in /usr/lib/rpm/redhat/macros is used to invoke /usr/lib/rpm/redhat/kmodtool, which provides some overrides.
wuzhouhui
2019-Apr-13 01:55 UTC
[CentOS] rpmbuild how to know we are building kernel module package
> On Apr 12, 2019, at 11:12 PM, Gordon Messmer <gordon.messmer at gmail.com> wrote: > > On 4/12/19 7:04 AM, wuzhouhui wrote: >> So my question is rpmbuild how to know he is building kernel module package? >> Based on which condition? > > > I believe the %kernel_module_package macro defined in /usr/lib/rpm/redhat/macros is used to invoke /usr/lib/rpm/redhat/kmodtool, which provides some overrides.I checked these macros and files, and I think you are right, although I haven't verify it. Thanks.> > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos