Blame SOURCES/filter-modules.sh.rhel

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