Blame SOURCES/filter-modules.sh.rhel

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