diff --git a/usr/bin/archboot-cpio.sh b/usr/bin/archboot-cpio.sh index a92dd339d..1d3d1e802 100755 --- a/usr/bin/archboot-cpio.sh +++ b/usr/bin/archboot-cpio.sh @@ -64,7 +64,7 @@ if (( ${#_HOOKS[*]} == 0 )); then fi echo "Using kernel: ${_KERNEL}" echo "Detected kernel version: ${_KERNELVERSION}" -_builtin_modules +_builtin_mods _HOOK_COUNT=1 _HOOKS_END_COUNT="$(echo "${_HOOKS[@]}" | wc -w)" if [[ "${_HOOKS_END_COUNT}" -lt 10 ]]; then @@ -83,7 +83,7 @@ for i in "${_HOOKS[@]}"; do _HOOK_COUNT="$((_HOOK_COUNT+1))" done _install_libs -_install_modules "${!_MOD_PATH[@]}" +_install_mods "${!_MOD_PATH[@]}" ldconfig -r "${_ROOTFS}" &>"${_NO_LOG}" || exit 1 # remove /var/cache/ldconfig/aux-cache for reproducibility rm -f -- "${_ROOTFS}/var/cache/ldconfig/aux-cache" diff --git a/usr/lib/archboot/cpio/cpio.sh b/usr/lib/archboot/cpio/cpio.sh index fd0afa205..9dc5367e9 100644 --- a/usr/lib/archboot/cpio/cpio.sh +++ b/usr/lib/archboot/cpio/cpio.sh @@ -40,7 +40,7 @@ _cleanup() { fi } -_builtin_modules() { +_builtin_mods() { while IFS=.= read -rd '' _MODULE _FIELD _VALUE; do _INCLUDED_MODS[${_MODULE//-/_}]=2 case "$_FIELD" in @@ -59,7 +59,7 @@ _map() { return "${_RETURN}" } -_filter_modules() { +_filter_mods() { # Add modules to the rootfs, filtered by grep. # $@: filter arguments to grep # -f FILTER: ERE to filter found modules @@ -81,16 +81,16 @@ _filter_modules() { (( _COUNT )) } -_all_modules() { +_all_mods() { # Add modules to the initcpio. # $@: arguments to all_modules local -a _MODS - mapfile -t _MODS < <(_filter_modules "$@") + mapfile -t _MODS < <(_filter_mods "$@") _map _module "${_MODS[@]}" return $(( !${#_MODS[*]} )) } -_module() { +_mod() { # Add a kernel module to the rootfs. Dependencies will be # discovered and added. # $1: module name @@ -116,7 +116,7 @@ _module() { softdep) read -ra _SOFT <<<"${_VALUE}" for i in "${_SOFT[@]}"; do [[ ${i} == *: ]] && continue - _module "${i}?" + _mod "${i}?" done ;; esac @@ -206,7 +206,7 @@ _run_hook() { _run } -_install_modules() { +_install_mods() { echo "Adding kernel modules..." tar --hard-dereference -C / -cpf - "$@" | tar -C "${_ROOTFS}" -xpf - echo "Generating module dependencies..." diff --git a/usr/lib/archboot/cpio/hooks/acpi b/usr/lib/archboot/cpio/hooks/acpi index ce825193e..635c4e6ef 100644 --- a/usr/lib/archboot/cpio/hooks/acpi +++ b/usr/lib/archboot/cpio/hooks/acpi @@ -4,6 +4,6 @@ _run () { - _all_modules '/acpi/' + _all_mods '/acpi/' } # vim: set ft=sh ts=4 sw=4 et: diff --git a/usr/lib/archboot/cpio/hooks/base_common b/usr/lib/archboot/cpio/hooks/base_common index 602c2f9e0..c033756a4 100644 --- a/usr/lib/archboot/cpio/hooks/base_common +++ b/usr/lib/archboot/cpio/hooks/base_common @@ -108,7 +108,7 @@ var/lib/pacman/local \ ### add systemd # add systemd kernel modules - _all_modules 'nfs|autofs4|loop' + _all_mods 'nfs|autofs4|loop' _map _binary mount.nfs4 umount.nfs umount.nfs4 mount.nfs setfont loadkeys #dbus files diff --git a/usr/lib/archboot/cpio/hooks/block_modules b/usr/lib/archboot/cpio/hooks/block_modules index 3a955ad68..ff10e53fa 100644 --- a/usr/lib/archboot/cpio/hooks/block_modules +++ b/usr/lib/archboot/cpio/hooks/block_modules @@ -6,20 +6,20 @@ _run() { ### add block device support # sata, scsi, nvme - _map _all_modules 'scsi/.*ata' \ + _map _all_mods 'scsi/.*ata' \ 'ata/(ahci|pdc_adma|ata_piix|ata_generic)' - _all_modules -f 'pcmcia|scsi/(ch|imm|ppa|sg|st)|rdma|rnbd|rbd|nbd|qed|cxgb|bnx2|csiostor|qla1280|qla2xxx|qla4xxx|iscsi|brd|aoe|null_blk|pktcdvd|drbd|floppy|lpfc|ublk_drv|bfa|snic|fnic|fcoe' '/(block|scsi|fusion|nvme)/' - _all_modules -f 'parport' 'ata/sata_' + _all_mods -f 'pcmcia|scsi/(ch|imm|ppa|sg|st)|rdma|rnbd|rbd|nbd|qed|cxgb|bnx2|csiostor|qla1280|qla2xxx|qla4xxx|iscsi|brd|aoe|null_blk|pktcdvd|drbd|floppy|lpfc|ublk_drv|bfa|snic|fnic|fcoe' '/(block|scsi|fusion|nvme)/' + _all_mods -f 'parport' 'ata/sata_' # usb - _all_modules '/drivers/usb/storage/' + _all_mods '/drivers/usb/storage/' # mmc - _all_modules -f '_cs' '/(drivers/mmc|tifm_)' + _all_mods -f '_cs' '/(drivers/mmc|tifm_)' # spi (mmc in spi mode) - _all_modules -f 'butterfly|lm70llp' '/drivers/spi/' + _all_mods -f 'butterfly|lm70llp' '/drivers/spi/' # nvdimm - _all_modules '/drivers/nvdimm/' + _all_mods '/drivers/nvdimm/' # Intel Volume Management Device - _all_modules 'vmd' + _all_mods 'vmd' } # vim: set ft=sh ts=4 sw=4 et: diff --git a/usr/lib/archboot/cpio/hooks/common_modules b/usr/lib/archboot/cpio/hooks/common_modules index 22dc34057..652038dda 100644 --- a/usr/lib/archboot/cpio/hooks/common_modules +++ b/usr/lib/archboot/cpio/hooks/common_modules @@ -5,15 +5,15 @@ _run () { ### add pcspkr - _module pcspkr + _mod pcspkr ### add init modules - _map _module zram btrfs zstd libcrc32c + _map _mod zram btrfs zstd libcrc32c ### keyboard modules - _all_modules -f '_cs|ssb-hcd' '/usb/host' - _all_modules '/hid/hid-(alps|apple|asus|belkin|cherry|chicony|corsair|elan|hyperv|kensignton|lenovo|logitech|magicmouse|microsoft|razer|redragon|roccat|samsung|sony|speedlink|steelseries)' - _module usbhid - _all_modules -f 'parkbd' '/input/serio|mouse|keyboard/(applespi|atkbd)' - _all_modules -f '9pnet|bluetooth|fs' 'virtio' + _all_mods -f '_cs|ssb-hcd' '/usb/host' + _all_mods '/hid/hid-(alps|apple|asus|belkin|cherry|chicony|corsair|elan|hyperv|kensignton|lenovo|logitech|magicmouse|microsoft|razer|redragon|roccat|samsung|sony|speedlink|steelseries)' + _mod usbhid + _all_mods -f 'parkbd' '/input/serio|mouse|keyboard/(applespi|atkbd)' + _all_mods -f '9pnet|bluetooth|fs' 'virtio' } # vim: set ft=sh ts=4 sw=4 et: diff --git a/usr/lib/archboot/cpio/hooks/cpufreq b/usr/lib/archboot/cpio/hooks/cpufreq index 50a4df1f4..726c43ea8 100644 --- a/usr/lib/archboot/cpio/hooks/cpufreq +++ b/usr/lib/archboot/cpio/hooks/cpufreq @@ -4,7 +4,7 @@ _run () { - _all_modules 'arch/x86/kernel/cpu/cpufreq|drivers/cpufreq' + _all_mods 'arch/x86/kernel/cpu/cpufreq|drivers/cpufreq' _map _binary cpupower cpufreq-bench_plot.sh _file /etc/cpufreq-bench.conf } diff --git a/usr/lib/archboot/cpio/hooks/devicemapper b/usr/lib/archboot/cpio/hooks/devicemapper index 991ef1d09..c065c6f0c 100644 --- a/usr/lib/archboot/cpio/hooks/devicemapper +++ b/usr/lib/archboot/cpio/hooks/devicemapper @@ -4,7 +4,7 @@ _run () { - _all_modules 'md/dm-*' + _all_mods 'md/dm-*' _map _binary dmsetup dmeventd blkdeactivate dmstats cryptsetup \ integritysetup veritysetup _dir /dev/mapper diff --git a/usr/lib/archboot/cpio/hooks/dmidecode b/usr/lib/archboot/cpio/hooks/dmidecode index 28c39df9a..d4cefb9b1 100644 --- a/usr/lib/archboot/cpio/hooks/dmidecode +++ b/usr/lib/archboot/cpio/hooks/dmidecode @@ -4,7 +4,7 @@ _run () { - _all_modules '/firmware/dmi-sysfs' + _all_mods '/firmware/dmi-sysfs' _map _binary dmidecode biosdecode } diff --git a/usr/lib/archboot/cpio/hooks/filesystems b/usr/lib/archboot/cpio/hooks/filesystems index a9dab2bec..3b182a04b 100644 --- a/usr/lib/archboot/cpio/hooks/filesystems +++ b/usr/lib/archboot/cpio/hooks/filesystems @@ -4,9 +4,9 @@ _run () { - _all_modules '/fs/(btrfs|cifs|exfat|ext4|f2fs|fat|hfs|hfsplus|isofs|jfs|nfs|nfsd|nilfs2|nls|ntfs3|udf|xfs|vboxsf)' - _all_modules '/(lib/|kernel|arch/*)/crypto' - _map _module crypto-crc32c crypto-crc32 libcrc32c configfs nls_cp437 nls_ascii + _all_mods '/fs/(btrfs|cifs|exfat|ext4|f2fs|fat|hfs|hfsplus|isofs|jfs|nfs|nfsd|nilfs2|nls|ntfs3|udf|xfs|vboxsf)' + _all_mods '/(lib/|kernel|arch/*)/crypto' + _map _mod crypto-crc32c crypto-crc32 libcrc32c configfs nls_cp437 nls_ascii _map _binary mkswap badblocks blkid debugfs dumpe2fs e2fsck \ e2image e2undo findfs fsck logsave mkfs.ext2 resize2fs chattr lsattr e2freefrag filefrag \ jfs_debugfs jfs_fsck jfs_fscklog jfs_logdump jfs_mkfs jfs_tune mkfs.xfs xfs_copy xfs_db xfs_estimate xfs_fsr xfs_io \ diff --git a/usr/lib/archboot/cpio/hooks/firmware b/usr/lib/archboot/cpio/hooks/firmware index 073350f22..9654c9a2e 100644 --- a/usr/lib/archboot/cpio/hooks/firmware +++ b/usr/lib/archboot/cpio/hooks/firmware @@ -7,7 +7,7 @@ _run () # add firmware files and licenses tar -C / --exclude=./lib/firmware/{amphion,"as102*",atusb,av7110,cadence,cavium,"cmmb*",cis,cpia2,cnm,"ct*","cxgb*","cmmb*",dabusb,dpaa2,dsp56k,"dvb*",edgeport,emi26,emi62,ess,"f2255usb*",go7007,"hfi1*",inside-secure,"isdbt*","keyspan*",korg,meson,"lgs8g75*","lt9611uxc*",moxa,"mts*","myri10ge*",myricom,nxp,ositech,"qat*",sb16,"s2250*","s5p-*","sms1*",rtl_bt,"tdmb*",ttusb-budget,ueagle-atm,"usbdux*",ti,ti-keystone,"v4l*",vicam,vxge,"whiteheat*",yam,yamaha,"*.txt*","*README*"} --hard-dereference -cpf - ./lib/firmware | tar -C "${_ROOTFS}" -xpf - _full_dir "/usr/share/licenses/linux-firmware" - _all_modules "/firmware/" + _all_mods "/firmware/" } # vim: set ft=sh ts=4 sw=4 et: diff --git a/usr/lib/archboot/cpio/hooks/hypervisor b/usr/lib/archboot/cpio/hooks/hypervisor index c170a3cc0..85959791b 100644 --- a/usr/lib/archboot/cpio/hooks/hypervisor +++ b/usr/lib/archboot/cpio/hooks/hypervisor @@ -4,7 +4,7 @@ _run () { - _all_modules '/hv/hv_*' + _all_mods '/hv/hv_*' } # vim: set ft=sh ts=4 sw=4 et: diff --git a/usr/lib/archboot/cpio/hooks/init b/usr/lib/archboot/cpio/hooks/init index ac9491b55..6ed85f360 100644 --- a/usr/lib/archboot/cpio/hooks/init +++ b/usr/lib/archboot/cpio/hooks/init @@ -4,7 +4,7 @@ _run() { ### init modules - _map _module vfat iso9660 nls_cp437 nls_ascii cdrom exfat + _map _mod vfat iso9660 nls_cp437 nls_ascii cdrom exfat _map _binary bash sh blkid mount mountpoint switch_root bsdcpio mkfs.btrfs setfont \ /usr/lib/systemd/systemd-udevd udevadm systemd-tmpfiles kmod insmod modprobe \ gzip uname cat cp dmesg grep ln ls mv rm umount lsblk rmmod cut sed find mkdir dialog diff --git a/usr/lib/archboot/cpio/hooks/kms b/usr/lib/archboot/cpio/hooks/kms index eac5aec0a..5e12ef034 100644 --- a/usr/lib/archboot/cpio/hooks/kms +++ b/usr/lib/archboot/cpio/hooks/kms @@ -11,11 +11,11 @@ _run () _full_dir "/usr/share/licenses/linux-firmware" ### kmx modules # AGP and DRM modules for GPUs - _map _all_modules '/drivers/char/agp/' '/drivers/gpu/drm/' + _map _all_mods '/drivers/char/agp/' '/drivers/gpu/drm/' # modules that implement the privacy screen interface # TODO: Replace with dynamic lookup of modules that depend on the drm_privacy_screen_register symbol # See https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio/-/issues/132 - _map _all_modules 'chromeos_privacy_screen?' 'thinkpad_acpi?' + _map _all_mods 'chromeos_privacy_screen?' 'thinkpad_acpi?' } # vim: set ft=sh ts=4 sw=4 et: diff --git a/usr/lib/archboot/cpio/hooks/mdadm b/usr/lib/archboot/cpio/hooks/mdadm index 3ce1e7012..349121444 100644 --- a/usr/lib/archboot/cpio/hooks/mdadm +++ b/usr/lib/archboot/cpio/hooks/mdadm @@ -4,7 +4,7 @@ _run () { - _all_modules -f 'dm-' 'drivers/md/*' + _all_mods -f 'dm-' 'drivers/md/*' _map _binary mdmon mdadm _file /etc/mdadm.conf _file /usr/share/mdadm/mdcheck diff --git a/usr/lib/archboot/cpio/hooks/net_common b/usr/lib/archboot/cpio/hooks/net_common index 440f751c3..40b713d25 100644 --- a/usr/lib/archboot/cpio/hooks/net_common +++ b/usr/lib/archboot/cpio/hooks/net_common @@ -4,7 +4,7 @@ _run () { - _all_modules -f '_cs|b44|broadcom/bnx2x|brocade|cavium|chelsio|cisco|netronome|mellanox|myricom|qlogic|qualcomm' '/drivers/net/ethernet|/net/ipv4|/net/ipv6|/drivers/net/usb' + _all_mods -f '_cs|b44|broadcom/bnx2x|brocade|cavium|chelsio|cisco|netronome|mellanox|myricom|qlogic|qualcomm' '/drivers/net/ethernet|/net/ipv4|/net/ipv6|/drivers/net/usb' _map _binary ip getent ping _file_rename /usr/bin/archboot-network.sh /usr/bin/network # start dhcpcd on startup diff --git a/usr/lib/archboot/cpio/hooks/platform b/usr/lib/archboot/cpio/hooks/platform index 1f802450b..d53af4aba 100644 --- a/usr/lib/archboot/cpio/hooks/platform +++ b/usr/lib/archboot/cpio/hooks/platform @@ -4,7 +4,7 @@ _run () { - _all_modules -f 'media' '/platform/' + _all_mods -f 'media' '/platform/' } # vim: set ft=sh ts=4 sw=4 et: diff --git a/usr/lib/archboot/cpio/hooks/wireless b/usr/lib/archboot/cpio/hooks/wireless index dc41aa12f..29e699189 100644 --- a/usr/lib/archboot/cpio/hooks/wireless +++ b/usr/lib/archboot/cpio/hooks/wireless @@ -4,10 +4,10 @@ _run () { - _all_modules -f '_cs|b43' '/net/wireless/|/net/ieee80211/|/net/mac80211/' + _all_mods -f '_cs|b43' '/net/wireless/|/net/ieee80211/|/net/mac80211/' if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then # add broadcom wl support - _module wl.ko + _mod wl.ko _map _file /usr/lib/modprobe.d/broadcom-wl.conf \ /usr/share/licenses/broadcom-wl/LICENSE fi