2019-11-05 22:10:53 +00:00
|
|
|
#! /bin/bash
|
|
|
|
#
|
|
|
|
# Called as filter-modules.sh list-of-modules Arch
|
|
|
|
|
|
|
|
# This script filters the modules into the kernel-core and kernel-modules
|
|
|
|
# subpackages. We list out subsystems/subdirs to prune from the installed
|
|
|
|
# module directory. What is left is put into the kernel-core package. What is
|
|
|
|
# pruned is contained in the kernel-modules package.
|
|
|
|
#
|
|
|
|
# This file contains the default subsys/subdirs to prune from all architectures.
|
|
|
|
# If an architecture needs to differ, we source a per-arch filter-<arch>.sh file
|
|
|
|
# that contains the set of override lists to be used instead. If a module or
|
|
|
|
# subsys should be in kernel-modules on all arches, please change the defaults
|
|
|
|
# listed here.
|
|
|
|
|
2020-04-27 02:15:20 +00:00
|
|
|
# Overrides is individual modules which need to remain in kernel-core due to deps.
|
|
|
|
overrides="cec"
|
|
|
|
|
2019-11-05 22:10:53 +00:00
|
|
|
# Set the default dirs/modules to filter out
|
2021-04-16 13:52:54 +00:00
|
|
|
driverdirs="atm auxdisplay bcma bluetooth firewire fpga infiniband leds media memstick mfd mmc mtd nfc ntb pcmcia platform power ssb soundwire staging tty uio w1"
|
2019-11-05 22:10:53 +00:00
|
|
|
|
|
|
|
chardrvs="mwave pcmcia"
|
|
|
|
|
2021-04-16 13:52:54 +00:00
|
|
|
netdrvs="appletalk can dsa hamradio ieee802154 ppp slip usb wireless"
|
2019-11-05 22:10:53 +00:00
|
|
|
|
2021-04-16 13:52:54 +00:00
|
|
|
ethdrvs="3com adaptec alteon amd aquantia atheros broadcom cadence calxeda chelsio cisco dec dlink emulex marvell mellanox neterion nvidia packetengines qlogic rdc sfc silan sis smsc stmicro sun tehuti ti wiznet xircom"
|
2019-11-05 22:10:53 +00:00
|
|
|
|
2022-06-28 16:22:13 +00:00
|
|
|
cryptdrvs="bcm caam cavium chelsio hisilicon marvell qat"
|
|
|
|
|
2022-02-28 14:11:32 +00:00
|
|
|
iiodrvs="accel light pressure proximity"
|
|
|
|
|
|
|
|
iiocommondrvs="cros_ec_sensors"
|
|
|
|
|
2019-11-05 22:10:53 +00:00
|
|
|
inputdrvs="gameport tablet touchscreen"
|
|
|
|
|
2021-05-05 16:43:48 +00:00
|
|
|
hiddrvs="surface-hid"
|
|
|
|
|
2021-04-16 13:52:54 +00:00
|
|
|
scsidrvs="aacraid aic7xxx be2iscsi bfa bnx2i bnx2fc csiostor cxgbi esas2r fcoe fnic isci libsas lpfc megaraid mpt3sas mvsas pm8001 qla2xxx qla4xxx sym53c8xx_2 ufs qedf"
|
2019-11-05 22:10:53 +00:00
|
|
|
|
2021-04-16 13:52:54 +00:00
|
|
|
usbdrvs="atm image misc serial"
|
2019-11-05 22:10:53 +00:00
|
|
|
|
2023-09-07 14:48:29 +00:00
|
|
|
fsdrvs="affs befs coda cramfs dlm ecryptfs hfs hfsplus jfs jffs2 minix nilfs2 ocfs2 reiserfs romfs sysv ubifs ufs"
|
2019-11-05 22:10:53 +00:00
|
|
|
|
2021-04-16 13:52:54 +00:00
|
|
|
netprots="6lowpan appletalk atm ax25 batman-adv bluetooth can dsa ieee802154 l2tp mac80211 mac802154 mpls netrom nfc rds rfkill rose sctp smc wireless"
|
2019-11-05 22:10:53 +00:00
|
|
|
|
2024-02-16 16:47:01 +00:00
|
|
|
drmdrvs="amd ast bridge gma500 i2c i915 mgag200 nouveau panel radeon xe"
|
2019-11-05 22:10:53 +00:00
|
|
|
|
2024-01-15 14:35:20 +00:00
|
|
|
singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwpoison-inject target_core_user sbp_target cxgbit chcr parport_serial regmap-sdw regmap-sdw-mbq arizona-micsupp hid-asus iTCO_wdt rnbd-client rnbd-server mlx5_vdpa spi-altera-dfl nct6775 hid-playstation hid-nintendo asus_wmi_sensors asus_wmi_ec_sensors mlx5-vfio-pci video int3406_thermal apple_bl ptp_dfl_tod intel-m10-bmc-hwmon intel_rapl_tpmi pds_vdpa hp-wmi-sensors pds-vfio-pci gpio-ljca spi-ljca i2c-ljca dell-smm-hwmon"
|
2019-11-05 22:10:53 +00:00
|
|
|
|
|
|
|
# Grab the arch-specific filter list overrides
|
|
|
|
source ./filter-$2.sh
|
|
|
|
|
|
|
|
filter_dir() {
|
|
|
|
filelist=$1
|
|
|
|
dir=$2
|
|
|
|
|
|
|
|
grep -v -e "${dir}/" ${filelist} > ${filelist}.tmp
|
|
|
|
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
|
|
|
echo "Couldn't remove ${dir}. Skipping."
|
|
|
|
else
|
|
|
|
grep -e "${dir}/" ${filelist} >> k-d.list
|
|
|
|
mv ${filelist}.tmp $filelist
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
filter_ko() {
|
|
|
|
filelist=$1
|
|
|
|
mod=$2
|
|
|
|
|
|
|
|
grep -v -e "${mod}.ko" ${filelist} > ${filelist}.tmp
|
|
|
|
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
|
|
|
echo "Couldn't remove ${mod}.ko Skipping."
|
|
|
|
else
|
|
|
|
grep -e "${mod}.ko" ${filelist} >> k-d.list
|
|
|
|
mv ${filelist}.tmp $filelist
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
# Filter the drivers/ subsystems
|
|
|
|
for subsys in ${driverdirs}
|
|
|
|
do
|
|
|
|
filter_dir $1 drivers/${subsys}
|
|
|
|
done
|
|
|
|
|
|
|
|
# Filter the networking drivers
|
|
|
|
for netdrv in ${netdrvs}
|
|
|
|
do
|
|
|
|
filter_dir $1 drivers/net/${netdrv}
|
|
|
|
done
|
|
|
|
|
|
|
|
# Filter the char drivers
|
|
|
|
for char in ${chardrvs}
|
|
|
|
do
|
2021-04-16 13:52:54 +00:00
|
|
|
filter_dir $1 drivers/char/${char}
|
2019-11-05 22:10:53 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# Filter the ethernet drivers
|
|
|
|
for eth in ${ethdrvs}
|
|
|
|
do
|
|
|
|
filter_dir $1 drivers/net/ethernet/${eth}
|
|
|
|
done
|
|
|
|
|
2022-06-28 16:22:13 +00:00
|
|
|
# Filter the crypto drivers
|
|
|
|
for crypt in ${cryptdrvs}
|
|
|
|
do
|
|
|
|
filter_dir $1 drivers/crypto/${crypt}
|
|
|
|
done
|
|
|
|
|
2019-11-05 22:10:53 +00:00
|
|
|
# SCSI
|
|
|
|
for scsi in ${scsidrvs}
|
|
|
|
do
|
|
|
|
filter_dir $1 drivers/scsi/${scsi}
|
|
|
|
done
|
|
|
|
|
2022-02-28 14:11:32 +00:00
|
|
|
# IIO
|
|
|
|
for iio in ${iiodrvs}
|
|
|
|
do
|
|
|
|
filter_dir $1 drivers/iio/${iio}
|
|
|
|
done
|
|
|
|
|
|
|
|
# IIO Common
|
|
|
|
for iio in ${iiocommondrvs}
|
|
|
|
do
|
|
|
|
filter_dir $1 drivers/iio/common/${iio}
|
|
|
|
done
|
|
|
|
|
2019-11-05 22:10:53 +00:00
|
|
|
# Input
|
|
|
|
for input in ${inputdrvs}
|
|
|
|
do
|
|
|
|
filter_dir $1 drivers/input/${input}
|
|
|
|
done
|
2021-05-05 16:43:48 +00:00
|
|
|
|
|
|
|
# hid
|
|
|
|
for hid in ${hiddrvs}
|
|
|
|
do
|
|
|
|
filter_dir $1 drivers/hid/${hid}
|
|
|
|
done
|
2019-11-05 22:10:53 +00:00
|
|
|
|
|
|
|
# USB
|
|
|
|
for usb in ${usbdrvs}
|
|
|
|
do
|
|
|
|
filter_dir $1 drivers/usb/${usb}
|
|
|
|
done
|
|
|
|
|
|
|
|
# Filesystems
|
|
|
|
for fs in ${fsdrvs}
|
|
|
|
do
|
|
|
|
filter_dir $1 fs/${fs}
|
|
|
|
done
|
|
|
|
|
|
|
|
# Network protocols
|
|
|
|
for prot in ${netprots}
|
|
|
|
do
|
|
|
|
filter_dir $1 kernel/net/${prot}
|
|
|
|
done
|
|
|
|
|
|
|
|
# DRM
|
|
|
|
for drm in ${drmdrvs}
|
|
|
|
do
|
|
|
|
filter_dir $1 drivers/gpu/drm/${drm}
|
|
|
|
done
|
|
|
|
|
|
|
|
# Just kill sound.
|
|
|
|
filter_dir $1 kernel/sound
|
2021-08-17 21:19:38 +00:00
|
|
|
filter_dir $1 kernel/drivers/soundwire
|
2019-11-05 22:10:53 +00:00
|
|
|
|
|
|
|
# Now go through and filter any single .ko files that might have deps on the
|
|
|
|
# things we filtered above
|
|
|
|
for mod in ${singlemods}
|
|
|
|
do
|
|
|
|
filter_ko $1 ${mod}
|
|
|
|
done
|
|
|
|
|
2020-04-27 02:15:20 +00:00
|
|
|
# Now process the override list to bring those modules back into core
|
|
|
|
for mod in ${overrides}
|
|
|
|
do
|
|
|
|
grep -v -e "/${mod}.ko" k-d.list > k-d.list.tmp
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
|
|
|
echo "Couldn't save ${mod}.ko Skipping."
|
|
|
|
else
|
|
|
|
grep -e "/${mod}.ko" k-d.list >> $filelist
|
|
|
|
mv k-d.list.tmp k-d.list
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
2019-11-05 22:10:53 +00:00
|
|
|
# Go through our generated drivers list and remove the .ko files. We'll
|
|
|
|
# restore them later.
|
|
|
|
for mod in `cat k-d.list`
|
|
|
|
do
|
|
|
|
rm -rf $mod
|
|
|
|
done
|