since kmod-25 keyword "external" was implemented in order to avoid additional actions(like weak-modules) when kernel was updated, which makes it more simple while kernels' kabi were compatible. but if move some special modules such as megaraid_sas, mpt3sas and so on, to a external path like /opt/modules, these modules will not be install to initramfs by default, which make the initramfs can't be used to boot for disk detection failure. according to kmod's document, you must specify a absolute path with "external" keyword, so scan the lines in modules.dep that begin with "/" and install them, to make sure necessary modules in external path can be installed to initramfs too. Signed-off-by: Hui Wang <john.wanghui@xxxxxxxxxx> --- modules.d/90kernel-modules/module-setup.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh index 35b4af7f..a197a606 100755 --- a/modules.d/90kernel-modules/module-setup.sh +++ b/modules.d/90kernel-modules/module-setup.sh @@ -2,6 +2,20 @@ # called by dracut installkernel() { + find_kernel_modules_external () { + local _OLDIFS + local external_pattern="^/" + + [[ -f "$srcmods/modules.dep" ]] || return 0 + + _OLDIFS=$IFS + IFS=: + while read a rest; do + [[ $a =~ $external_pattern ]] || continue + printf "%s\n" "$a" + done < "$srcmods/modules.dep" + IFS=$_OLDIFS + } 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' if [[ -z $drivers ]]; then @@ -26,7 +40,7 @@ installkernel() { virtio virtio_blk virtio_ring virtio_pci virtio_scsi \ "=drivers/pcmcia" =ide nvme vmd - if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then + if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then # arm/aarch64 specific modules _blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register' instmods \ @@ -50,12 +64,14 @@ installkernel() { "=drivers/usb/misc" \ "=drivers/usb/musb" \ "=drivers/usb/phy" \ - "=drivers/scsi/hisi_sas" \ + "=drivers/scsi/hisi_sas" \ ${NULL} fi dracut_instmods -o -s "${_blockfuncs}" "=drivers" + find_kernel_modules_external | instmods + # if not on hostonly mode, install all known filesystems, # if the required list is not set via the filesystems variable if ! [[ $hostonly ]]; then -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html