From 259437ca1f0b487b9e8466a72ad087c79e5323e7 Mon Sep 17 00:00:00 2001 From: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Date: Sun, 27 Feb 2022 19:43:27 +0100 Subject: [PATCH] add last script in chain --- lib/get_USB_CTL_GROUP.sh | 3 ++- lib/set_CMDLINE.sh | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100755 lib/set_CMDLINE.sh diff --git a/lib/get_USB_CTL_GROUP.sh b/lib/get_USB_CTL_GROUP.sh index d90ec6d..ca9bedf 100755 --- a/lib/get_USB_CTL_GROUP.sh +++ b/lib/get_USB_CTL_GROUP.sh @@ -26,7 +26,8 @@ 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/$QUICKEMU/qemu-vfio_vars.conf" + perl -pi -e "s/USB_CTL_ID=\"\"/USB_CTL_ID=\"$PCI_ID\"/" "$SCRIPTDIR/$QUICKEMU/qemu-vfio_vars.conf" + exec "$SCRIPTDIR/lib/set_CMDLINE.sh" else exec "$SCRIPTDIR/lib/get_USB_CTL.sh" fi diff --git a/lib/set_CMDLINE.sh b/lib/set_CMDLINE.sh new file mode 100755 index 0000000..3522294 --- /dev/null +++ b/lib/set_CMDLINE.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +function set_CMDLINE () { + clear + # Get the config paths + source "$SCRIPTDIR/lib/paths.sh" + + CMDLINE=$(cat "$SCRIPTDIR/config/kernel_args") + + printf "Configuration is now complete, however no changes have been done to your system. +The files needed have just been written to $SCRIPTDIR/config/etc + +At this point if you know what you are doing, you can use these files to enable VFIO on your system +and achieve GPU Passthrough with your VMs by moving them to the correct location and then updating your +initramfs and bootloader. + +For VFIO to work properly you need to make sure these kernel parameters are in your bootloader entry: +#-----------------------------------------------# +$CMDLINE +#-----------------------------------------------# + +Make sure that the files inside \"$SCRIPTDIR/config/etc\" are copied to your /etc +AND PLEASE MAKE A BACKUP FIRST! + +The files inside \"$SCRIPTDIR/$QUICKEMU\" are currently unused files, however they provide +the required information that the QuickEMU project can hook into and use to add support for VFIO enabled VMs. + +###################################################################### +#### In the future, when I have enough confirmation that this script works for other people. +#### This page will get replaced with a prompt asking if you want to apply the changes and make backups +#### of your current system config. +###################################################################### + +" +} + + +function main () { + SCRIPTDIR=$(dirname `which $0` | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//") + set_CMDLINE +} + +main \ No newline at end of file