Split up scripts to reuse parts for other initramfs systems
This commit is contained in:
parent
9ab572032d
commit
898e1f7347
4 changed files with 103 additions and 52 deletions
37
lib/set_MODPROBE.sh
Executable file
37
lib/set_MODPROBE.sh
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
function set_MODPROBE () {
|
||||
# Get the config paths
|
||||
source "$SCRIPTDIR/lib/paths.sh"
|
||||
|
||||
# Assign the GPU device ids to a variable
|
||||
GPU_DEVID="$1"
|
||||
|
||||
# If VGA is disabled
|
||||
if grep -q "vfio_pci.disable_vga=1" "$SCRIPTDIR/config/kernel_args" ;
|
||||
then
|
||||
# Modify our GPU_DEVID line to containe disable_vga=1
|
||||
GPU_DEVID="${GPU_DEVID} disable_vga=1"
|
||||
fi
|
||||
|
||||
# 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/
|
||||
# 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
|
||||
softdep nouveau pre: vfio vfio_pci
|
||||
softdep amdgpu pre: vfio vfio_pci
|
||||
softdep radeon pre: vfio vfio_pci
|
||||
" "${GPU_DEVID}" > "$SCRIPTDIR/$MODPROBE/vfio.conf"
|
||||
}
|
||||
|
||||
function main () {
|
||||
SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//")
|
||||
|
||||
set_MODPROBE "$1"
|
||||
}
|
||||
|
||||
main "$1"
|
Loading…
Add table
Add a link
Reference in a new issue