From ee3e886a3ab26ea2c3758af485db8b3913ad5ee7 Mon Sep 17 00:00:00 2001 From: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Date: Wed, 9 Mar 2022 15:03:40 +0100 Subject: [PATCH] Change modules to no longer be hardcoded for the graphic card. Let the users control that instead with their bootloader --- lib/set_MODULES.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/set_MODULES.sh b/lib/set_MODULES.sh index dda523f..9f66a15 100755 --- a/lib/set_MODULES.sh +++ b/lib/set_MODULES.sh @@ -9,9 +9,9 @@ function set_MODULES () { # Generated by vfio-setup vfio vfio_iommu_type1 -vfio_pci ids=%s +vfio_pci vfio_virqfd -" "$1" >> "$SCRIPTDIR/$MODULES" +" >> "$SCRIPTDIR/$MODULES" # Write "/etc/initramfs-tools/modules" printf " @@ -25,28 +25,35 @@ vfio_virqfd # Assign the GPU device ids to a variable GPU_DEVID="$1" - # Update the kernel_args file + # Get the kernel_args file content CMDLINE=$(cat "$SCRIPTDIR/config/kernel_args") - echo "${CMDLINE} vfio_pci.ids=$GPU_DEVID" > "$SCRIPTDIR/config/kernel_args" # Ask if we shall disable video output on this card read -p "Do you want to force disable video output in linux on this card? [Y/n]: " DISABLE_VGA case "${DISABLE_VGA}" in [Yy]*) GPU_DEVID="${GPU_DEVID} disable_vga=1" + + # Update kernel_args file + echo "${CMDLINE} vfio_pci.ids=${GPU_DEVID} vfio_pci.disable_vga=1" > "$SCRIPTDIR/config/kernel_args" ;; [Nn]*) echo "" ;; *) GPU_DEVID="${GPU_DEVID} disable_vga=1" + + # Update kernel_args file + echo "${CMDLINE} vfio_pci.ids=${GPU_DEVID} vfio_pci.disable_vga=1" > "$SCRIPTDIR/config/kernel_args" ;; esac # Write the vfio modprobe config printf "# This is an autogenerated file that stubs your graphic card for use with vfio -# This file should be placed inside /etc/modprobe.d/ -options vfio_pci ids=%s +## This file should be placed inside /etc/modprobe.d/ +# Uncomment the line below to \"hardcode\" your graphic card to be bound to the vfio-pci driver. +# In most cases this should not be neccessary, it will also prevent you from turning off vfio in the bootloader. +#options vfio_pci ids=%s # Make sure vfio_pci is loaded before these modules: nvidia, nouveau, amdgpu and radeon softdep nvidia pre: vfio vfio_pci