Let bhamd.cfg and bhimd.cfg

take care of loading kernel modules
This commit is contained in:
lukas 2021-08-19 10:19:00 +02:00
parent eb9e227a22
commit 70395410d6
3 changed files with 18 additions and 8 deletions

View File

@ -11,6 +11,16 @@
%post # Beginning of %post section
sed -i 's/\(quiet\)/\1 amd_iommu=on amd_iommu=pt rd.driver.pre=vfio-pci/i' /etc/default/grub # Load kernel modules in grub.
# Load kernel modules by adding vfio, vfio_pci, vfio_iommu_type1, vfio_virqfd
echo "vfio" > /etc/modules-load.d/vfio.conf
echo "vfio-pci" > /etc/modules-load.d/vfio-pci.conf
echo "vfio_iommu_type1" > /etc/modules-load.d/vfio_iommu_type1.conf
echo "vfio_virqfd" > /etc/modules-load.d/vfio_virqfd.conf
dracut --add-drivers " vfio vfio-pci vfio_iommu_type1 vfio_virqfd " --force # Instruct dracut to load the vfio drivers
dracut --force # Regenerate initramfs
dracut --force # Regenerate initramfs.
grub2-mkconfig -o /boot/grub2/grub.cfg # Update grub

View File

@ -11,11 +11,18 @@
%post # Beginning of %post section
sed -i 's/\(quiet\)/\1 intel_iommu=on iommu=pt rd.driver.pre=vfio-pci i915.enable_gvt=1/i' /etc/default/grub # Load kernel modules in grub.
# Load kernel modules by adding vfio, vfio_pci, vfio_iommu_type1, vfio_virqfd
echo "vfio" > /etc/modules-load.d/vfio.conf
echo "vfio-pci" > /etc/modules-load.d/vfio-pci.conf
echo "vfio_iommu_type1" > /etc/modules-load.d/vfio_iommu_type1.conf
echo "vfio_virqfd" > /etc/modules-load.d/vfio_virqfd.conf
echo "kvmgt" > /etc/modules-load.d/kvmgt.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm)
echo "vfio-mdev" > /etc/modules-load.d/vfio-mdev.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm)
dracut --add-drivers "vfio-mdev kvmgt" --force # Instruct dracut to load the vfio drivers:
dracut --add-drivers " vfio vfio-pci vfio_iommu_type1 vfio_virqfd vfio-mdev kvmgt " --force # Instruct dracut to load the vfio drivers
dracut --force # Regenerate initramfs
grub2-mkconfig -o /boot/grub2/grub.cfg # Update grub
%end # End of the %post section

View File

@ -24,13 +24,6 @@ guestfs-tools # Complementary tools useful for interacting with vith guest syste
%post # Beginning of %post section
# Load kernel modules by adding vfio, vfio_pci, vfio_iommu_type1, vfio_virqfd
echo "vfio" > /etc/modules-load.d/vfio.conf
echo "vfio-pci" > /etc/modules-load.d/vfio-pci.conf
echo "vfio_iommu_type1" > /etc/modules-load.d/vfio_iommu_type1.conf
echo "vfio_virqfd" > /etc/modules-load.d/vfio_virqfd.conf
dracut --add-drivers " vfio vfio-pci vfio_iommu_type1 vfio_virqfd " --force # Instruct dracut to load the vfio drivers
mkdir /var/lib/libvirt/iso # Create a directory to store iso images
# chown liveuser:liveuser /var/lib/libvirt/iso # Make the user "liveuser" the owner of this directory
virsh pool-create-as --name iso --type dir --target /var/lib/libvirt/iso # Make libvirt aware of this new directory by creating a so-called 'pool'