sample_kmp_spec_file

 

Purpose

Create a standard KMP spec file for the Driver Backport Working Group.

Starting Point

Current Status

%kernel_module_package_moddir macro has been added to SUSE 11+ and RHEL 6.1+.

 

Template

#
# samplekmp.spec
# Sample KMP spec file
#

# Following line included for SUSE "build" command; does not affect "rpmbuild"
# norootforbuild

Name:         samplekmp
BuildRequires: %kernel_module_package_buildreqs
License:      GPL
Group:        System/Kernel
Summary:      Sample Kernel Module Package
Version:      1.0
Release:      0
Source0:      %name-%version.tar.bz2
BuildRoot:    %{_tmppath}/%{name}-%{version}-build
# Uncomment the following line to include a required firmware package
# Requires:   samplefirmware  

%kernel_module_package

%description
This is a sample Kernel Module Package.

%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} modules M=$PWD/obj/$flavor
done

%install
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
# Following line works for SUSE 11+ and RHEL 6.1+ only, must set INSTALL_MOD_DIR manually for other targets
export INSTALL_MOD_DIR=%kernel_module_package_moddir %{name}
for flavor in %flavors_to_build; do
    make -C %{kernel_source $flavor} modules_install M=$PWD/obj/$flavor
done

%clean
rm -rf %{buildroot}

%changelog