add modules setup
This commit is contained in:
parent
6b773a22e2
commit
f6a85fce46
1 changed files with 58 additions and 0 deletions
58
lib/set_MODULES.sh
Normal file
58
lib/set_MODULES.sh
Normal file
|
@ -0,0 +1,58 @@
|
|||
#!/bin/bash
|
||||
|
||||
function set_MODULES () {
|
||||
# Get the config paths
|
||||
source "$SCRIPTDIR/lib/paths.sh"
|
||||
|
||||
# Write "/etc/modules"
|
||||
printf "vfio
|
||||
vfio_iommu_type1
|
||||
vfio_pci ids=$1
|
||||
vfio_virqfd
|
||||
" >> "$SCRIPTDIR/$MODULES"
|
||||
|
||||
# Write "/etc/initramfs-tools/modules"
|
||||
printf "vfio
|
||||
vfio_iommu_type1
|
||||
vfio_pci
|
||||
vfio_virqfd
|
||||
" >> "$SCRIPTDIR/$INITRAMFS/modules"
|
||||
|
||||
# Assign the GPU device ids to a variable
|
||||
GPU_DEVID="$1"
|
||||
|
||||
# Ask if we shall disable video output on this card
|
||||
read "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"
|
||||
;;
|
||||
[Nn]*)
|
||||
echo ""
|
||||
;;
|
||||
*)
|
||||
GPU_DEVID="$GPU_DEVID disable_vga=1"
|
||||
;;
|
||||
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=$GPU_DEVID
|
||||
softdep nvidia pre: vfio vfio_pci
|
||||
softdep nouveau pre: vfio vfio_pci
|
||||
softdep amdgpu pre: vfio vfio_pci
|
||||
softdep radeon pre: vfio vfio_pci
|
||||
" > "$SCRIPTDIR/$MODPROBE/vfio.conf"
|
||||
|
||||
exec "$SCRIPTDIR/lib/get_USB_CTL.sh"
|
||||
}
|
||||
|
||||
|
||||
function main () {
|
||||
SCRIPTDIR=$(dirname `which $0` | perl -pe "s/\/\.\.\/lib//")
|
||||
SCRIPTDIR="$SCRIPTDIR/.."
|
||||
set_MODULES $1
|
||||
}
|
||||
|
||||
main $1
|
Loading…
Add table
Add a link
Reference in a new issue