kernel-modules: added hid-lcpower
[dracut.git] / modules.d / 90kernel-modules / module-setup.sh
blobeea30e694a82c48b80b216b8d470a1d078077858
1 #!/bin/bash
3 # called by dracut
4 installkernel() {
5 if [[ -z $drivers ]]; then
6 block_module_filter() {
7 local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_pltfm_init'
8 # subfunctions inherit following FDs
9 local _merge=8 _side2=9
10 function bmf1() {
11 local _f
12 while read _f; do case "$_f" in
13 *.ko) [[ $(< $_f) =~ $_blockfuncs ]] && echo "$_f" ;;
14 *.ko.gz) [[ $(gzip -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
15 *.ko.xz) [[ $(xz -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
16 esac
17 done
18 return 0
20 function rotor() {
21 local _f1 _f2
22 while read _f1; do
23 echo "$_f1"
24 if read _f2; then
25 echo "$_f2" 1>&${_side2}
27 done | bmf1 1>&${_merge}
28 return 0
30 # Use two parallel streams to filter alternating modules.
31 set +x
32 eval "( ( rotor ) ${_side2}>&1 | bmf1 ) ${_merge}>&1"
33 [[ $debug ]] && set -x
34 return 0
37 hostonly='' instmods \
38 sr_mod sd_mod scsi_dh ata_piix hid_generic unix \
39 ehci-hcd ehci-pci ehci-platform \
40 ohci-hcd ohci-pci \
41 uhci-hcd \
42 xhci-hcd
44 instmods yenta_socket scsi_dh_rdac scsi_dh_emc \
45 atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
46 hid-logitech-dj hid-microsoft hid-lcpower firewire-ohci \
47 pcmcia usb_storage nvme hid-hyperv hv-vmbus \
48 sdhci_acpi
50 if [[ "$(uname -p)" == arm* ]]; then
51 # arm specific modules
52 instmods \
53 "=drivers/i2c/busses" \
54 "=drivers/regulator" \
55 "=drivers/rtc" \
56 "=drivers/usb/host" \
57 "=drivers/usb/phy" \
58 ${NULL}
61 # install virtual machine support
62 instmods virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
63 "=drivers/pcmcia" =ide "=drivers/usb/storage"
65 find_kernel_modules | block_module_filter | instmods
67 # if not on hostonly mode, install all known filesystems,
68 # if the required list is not set via the filesystems variable
69 if ! [[ $hostonly ]]; then
70 if [[ -z $filesystems ]]; then
71 silent_omit_drivers="kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd" \
72 instmods '=fs'
74 else
75 for i in $(host_fs_all); do
76 hostonly='' instmods $i
77 done
83 # called by dracut
84 install() {
85 inst_multiple -o /lib/modprobe.d/*.conf
86 [[ $hostonly ]] && inst_multiple -H -o /etc/modprobe.d/*.conf /etc/modprobe.conf
87 if ! dracut_module_included "systemd"; then
88 inst_hook cmdline 01 "$moddir/parse-kernel.sh"
90 inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh