Blame SOURCES/filter-modules.sh

fa4e14
#! /bin/bash
fa4e14
#
fa4e14
# Called as filter-modules.sh list-of-modules Arch
fa4e14
fa4e14
# This script filters the modules into the kernel-core and kernel-modules
fa4e14
# subpackages.  We list out subsystems/subdirs to prune from the installed
fa4e14
# module directory.  What is left is put into the kernel-core package.  What is
fa4e14
# pruned is contained in the kernel-modules package.
fa4e14
#
fa4e14
# This file contains the default subsys/subdirs to prune from all architectures.
fa4e14
# If an architecture needs to differ, we source a per-arch filter-<arch>.sh file
fa4e14
# that contains the set of override lists to be used instead.  If a module or
fa4e14
# subsys should be in kernel-modules on all arches, please change the defaults
fa4e14
# listed here.
fa4e14
fa4e14
# Set the default dirs/modules to filter out
fa4e14
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"
fa4e14
fa4e14
chardrvs="mwave pcmcia"
fa4e14
fa4e14
netdrvs="appletalk can dsa hamradio ieee802154 irda ppp slip usb wireless"
fa4e14
fa4e14
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"
fa4e14
fa4e14
inputdrvs="gameport tablet touchscreen"
fa4e14
fa4e14
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"
fa4e14
fa4e14
usbdrvs="atm image misc serial wusbcore"
fa4e14
fa4e14
fsdrvs="affs befs coda cramfs ecryptfs hfs hfsplus jfs minix ncpfs nilfs2 ocfs2 reiserfs romfs squashfs sysv ubifs ufs"
fa4e14
fa4e14
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"
fa4e14
fa4e14
drmdrvs="amd ast gma500 i2c i915 mgag200 nouveau radeon via "
fa4e14
fa4e14
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"
fa4e14
fa4e14
# Grab the arch-specific filter list overrides
fa4e14
source ./filter-$2.sh
fa4e14
fa4e14
filter_dir() {
fa4e14
	filelist=$1
fa4e14
	dir=$2
fa4e14
fa4e14
	grep -v -e "${dir}/" ${filelist} > ${filelist}.tmp
fa4e14
fa4e14
	if [ $? -ne 0 ]
fa4e14
	then
fa4e14
		echo "Couldn't remove ${dir}.  Skipping."
fa4e14
	else
fa4e14
		grep -e "${dir}/" ${filelist} >> k-d.list
fa4e14
		mv ${filelist}.tmp $filelist
fa4e14
	fi
fa4e14
	
fa4e14
	return 0
fa4e14
}
fa4e14
fa4e14
filter_ko() {
fa4e14
	filelist=$1
fa4e14
	mod=$2
fa4e14
fa4e14
	grep -v -e "${mod}.ko" ${filelist} > ${filelist}.tmp
fa4e14
fa4e14
	if [ $? -ne 0 ]
fa4e14
	then
fa4e14
		echo "Couldn't remove ${mod}.ko  Skipping."
fa4e14
	else
fa4e14
		grep -e "${mod}.ko" ${filelist} >> k-d.list
fa4e14
		mv ${filelist}.tmp $filelist
fa4e14
	fi
fa4e14
	
fa4e14
	return 0
fa4e14
}
fa4e14
fa4e14
# Filter the drivers/ subsystems
fa4e14
for subsys in ${driverdirs}
fa4e14
do
fa4e14
	filter_dir $1 drivers/${subsys}
fa4e14
done
fa4e14
fa4e14
# Filter the networking drivers
fa4e14
for netdrv in ${netdrvs}
fa4e14
do
fa4e14
	filter_dir $1 drivers/net/${netdrv}
fa4e14
done
fa4e14
fa4e14
# Filter the char drivers
fa4e14
for char in ${chardrvs}
fa4e14
do
fa4e14
	filter_dir $1 drivers/char/${input}
fa4e14
done
fa4e14
fa4e14
# Filter the ethernet drivers
fa4e14
for eth in ${ethdrvs}
fa4e14
do
fa4e14
	filter_dir $1 drivers/net/ethernet/${eth}
fa4e14
done
fa4e14
fa4e14
# SCSI
fa4e14
for scsi in ${scsidrvs}
fa4e14
do
fa4e14
	filter_dir $1 drivers/scsi/${scsi}
fa4e14
done
fa4e14
fa4e14
# Input
fa4e14
for input in ${inputdrvs}
fa4e14
do
fa4e14
	filter_dir $1 drivers/input/${input}
fa4e14
done
fa4e14
fa4e14
# USB
fa4e14
for usb in ${usbdrvs}
fa4e14
do
fa4e14
	filter_dir $1 drivers/usb/${usb}
fa4e14
done
fa4e14
fa4e14
# Filesystems
fa4e14
for fs in ${fsdrvs}
fa4e14
do
fa4e14
	filter_dir $1 fs/${fs}
fa4e14
done
fa4e14
fa4e14
# Network protocols
fa4e14
for prot in ${netprots}
fa4e14
do
fa4e14
	filter_dir $1 kernel/net/${prot}
fa4e14
done
fa4e14
fa4e14
# DRM
fa4e14
for drm in ${drmdrvs}
fa4e14
do
fa4e14
	filter_dir $1 drivers/gpu/drm/${drm}
fa4e14
done
fa4e14
fa4e14
# Just kill sound.
fa4e14
filter_dir $1 kernel/sound
fa4e14
fa4e14
# Now go through and filter any single .ko files that might have deps on the
fa4e14
# things we filtered above
fa4e14
for mod in ${singlemods}
fa4e14
do
fa4e14
        filter_ko $1 ${mod}
fa4e14
done
fa4e14
fa4e14
# Go through our generated drivers list and remove the .ko files.  We'll
fa4e14
# restore them later.
fa4e14
for mod in `cat k-d.list`
fa4e14
do
fa4e14
	rm -rf $mod
fa4e14
done