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