Change modules to no longer be hardcoded for the graphic card.
Let the users control that instead with their bootloader
This commit is contained in:
parent
37b00d3b69
commit
ee3e886a3a
1 changed files with 13 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue