|
|
6df2a7 |
From 90d96c4f6a44d895f8999da8c4721a04612e6379 Mon Sep 17 00:00:00 2001
|
|
|
6df2a7 |
From: Kairui Song <kasong@redhat.com>
|
|
|
6df2a7 |
Date: Tue, 29 Oct 2019 16:29:14 +0800
|
|
|
6df2a7 |
Subject: [PATCH] 90kernel-modules: don't install any block driver if not
|
|
|
6df2a7 |
needed
|
|
|
6df2a7 |
|
|
|
6df2a7 |
If hostonly mode is in use, and there isn't any block device included
|
|
|
6df2a7 |
as hostonly device, then the initramfs won't need any block driver.
|
|
|
6df2a7 |
|
|
|
6df2a7 |
Eg. for kdump built image, there could be only one nfs mount point,
|
|
|
6df2a7 |
or the initramfs may only execute some network operation then reboot.
|
|
|
6df2a7 |
|
|
|
6df2a7 |
In such case, skip block driver installation to save space and time.
|
|
|
6df2a7 |
|
|
|
6df2a7 |
Signed-off-by: Kairui Song <kasong@redhat.com>
|
|
|
6df2a7 |
(cherry picked from commit f4ad2e5c8964b6c7b50420299a0096bade6a40bd)
|
|
|
6df2a7 |
|
|
|
6df2a7 |
Resolves: #1776659
|
|
|
6df2a7 |
---
|
|
|
6df2a7 |
modules.d/90kernel-modules/module-setup.sh | 32 +++++++++++++++++++++++-------
|
|
|
6df2a7 |
1 file changed, 25 insertions(+), 7 deletions(-)
|
|
|
6df2a7 |
|
|
|
6df2a7 |
diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh
|
|
|
6df2a7 |
index 3dfceff0..c91ba10c 100755
|
|
|
6df2a7 |
--- a/modules.d/90kernel-modules/module-setup.sh
|
|
|
6df2a7 |
+++ b/modules.d/90kernel-modules/module-setup.sh
|
|
|
6df2a7 |
@@ -2,6 +2,8 @@
|
|
|
6df2a7 |
|
|
|
6df2a7 |
# called by dracut
|
|
|
6df2a7 |
installkernel() {
|
|
|
6df2a7 |
+ 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'
|
|
|
6df2a7 |
+
|
|
|
6df2a7 |
find_kernel_modules_external () {
|
|
|
6df2a7 |
local _OLDIFS
|
|
|
6df2a7 |
local external_pattern="^/"
|
|
|
6df2a7 |
@@ -16,11 +18,25 @@ installkernel() {
|
|
|
6df2a7 |
done < "$srcmods/modules.dep"
|
|
|
6df2a7 |
IFS=$_OLDIFS
|
|
|
6df2a7 |
}
|
|
|
6df2a7 |
- 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'
|
|
|
6df2a7 |
+
|
|
|
6df2a7 |
+ is_block_dev() {
|
|
|
6df2a7 |
+ [ -e /sys/dev/block/$1 ] && return 0
|
|
|
6df2a7 |
+ return 1
|
|
|
6df2a7 |
+ }
|
|
|
6df2a7 |
+
|
|
|
6df2a7 |
+ install_block_modules () {
|
|
|
6df2a7 |
+ hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix
|
|
|
6df2a7 |
+ instmods \
|
|
|
6df2a7 |
+ scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
|
|
|
6df2a7 |
+ =ide nvme vmd nfit \
|
|
|
6df2a7 |
+ virtio_blk
|
|
|
6df2a7 |
+
|
|
|
6df2a7 |
+ dracut_instmods -o -s "${_blockfuncs}" "=drivers"
|
|
|
6df2a7 |
+ }
|
|
|
6df2a7 |
|
|
|
6df2a7 |
if [[ -z $drivers ]]; then
|
|
|
6df2a7 |
hostonly='' instmods \
|
|
|
6df2a7 |
- sr_mod sd_mod scsi_dh ata_piix hid_generic unix \
|
|
|
6df2a7 |
+ hid_generic unix \
|
|
|
6df2a7 |
ehci-hcd ehci-pci ehci-platform \
|
|
|
6df2a7 |
ohci-hcd ohci-pci \
|
|
|
6df2a7 |
uhci-hcd \
|
|
|
6df2a7 |
@@ -38,10 +54,10 @@ installkernel() {
|
|
|
6df2a7 |
${NULL}
|
|
|
6df2a7 |
|
|
|
6df2a7 |
instmods \
|
|
|
6df2a7 |
- yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
|
|
|
6df2a7 |
+ yenta_socket \
|
|
|
6df2a7 |
atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \
|
|
|
6df2a7 |
- virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
|
|
|
6df2a7 |
- "=drivers/pcmcia" =ide nvme vmd nfit
|
|
|
6df2a7 |
+ virtio virtio_ring virtio_pci virtio_scsi \
|
|
|
6df2a7 |
+ "=drivers/pcmcia"
|
|
|
6df2a7 |
|
|
|
6df2a7 |
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
|
|
|
6df2a7 |
# arm/aarch64 specific modules
|
|
|
6df2a7 |
@@ -72,10 +88,12 @@ installkernel() {
|
|
|
6df2a7 |
${NULL}
|
|
|
6df2a7 |
fi
|
|
|
6df2a7 |
|
|
|
6df2a7 |
- dracut_instmods -o -s "${_blockfuncs}" "=drivers"
|
|
|
6df2a7 |
-
|
|
|
6df2a7 |
find_kernel_modules_external | instmods
|
|
|
6df2a7 |
|
|
|
6df2a7 |
+ if ! [[ $hostonly ]] || for_each_host_dev_and_slaves is_block_dev; then
|
|
|
6df2a7 |
+ install_block_modules
|
|
|
6df2a7 |
+ fi
|
|
|
6df2a7 |
+
|
|
|
6df2a7 |
# if not on hostonly mode, install all known filesystems,
|
|
|
6df2a7 |
# if the required list is not set via the filesystems variable
|
|
|
6df2a7 |
if ! [[ $hostonly ]]; then
|
|
|
6df2a7 |
|