Blame SOURCES/filter-modules.sh.rhel

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