]> git.ipfire.org Git - thirdparty/dracut.git/blob - modules.d/90kernel-modules/module-setup.sh
Fix boot with `fips` without a value
[thirdparty/dracut.git] / modules.d / 90kernel-modules / module-setup.sh
1 #!/bin/bash
2
3 # called by dracut
4 installkernel() {
5 find_kernel_modules_external () {
6 local _OLDIFS
7 local external_pattern="^/"
8
9 [[ -f "$srcmods/modules.dep" ]] || return 0
10
11 _OLDIFS=$IFS
12 IFS=:
13 while read a rest; do
14 [[ $a =~ $external_pattern ]] || continue
15 printf "%s\n" "$a"
16 done < "$srcmods/modules.dep"
17 IFS=$_OLDIFS
18 }
19 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_add_host|scsi_add_host_with_dma'
20
21 if [[ -z $drivers ]]; then
22 hostonly='' instmods \
23 sr_mod sd_mod scsi_dh ata_piix hid_generic unix \
24 ehci-hcd ehci-pci ehci-platform \
25 ohci-hcd ohci-pci \
26 uhci-hcd \
27 xhci-hcd xhci-pci xhci-plat-hcd \
28 "=drivers/pinctrl" \
29 ${NULL}
30
31 hostonly=$(optional_hostonly) instmods \
32 "=drivers/hid" \
33 "=drivers/tty/serial" \
34 "=drivers/input/serio" \
35 "=drivers/input/keyboard" \
36 "=drivers/usb/storage" \
37 "=drivers/pci/host" \
38 ${NULL}
39
40 instmods \
41 yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
42 atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \
43 virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
44 "=drivers/pcmcia" =ide nvme vmd nfit
45
46 if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
47 # arm/aarch64 specific modules
48 _blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
49 instmods \
50 "=drivers/clk" \
51 "=drivers/dma" \
52 "=drivers/extcon" \
53 "=drivers/gpio" \
54 "=drivers/hwspinlock" \
55 "=drivers/i2c/busses" \
56 "=drivers/mfd" \
57 "=drivers/mmc/core" \
58 "=drivers/phy" \
59 "=drivers/power" \
60 "=drivers/regulator" \
61 "=drivers/rpmsg" \
62 "=drivers/rtc" \
63 "=drivers/soc" \
64 "=drivers/usb/chipidea" \
65 "=drivers/usb/dwc2" \
66 "=drivers/usb/dwc3" \
67 "=drivers/usb/host" \
68 "=drivers/usb/misc" \
69 "=drivers/usb/musb" \
70 "=drivers/usb/phy" \
71 "=drivers/scsi/hisi_sas" \
72 ${NULL}
73 fi
74
75 dracut_instmods -o -s "${_blockfuncs}" "=drivers"
76
77 find_kernel_modules_external | instmods
78
79 # if not on hostonly mode, install all known filesystems,
80 # if the required list is not set via the filesystems variable
81 if ! [[ $hostonly ]]; then
82 if [[ -z $filesystems ]]; then
83 dracut_instmods -o -P ".*/(kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd)/.*" '=fs'
84 fi
85 elif [[ "${host_fs_types[*]}" ]]; then
86 hostonly='' instmods "${host_fs_types[@]}"
87 fi
88 fi
89 :
90 }
91
92 # called by dracut
93 install() {
94 inst_multiple -o /lib/modprobe.d/*.conf
95 [[ $hostonly ]] && inst_multiple -H -o /etc/modprobe.d/*.conf /etc/modprobe.conf
96 if ! dracut_module_included "systemd"; then
97 inst_hook cmdline 01 "$moddir/parse-kernel.sh"
98 fi
99 inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
100 }