Some suggestions for the kmod template in rpmfusion

Chen Lei supercyper1 at gmail.com
Thu May 6 14:58:52 CEST 2010


 Hi all,

I find that the kmod template in rpmfusion(
http://rpmfusion.org/Packaging/KernelModules/Kmods2) seems a bit old.
 <http://rpmfusion.org/Packaging/KernelModules/Kmods2>
e.g.
Still using old Old syntax make ... SUBDIRS=$PWD
make install in %install section cannot work properly on many modern kernel
modules.

So I make some minor changes for this template, maybe its useful for
someone.

%build
for kernel_version in %{?kernel_versions}; do
    make %{?_smp_mflags} -C "${kernel_version##*___}"
SUBDIRS=${PWD}/_kmod_build_${kernel_version%%___*} modules
done
->
%build
for kernel_version in %{?kernel_versions}; do
    make %{?_smp_mflags} -C "${kernel_version##*___}"
M=${PWD}/_kmod_build_${kernel_version%%___*} modules
done
%install
rm -rf ${RPM_BUILD_ROOT}

for kernel_version in %{?kernel_versions}; do
    make install DESTDIR=${RPM_BUILD_ROOT}
KMODPATH=%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}
    # install -D -m 755 _kmod_build_${kernel_version%%___*}/foo/foo.ko
${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/foo.kmod
done
->
%install
rm -rf ${RPM_BUILD_ROOT}

for kernel_version in %{?kernel_versions}; do
    make  -C "${kernel_version##*___}"
M=${PWD}/_kmod_build_${kernel_version%%___*}  _emodinst_
INSTALL_MOD_PATH=${RPM_BUILD_ROOT} INSTALL_MOD_DIR=%{kmodinstdir_postfix}
or
#
make  -C "${kernel_version##*___}"
M=${PWD}/_kmod_build_${kernel_version%%___*}  _emodinst_
INSTALL_MOD_PATH=${RPM_BUILD_ROOT} ext-mod-dir=%{kmodinstdir_postfix}
 done

One thing that I'm still not sure is choosing between INSTALL_MOD_DIR and
ext-mod-dir. If we set ext-mod-dir, then all ko files will go into one
directory even those ko files are in the subdirectoris of M dir. On the
contray, INSTALL_MOD_DIR will preserve subdirectories in M dir. I don't know
which one is better.

e.g.
xtables-addons-kmod
The ko files before installing are located in four dirs M, M/ipset, M/pknock
and M/ACCOUNT.

 ext-mod-dir
.:
compat_xtables.ko     ipt_set.ko         xt_length2.ko
ip6table_rawpost.ko   ipt_SET.ko         xt_LOGMARK.ko
ip_set_iphash.ko      xt_ACCOUNT.ko      xt_lscan.ko
ip_set_ipmap.ko       xt_CHAOS.ko        xt_pknock.ko
ip_set_ipporthash.ko  xt_condition.ko    xt_psd.ko
ip_set_iptree.ko      xt_DELUDE.ko       xt_quota2.ko
ip_set_iptreemap.ko   xt_DHCPMAC.ko      xt_RAWNAT.ko
ip_set.ko             xt_fuzzy.ko        xt_STEAL.ko
ip_set_macipmap.ko    xt_geoip.ko        xt_SYSRQ.ko
ip_set_nethash.ko     xt_iface.ko        xt_TARPIT.ko
ip_set_portmap.ko     xt_IPMARK.ko       xt_TEE.ko
ip_set_setlist.ko     xt_ipp2p.ko
iptable_rawpost.ko    xt_ipv4options.ko



 INSTALL_MOD_DIR
.:
ACCOUNT              xt_DHCPMAC.ko      xt_lscan.ko
compat_xtables.ko    xt_fuzzy.ko        xt_psd.ko
ip6table_rawpost.ko  xt_geoip.ko        xt_quota2.ko
ipset                xt_iface.ko        xt_RAWNAT.ko
iptable_rawpost.ko   xt_IPMARK.ko       xt_STEAL.ko
pknock               xt_ipp2p.ko        xt_SYSRQ.ko
xt_CHAOS.ko          xt_ipv4options.ko  xt_TARPIT.ko
xt_condition.ko      xt_length2.ko      xt_TEE.ko
xt_DELUDE.ko         xt_LOGMARK.ko
./ACCOUNT:
xt_ACCOUNT.ko
./ipset:
ip_set_iphash.ko      ip_set_iptreemap.ko  ip_set_portmap.ko
ip_set_ipmap.ko       ip_set.ko            ip_set_setlist.ko
ip_set_ipporthash.ko  ip_set_macipmap.ko   ipt_set.ko
ip_set_iptree.ko      ip_set_nethash.ko    ipt_SET.ko
./pknock:
xt_pknock.ko

Definitions of  INSTALL_MOD_DIR and ext-mod-dir in Makefile.modinst

# Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra
ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst
%/,%,$(KBUILD_EXTMOD)),,$(@D))
modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))

Cheers,
Chen Lei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rpmfusion.org/pipermail/rpmfusion-developers/attachments/20100506/3febfcd5/attachment.html


More information about the rpmfusion-developers mailing list