mirror of
https://github.com/HikariKnight/quickpassthrough
synced 2025-06-28 05:58:00 +02:00
add directory paths into a config file
This commit is contained in:
parent
3b6f09ab59
commit
6b773a22e2
4 changed files with 74 additions and 16 deletions
|
@ -2,6 +2,9 @@
|
|||
|
||||
function get_GROUP () {
|
||||
clear
|
||||
# Get the config paths
|
||||
source "$SCRIPTDIR/lib/paths.sh"
|
||||
|
||||
printf "
|
||||
For this card to be passthrough-able, it must contain only:
|
||||
* The GPU/Graphic card
|
||||
|
@ -27,18 +30,18 @@ read -p "Enter the ids for all devices you want to passthrough: " GPU_DEVID
|
|||
|
||||
if [[ $GPU_DEVID =~ : ]];
|
||||
then
|
||||
# Make the directory
|
||||
mkdir "$SCRIPTDIR/config"
|
||||
|
||||
# Get the PCI ids
|
||||
PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "group $1" | cut -d " " -f 4 | perl -pe "s/\n/ /" | perl -pe "s/\s$//")
|
||||
|
||||
echo "# This is an autogenerated file that stubs your graphic card for use with vfio" > "$SCRIPTDIR/config/vfio.conf"
|
||||
echo "options vfio_pci ids=$GPU_DEVID" >> "$SCRIPTDIR/config/vfio.conf"
|
||||
echo "GPU_PCI_ID=($PCI_ID)" > "$SCRIPTDIR/config/qemu-vfio_vars.conf"
|
||||
echo "USB_CTL_ID=\"\"" >> "$SCRIPTDIR/config/qemu-vfio_vars.conf"
|
||||
local PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "group $1" | cut -d " " -f 4 | perl -pe "s/\n/ /" | perl -pe "s/\s$//")
|
||||
|
||||
exec "$SCRIPTDIR/lib/get_USB_CTL.sh"
|
||||
# Write the currently unused vfio config for quickemu
|
||||
printf "GPU_PCI_ID=($PCI_ID)
|
||||
USB_CTL_ID=\"\"" > "$SCRIPTDIR/$QUICKEMU/qemu-vfio_vars.conf"
|
||||
|
||||
# Get the PCI_ID
|
||||
local ROM_PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "vga" | grep -i "group $1" | cut -d " " -f 4)
|
||||
"$SCRIPTDIR/lib/get_GPU_ROM.sh" "$ROM_PCI_ID"
|
||||
|
||||
exec "$SCRIPTDIR/lib/set_MODULES.sh" $GPU_DEVID
|
||||
else
|
||||
exec "$SCRIPTDIR/lib/get_GPU.sh"
|
||||
fi
|
||||
|
@ -46,8 +49,9 @@ fi
|
|||
}
|
||||
|
||||
function main () {
|
||||
SCRIPTDIR=$(dirname `which $0`)
|
||||
SCRIPTDIR=$(dirname `which $0` | perl -pe "s/\/\.\.\/lib//")
|
||||
SCRIPTDIR="$SCRIPTDIR/.."
|
||||
|
||||
get_GROUP $1
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
function get_USB_CTL_GROUP () {
|
||||
clear
|
||||
# Get the config paths
|
||||
source "$SCRIPTDIR/lib/paths.sh"
|
||||
|
||||
printf "
|
||||
For this USB controller device to be passthrough-able, it must be the ONLY device in this group!
|
||||
|
||||
|
@ -23,7 +26,7 @@ then
|
|||
# Get the PCI ids
|
||||
PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "group $1" | cut -d " " -f 4)
|
||||
|
||||
exec perl -pi -e "s/USB_CTL_ID=\"\"/USB_CTL_ID=\"$PCI_ID\"/" "$SCRIPTDIR/config/qemu-vfio_vars.conf"
|
||||
exec perl -pi -e "s/USB_CTL_ID=\"\"/USB_CTL_ID=\"$PCI_ID\"/" "$SCRIPTDIR/$QUICKEMU/qemu-vfio_vars.conf"
|
||||
else
|
||||
exec "$SCRIPTDIR/lib/get_USB_CTL.sh"
|
||||
fi
|
||||
|
@ -31,8 +34,9 @@ fi
|
|||
}
|
||||
|
||||
function main () {
|
||||
SCRIPTDIR=$(dirname `which $0`)
|
||||
SCRIPTDIR=$(dirname `which $0` | perl -pe "s/\/\.\.\/lib//")
|
||||
SCRIPTDIR="$SCRIPTDIR/.."
|
||||
|
||||
get_USB_CTL_GROUP $1
|
||||
}
|
||||
|
||||
|
|
6
lib/paths.sh
Normal file
6
lib/paths.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
MODPROBE="config/etc/modprobe.d"
|
||||
INITRAMFS="config/etc/initramfs-tools"
|
||||
MODULES="config/etc/modules"
|
||||
DEFAULT="config/etc/default"
|
||||
QUICKEMU="config/quickemu"
|
Loading…
Add table
Add a link
Reference in a new issue