Create a kernel-modules-extra subpackage

This creates a modules-extra subpackage which places a number of less
frequently used modules into the extra directory under
/lib/modules/`uname -r`/.  This reduces the size of the default kernel
package while still allowing those modules to be built and installed if
needed.  We also limit the security exposure by keeping these modules out
of the default install.
This commit is contained in:
Josh Boyer 2011-11-18 08:04:03 -05:00
parent 5e296fd758
commit b8b2783bb9
3 changed files with 285 additions and 2 deletions

5
TODO
View File

@ -98,3 +98,8 @@
***********************************************************************************
Spec file/config todos/cleanups
* modules-extra: Do a few more things to make it a bit more robust.
- Allow for comments in the mod-extra.list file.
- Don't fail the build if a module is listed but not built (maybe).
- See if it can be tied into Kconfig instead of module names.

View File

@ -54,7 +54,7 @@ Summary: The Linux kernel
# For non-released -rc kernels, this will be appended after the rcX and
# gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
#
%global baserelease 1
%global baserelease 2
%global fedora_build %{baserelease}
# base_sublevel is the kernel version we're starting with and patching
@ -546,6 +546,7 @@ Source0: ftp://ftp.kernel.org/pub/linux/kernel/v3.0/linux-%{kversion}.tar.bz2
Source1: compat-wireless-%{cwversion}.tar.bz2
Source15: merge.pl
Source16: mod-extra.list
Source19: Makefile.release
Source20: Makefile.config
@ -895,6 +896,24 @@ This package provides kernel headers and makefiles sufficient to build modules\
against the %{?2:%{2} }kernel package.\
%{nil}
#
# This macro creates a kernel-<subpackage>-modules-extra package.
# %%kernel_modules-extra_package <subpackage> <pretty-name>
#
%define kernel_modules-extra_package() \
%package %{?1:%{1}-}modules-extra\
Summary: Extra kernel modules to match the %{?2:%{2} }kernel\
Group: System Environment/Kernel\
Provides: kernel%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}\
Provides: kernel-modules-extra-%{_target_cpu} = %{version}-%{release}%{?1:.%{1}}\
Provides: kernel-modules-extra = %{version}-%{release}%{?1:.%{1}}\
Provides: kernel-modules-extra-uname-r = %{KVERREL}%{?1:.%{1}}\
Requires: kernel%{?1:-%{1}}-%{_target_cpu} = %{version}-%{release}%{?1:.%{1}}\
AutoReqProv: no\
%description -n kernel%{?variant}%{?1:-%{1}}-modules-extra\
This package provides less commonly used kernel modules for the %{?2:%{2} }kernel package.\
%{nil}
#
# This macro creates a kernel-<subpackage> and its -devel and -debuginfo too.
# %%define variant_summary The Linux kernel compiled for <configuration>
@ -906,12 +925,14 @@ Summary: %{variant_summary}\
Group: System Environment/Kernel\
%kernel_reqprovconf\
%{expand:%%kernel_devel_package %1 %{!?-n:%1}%{?-n:%{-n*}}}\
%{expand:%%kernel_modules-extra_package %1 %{!?-n:%1}%{?-n:%{-n*}}}\
%{expand:%%kernel_debuginfo_package %1}\
%{nil}
# First the auxiliary packages of the main kernel package.
%kernel_devel_package
%kernel_modules-extra_package
%kernel_debuginfo_package
@ -1635,6 +1656,50 @@ BuildKernel() {
rm -f modinfo modnames
pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/
rm -rf modnames
find . -name "*.ko" -type f > modnames
# Look through all of the modules, and throw any that have a dependency in
# our list into the list as well.
rm -rf dep.list dep2.list
cp %{SOURCE16} .
for dep in `cat modnames`
do
depends=`modinfo $dep | grep depends| cut -f2 -d":" | sed -e 's/^[ \t]*//'`
[ -z "$depends" ] && continue;
for mod in `echo $depends | sed -e 's/,/ /g'`
do
match=`grep "^$mod.ko" mod-extra.list` ||:
if [ -z "$match" ]
then
continue
else
echo $dep >> dep.list
fi
done
done
for mod in `cat mod-extra.list`
do
# get the path for the module
modpath=`grep /$mod modnames`
[ -z "$modpath" ] && continue;
echo $modpath >> dep.list
done
sort -u dep.list > dep2.list
# now move the modules into the extra/ directory
for mod in `cat dep2.list`
do
newpath=`dirname $mod | sed -e 's/kernel\//extra\//'`
mkdir -p $newpath
mv $mod $newpath
done
rm modnames mod-extra.list dep.list dep2.list
popd
# remove files that will be auto generated by depmod at rpm -i time
for i in alias alias.bin builtin.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap
do
@ -1892,6 +1957,14 @@ then\
fi\
%{nil}
#
# This macro defines a %%post script for a kernel*-modules-extra package.
# %%kernel_modules-extra_post [<subpackage>]
#
%define kernel_modules_extra_post() \
%{expand:%%post %{?1:%{1}-}modules-extra}\
/sbin/depmod -a %{KVERREL}%{?1:.%{1}}\
%{nil}
# This macro defines a %%posttrans script for a kernel package.
# %%kernel_variant_posttrans [<subpackage>]
@ -1910,6 +1983,7 @@ fi\
#
%define kernel_variant_post(v:r:) \
%{expand:%%kernel_devel_post %{?-v*}}\
%{expand:%%kernel_modules_extra_post %{?-v*}}\
%{expand:%%kernel_variant_posttrans %{?-v*}}\
%{expand:%%post %{?-v*}}\
%{-r:\
@ -2051,7 +2125,6 @@ fi
/lib/modules/%{KVERREL}%{?2:.%{2}}/kernel\
/lib/modules/%{KVERREL}%{?2:.%{2}}/build\
/lib/modules/%{KVERREL}%{?2:.%{2}}/source\
/lib/modules/%{KVERREL}%{?2:.%{2}}/extra\
/lib/modules/%{KVERREL}%{?2:.%{2}}/updates\
%if %{with_backports}\
/lib/modules/%{KVERREL}%{?2:.%{2}}/backports\
@ -2065,6 +2138,9 @@ fi
%{expand:%%files %{?2:%{2}-}devel}\
%defattr(-,root,root)\
/usr/src/kernels/%{KVERREL}%{?2:.%{2}}\
%{expand:%%files %{?2:%{2}-}modules-extra}\
%defattr(-,root,root)\
/lib/modules/%{KVERREL}%{?2:.%{2}}/extra\
%if %{with_debuginfo}\
%ifnarch noarch\
%{expand:%%files -f debuginfo%{?2}.list %{?2:%{2}-}debuginfo}\
@ -2096,6 +2172,9 @@ fi
# ||----w |
# || ||
%changelog
* Tue Nov 29 2011 Josh Boyer <jwboyer@redhat.com>
- Add modules-extra subpackage
* Tue Nov 29 2011 Josh Boyer <jwboyer@redhat.com> 3.2.0-0.rc3.git1.1
- Linux 3.2-rc3-git1

199
mod-extra.list Normal file
View File

@ -0,0 +1,199 @@
aer_inject.ko
yenta_socket.ko
tcp_bic.ko
tcp_westwood.ko
tcp_htcp.ko
tcp_highspeed.ko
tcp_hybla.ko
tcp_vegas.ko
tcp_scalable.ko
tcp_lp.ko
tcp_veno.ko
tcp_yeah.ko
tcp_illinois.ko
dccp_diag.ko
dccp_ipv4.ko
dccp_ipv6.ko
dccp.ko
dccp_probe.ko
sctp.ko
sctp_probe.ko
rds.ko
rds_rdma.ko
rds_tcp.ko
atm.ko
br2684.ko
clip.ko
lec.ko
pppoatm.ko
l2tp_core.ko
l2tp_debugfs.ko
l2tp_eth.ko
l2tp_ip.ko
l2tp_netlink.ko
l2tp_ppp.ko
8021q.ko
llc.ko
ipx.ko
appletalk.ko
ipddp.ko
wanrouter.ko
phonet.ko
pn_pep.ko
af_802154.ko
ieee802154.ko
sch_atm.ko
sch_cbq.ko
sch_choke.ko
sch_drr.ko
sch_dsmark.ko
sch_gred.ko
sch_hfsc.ko
sch_htb.ko
sch_ingress.ko
sch_mqprio.ko
sch_multiq.ko
sch_netem.ko
sch_prio.ko
sch_qfq.ko
sch_red.ko
sch_sfb.ko
sch_sfq.ko
sch_tbf.ko
sch_teql.ko
ax25.ko
netrom.ko
rose.ko
6pack.ko
baycom_par.ko
baycom_ser_fdx.ko
baycom_ser_hdx.ko
bpqether.ko
hdlcdrv.ko
mkiss.ko
yam.ko
can.ko
can-raw.ko
can-bcm.ko
can-dev.ko
slcan.ko
vcan.ko
c_can.ko
c_can_platform.ko
ems_pci.ko
kvaser_pci.ko
plx_pci.ko
sja1000.ko
sja1000_platform.ko
softing_cs.ko
softing.ko
ems_usb.ko
esd_usb2.ko
wimax.ko
nfc.ko
nci.ko
mtd.ko
chipreg.ko
cfi_util.ko
gen_probe.ko
map_funcs.ko
nand_ecc.ko
nand_ids.ko
r852.ko
mtdblock.ko
mtdblock_ro.ko
ftl.ko
nftl.ko
rfd_ftl.ko
inftl.ko
ssfdc.ko
mtdswap.ko
mptbase.ko
mptctl.ko
mptfc.ko
i2400m.ko
hisax.ko
hysdn.ko
isdn.ko
mISDN_core.ko
mISDN_dsp.ko
capi.ko
dss1_divert.ko
bas_gigaset.ko
gigaset.ko
avm_cs.ko
b1.ko
diva_idi.ko
divas.ko
avmfritz.ko
hfcpci.ko
hfcmulti.ko
netjet.ko
w6692.ko
avma1_cs.ko
elsa_cs.ko
hfc4s8s_l1.ko
joydev.ko
a3d.ko
adi.ko
analog.ko
cobra.ko
db9.ko
gamecon.ko
gf2k.ko
grip.ko
grip_mp.ko
guillemot.ko
iforce.ko
interact.ko
joydump.ko
magellan.ko
sidewinder.ko
spaceball.ko
spaceorb.ko
stinger.ko
tmdc.ko
turbografx.ko
twidjoy.ko
walkera0701.ko
warrior.ko
xpad.ko
zhenhua.ko
trancevibrator.ko
umc.ko
uwb.ko
whci.ko
hwa-rc.ko
uio.ko
uio_aec.ko
uio_pci_generic.ko
gfs2.ko
ocfs2.ko
ocfs2_stackglue.ko
ocfs2_dlm.ko
cuse.ko
affs.ko
befs.ko
jffs2.ko
ubifs.ko
sysv.ko
ufs.ko
ncpfs.ko
coda.ko
9p.ko
9pnet.ko
act200l-sir.ko
ali-ircc.ko
esi-sir.ko
tekram-sir.ko
actisys-sir.ko
girbil-sir.ko
old_belkin-sir.ko
kingsun-sir.ko
ks959-sir.ko
ksdazzle-sir.ko
ma600-sir.ko
mcp2120-sir.ko
toim3232-sir.ko
pps_core.ko
ssb.ko