# Script..: slackwareaarch64-/source/k/scripts/slim-kmods-initrd # # Caller: kernel.SlackBuild and the Installer build system # Additions to this script can also be pasted into the stage 1 of the # 'slkpbs' (pre-boot Shell) within the Installer and OS InitRD when # paring down the module collection. # # Purpose: Delete a range of unnecessary sub system drivers from within the # Slackware OS InitRD (Operating System Initial RAM Disk) and the # Slackware Installer. These are not required to boot the OS nor # Installer, and unnecessarily inflate the RAM requirements if not # removed. # # See also: The modules include list is '../sources/kmod-dirlist' # kernel.SlackBuild and the Slackware Installer feed that list # into 'tar'. The script you're looking at now slims it down depending # on whether the OS InitRD or Slackware Installer is being created # at build time. # # Note: The aim of this is to focus on the heaviest areas and delete what's # verifiably not required. The Slackware Installers and OS InitRD's # are generic environments for all consumers. If you're after reducing # the footprint of your own installation, see: # https://docs.slackware.com/slackwarearm:inst_sa64_rk3399_rockpro64#reducing_boot_time # Note about crypto: # https://github.com/ThomasKaiser/sbc-bench/blob/master/results/ARMv8-Crypto-Extensions.md #set +o posix #shopt -s extglob echo "**** Slimming Initial RAM Disk ****" pushd lib/modules/*/kernel # Wipe all but 'crct10dif-ce*': rm -rf arch/arm64/crypto/!(crct10dif-ce*) # caam is used on the HoneyComb LX2, and Rockchip on the rk3399 # Pinebook Pro/RockPro64: rm -rf drivers/crypto/!(caam|rockchip) rm -rf drivers/{bluetooth,interconnect,mailbox,perf,ptp,soundwire,xen,ufs} rm -rf drivers/media/{tuners,dvb-core} rm -rf drivers/media/platform/{rcar*,qcom,exynos*,vsp1} # Networking: # Remove Wireless and other non-essentials: rm -rf drivers/net/{wireless,can,ipa} rm -rf drivers/input/touchscreen rm -rf drivers/power/supply # Include only the required GPIO drivers for supported Hardware Models: # To fix: # Invert this logic, to include only those within the # input (the list tar uses - ../sources/kmod-dirlist). # Otherwise this is going to get crazy. rm -rf drivers/hwmon/!(gpio-fan*|raspberrypi-hwmon*|pwm-fan*|amc6821*) # Unused file systems: rm -rf fs/{squashfs,udf,ufs,isofs,nilfs2,adfs} # We just need NFS for the Installer: rm -rf net/!(sunrpc) # Sound is not required within the Installer or OS InitRD: rm -rf sound # We retain the most common USB to Serial adapters which # can be used to connect to a tty from within the Slackware Installer: rm -rf drivers/usb/serial/!(usbserial*|pl2303*|ftdi_sio*) # Required/useful within the Installer, but superfluous within the OS InitRD: [ -z "${building_installer}" ] && { rm -rf mm # includes 'zsmalloc' required by 'zram' module. rm -rf fs/{ntfs*,smb,fuse} rm -rf drivers/cdrom # The drivers below (at least a select number (but we're not being selective yet)) # are required within the Installer, but they're absent from the OS InitRD because # they're loaded from the OS's /lib/modules when the OS Proper boots. rm -rf drivers/thermal rm -rf drivers/nvmem rm -rf drivers/uio # There's no ability to open a tty from within the OS InitRD # so we don't need to support any USB to Serial adapters: rm -rf drivers/usb/serial } popd echo "**** Completed: Slimming Initial RAM Disk ****"