# 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|virtio) rm -rf drivers/{bluetooth,interconnect,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*) # Work in progress - Linux 6.18 LTS mainline, Raspberry pi5. # On the rpi5 if it loads the drivers/pinctrl/bcm, the system hangs. # But if we load just the drivers/pinctrl/pinctrl-rp1, it works although still # misses some sub systems. # Moved this into a built-in - but it also fails there. Reverted to modules for # the time being. # Prior to the RPi5 we didn't include any pinctrl stuff in here, so we can get away with # removing everything but the rp1 module. #rm -rf drivers/pinctrl/!(pinctrl-rp1*) # These are the drivers within this dir that cause system hang on the RPi5. They are not required # for the rpi4. # HACK HACK HACK # HACK HACK HACK # HACK HACK HACK rm -rf drivers/pinctrl/bcm # HACK HACK HACK # HACK HACK HACK # Unused file systems: rm -rf fs/{squashfs,udf,ufs,nilfs2,adfs} # We just need NFS for the Installer. # qrtr is 'Qualcomm IPC-router driver' for the Lenovo ThinkPad X31s. rm -rf net/!(sunrpc|qrtr) # Sound is not required within the Installer or OS InitRD: rm -rf sound rm -rf drivers/staging/vc04_services/*audio* # 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,isofs} 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 ****"