======KMP Macros======
=====Contents=====
* [[https://www.linuxfoundation.org/#Purpose|1 Purpose]]
* [[https://www.linuxfoundation.org/#Process|2 Process]]
* [[https://www.linuxfoundation.org/#Current_Issues|3 Current Issues]]
* [[https://www.linuxfoundation.org/#Proposed_standard_KMP_Macros|4 Proposed standard KMP Macros]]
* [[https://www.linuxfoundation.org/#kernel_module_package_buildreqs|4.1 kernel_module_package_buildreqs]]
* [[https://www.linuxfoundation.org/#kernel_source.28.29_-_already_works_on_SUSE_and_Red_Hat|4.2 kernel_source() - already works on SUSE and Red Hat]]
* [[https://www.linuxfoundation.org/#_kermoddir|4.3 _kermoddir]]
* [[https://www.linuxfoundation.org/#kernel_module_package|4.4 kernel_module_package]]
**Purpose**
This page will eventually provide an "API Reference" for the macros used to build KMPs with the standard spec file on [[https://www.linuxfoundation.org/en/Sample_KMP_spec_file|https://www.linux-foundation.org/en/Sample_KMP_spec_file]] .
**Process**
- Work through the "Current Issues below.
- Fill in the "KMP Macros - API Reference" section below.
**Current Issues**
- Can we agree to just call the main macro %kernel_module_package?
- %kernel_module_package macro needs to include an option to the macro that specifies the pciid that gets installed in a standard location when the KMP is installed.
- We need an option that specifies the firmware file that gets installed in a standard location when the KMP is installed.
- We need an option that specifies that the modules in the KMP get added to the initrd when installed.
- Can we pull the explicit %package KMP stuff (in the SUSE spec file) into %suse_kernel_module_subpackage? Or can we just remove it from the spec file? (Removing it would eliminate the ability for SUSE subpackages to have a different summary and description from the main package.)
- Can we invent %make_build and %make_install macros that take flavor as an argument? That will hide the details of the make command behind the macros.
- Can we invent an %install_mod macro to handle INSTALL_MOD_PATH and INSTALL_MOD_DIR?
**Proposed Standard KMP Macros**==== kernel_module_package_buildreqs ====
Should evaluate to: Everything needed for "BuildRequires".
SUSE needs to change kernel_module_package_buildreq to kernel_module_package_buildreqs and update "build" so that it can handle this macro.
**kernel_source() - Already Works on SUSE and Red Hat**
Should evaluate to: Directory containing top-level kernel Makefile (used in "make -C %{kernel_source $flavor} modules M=$PWD/obj/$flavor")
**_kermoddir**
Should evaluate to: Directory for installed modules. I.e., SUSE would evaluate to "updates", Red Hat would evaluate to "updates/%name".
Suggested macro for SUSE to add to /usr/lib/rpm/macros:
%_kermoddir(n:) %{expand:%(echo "updates")}
Suggested macro for Red Hat to add to /usr/lib/rpm/redhat/macros:
%_kermoddir(n:) %{expand:%( \
EXTRADIR=%{-n*} \
echo "updates/$EXTRADIR")}
**kernel_module_package**
TBD