Blame SOURCES/filter-modules.sh

b1b780
#! /bin/bash
b1b780
#
b1b780
# Called as filter-modules.sh list-of-modules Arch
b1b780
b1b780
# This script filters the modules into the kernel-core and kernel-modules
b1b780
# subpackages.  We list out subsystems/subdirs to prune from the installed
b1b780
# module directory.  What is left is put into the kernel-core package.  What is
b1b780
# pruned is contained in the kernel-modules package.
b1b780
#
b1b780
# This file contains the default subsys/subdirs to prune from all architectures.
b1b780
# If an architecture needs to differ, we source a per-arch filter-<arch>.sh file
b1b780
# that contains the set of override lists to be used instead.  If a module or
b1b780
# subsys should be in kernel-modules on all arches, please change the defaults
b1b780
# listed here.
b1b780
b1b780
# Set the default dirs/modules to filter out
3c3256
driverdirs="atm auxdisplay bcma bluetooth firewire fmc iio infiniband isdn leds media memstick mfd mmc mtd nfc ntb pcmcia platform power ssb staging tty uio uwb w1 virt"
b1b780
b1b780
chardrvs="mwave pcmcia"
b1b780
b1b780
netdrvs="appletalk can dsa hamradio ieee802154 irda ppp slip usb wireless"
b1b780
b1b780
ethdrvs="3com adaptec alteon amd aquantia atheros broadcom cadence calxeda chelsio cisco dec dlink emulex icplus marvell neterion nvidia oki-semi packetengines qlogic rdc renesas sfc silan sis smsc stmicro sun tehuti ti wiznet xircom"
b1b780
b1b780
inputdrvs="gameport tablet touchscreen"
b1b780
b1b780
scsidrvs="aacraid aic7xxx aic94xx be2iscsi bfa bnx2i bnx2fc csiostor cxgbi esas2r fcoe fnic hisi_sas isci libsas lpfc megaraid mpt2sas mpt3sas mvsas pm8001 qla2xxx qla4xxx sym53c8xx_2 ufs qedf"
b1b780
b1b780
usbdrvs="atm image misc serial wusbcore"
b1b780
3c3256
fsdrvs="affs befs cifs coda cramfs ecryptfs hfs hfsplus jfs minix ncpfs nilfs2 ocfs2 reiserfs romfs squashfs sysv ubifs ufs"
b1b780
b1b780
netprots="6lowpan appletalk atm ax25 batman-adv bluetooth can dccp dsa ieee802154 irda l2tp mac80211 mac802154 mpls netrom nfc rds rfkill rose sctp smc wireless"
b1b780
b1b780
drmdrvs="amd ast gma500 i2c i915 mgag200 nouveau radeon via "
b1b780
19e6f8
singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwa-hc hwpoison-inject hid-sensor-hub target_core_user sbp_target cxgbit iw_cxgb3 iw_cxgb4 cxgb3i cxgb3i cxgb3i_ddp cxgb4i chcr parport_serial ism xt_u32 act_ct"
b1b780
b1b780
# Grab the arch-specific filter list overrides
b1b780
source ./filter-$2.sh
b1b780
b1b780
filter_dir() {
b1b780
	filelist=$1
b1b780
	dir=$2
b1b780
b1b780
	grep -v -e "${dir}/" ${filelist} > ${filelist}.tmp
b1b780
b1b780
	if [ $? -ne 0 ]
b1b780
	then
b1b780
		echo "Couldn't remove ${dir}.  Skipping."
b1b780
	else
b1b780
		grep -e "${dir}/" ${filelist} >> k-d.list
b1b780
		mv ${filelist}.tmp $filelist
b1b780
	fi
b1b780
	
b1b780
	return 0
b1b780
}
b1b780
b1b780
filter_ko() {
b1b780
	filelist=$1
b1b780
	mod=$2
b1b780
b1b780
	grep -v -e "${mod}.ko" ${filelist} > ${filelist}.tmp
b1b780
b1b780
	if [ $? -ne 0 ]
b1b780
	then
b1b780
		echo "Couldn't remove ${mod}.ko  Skipping."
b1b780
	else
b1b780
		grep -e "${mod}.ko" ${filelist} >> k-d.list
b1b780
		mv ${filelist}.tmp $filelist
b1b780
	fi
b1b780
	
b1b780
	return 0
b1b780
}
b1b780
b1b780
# Filter the drivers/ subsystems
b1b780
for subsys in ${driverdirs}
b1b780
do
b1b780
	filter_dir $1 drivers/${subsys}
b1b780
done
b1b780
b1b780
# Filter the networking drivers
b1b780
for netdrv in ${netdrvs}
b1b780
do
b1b780
	filter_dir $1 drivers/net/${netdrv}
b1b780
done
b1b780
b1b780
# Filter the char drivers
b1b780
for char in ${chardrvs}
b1b780
do
b1b780
	filter_dir $1 drivers/char/${input}
b1b780
done
b1b780
b1b780
# Filter the ethernet drivers
b1b780
for eth in ${ethdrvs}
b1b780
do
b1b780
	filter_dir $1 drivers/net/ethernet/${eth}
b1b780
done
b1b780
b1b780
# SCSI
b1b780
for scsi in ${scsidrvs}
b1b780
do
b1b780
	filter_dir $1 drivers/scsi/${scsi}
b1b780
done
b1b780
b1b780
# Input
b1b780
for input in ${inputdrvs}
b1b780
do
b1b780
	filter_dir $1 drivers/input/${input}
b1b780
done
b1b780
b1b780
# USB
b1b780
for usb in ${usbdrvs}
b1b780
do
b1b780
	filter_dir $1 drivers/usb/${usb}
b1b780
done
b1b780
b1b780
# Filesystems
b1b780
for fs in ${fsdrvs}
b1b780
do
b1b780
	filter_dir $1 fs/${fs}
b1b780
done
b1b780
b1b780
# Network protocols
b1b780
for prot in ${netprots}
b1b780
do
b1b780
	filter_dir $1 kernel/net/${prot}
b1b780
done
b1b780
b1b780
# DRM
b1b780
for drm in ${drmdrvs}
b1b780
do
b1b780
	filter_dir $1 drivers/gpu/drm/${drm}
b1b780
done
b1b780
b1b780
# Just kill sound.
b1b780
filter_dir $1 kernel/sound
3c3256
filter_ko $1 drivers/base/regmap/regmap-sdw
e6bf0f
filter_ko $1 drivers/base/regmap/regmap-sdw-mbq
3c3256
filter_dir $1 drivers/soundwire
b1b780
b1b780
# Now go through and filter any single .ko files that might have deps on the
b1b780
# things we filtered above
b1b780
for mod in ${singlemods}
b1b780
do
b1b780
        filter_ko $1 ${mod}
b1b780
done
b1b780
b1b780
# Go through our generated drivers list and remove the .ko files.  We'll
b1b780
# restore them later.
b1b780
for mod in `cat k-d.list`
b1b780
do
b1b780
	rm -rf $mod
b1b780
done