| #! /bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| 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" |
| |
| chardrvs="mwave pcmcia" |
| |
| netdrvs="appletalk can dsa hamradio ieee802154 irda ppp slip usb wireless" |
| |
| 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" |
| |
| inputdrvs="gameport tablet touchscreen" |
| |
| 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" |
| |
| usbdrvs="atm image misc serial wusbcore" |
| |
| fsdrvs="affs befs coda cramfs ecryptfs hfs hfsplus jfs minix ncpfs nilfs2 ocfs2 reiserfs romfs squashfs sysv ubifs ufs" |
| |
| 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" |
| |
| drmdrvs="amd ast gma500 i2c i915 mgag200 nouveau radeon via " |
| |
| 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 parport_serial ism" |
| |
| |
| 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 |
| } |
| |
| |
| for subsys in ${driverdirs} |
| do |
| filter_dir $1 drivers/${subsys} |
| done |
| |
| |
| for netdrv in ${netdrvs} |
| do |
| filter_dir $1 drivers/net/${netdrv} |
| done |
| |
| |
| for char in ${chardrvs} |
| do |
| filter_dir $1 drivers/char/${input} |
| done |
| |
| |
| for eth in ${ethdrvs} |
| do |
| filter_dir $1 drivers/net/ethernet/${eth} |
| done |
| |
| |
| for scsi in ${scsidrvs} |
| do |
| filter_dir $1 drivers/scsi/${scsi} |
| done |
| |
| |
| for input in ${inputdrvs} |
| do |
| filter_dir $1 drivers/input/${input} |
| done |
| |
| |
| for usb in ${usbdrvs} |
| do |
| filter_dir $1 drivers/usb/${usb} |
| done |
| |
| |
| for fs in ${fsdrvs} |
| do |
| filter_dir $1 fs/${fs} |
| done |
| |
| |
| for prot in ${netprots} |
| do |
| filter_dir $1 kernel/net/${prot} |
| done |
| |
| |
| for drm in ${drmdrvs} |
| do |
| filter_dir $1 drivers/gpu/drm/${drm} |
| done |
| |
| |
| filter_dir $1 kernel/sound |
| |
| |
| |
| for mod in ${singlemods} |
| do |
| filter_ko $1 ${mod} |
| done |
| |
| |
| |
| for mod in `cat k-d.list` |
| do |
| rm -rf $mod |
| done |