Add more comments and convert some variables to local variables

This commit is contained in:
HikariKnight 2022-02-27 21:29:29 +01:00
parent 7f04af90d9
commit 2b52c744fe
No known key found for this signature in database
GPG key ID: E8B239063B022F5A
5 changed files with 8 additions and 5 deletions

View file

@ -33,7 +33,7 @@ then
# Get the PCI ids # Get the PCI ids
local PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "group $1" | cut -d " " -f 4 | perl -pe "s/\n/ /" | perl -pe "s/\s$//") local PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "group $1" | cut -d " " -f 4 | perl -pe "s/\n/ /" | perl -pe "s/\s$//")
# Write the currently unused vfio config for quickemu # Write the GPU_PCI_IDs to the config that quickemu might make use of in the future
printf "GPU_PCI_ID=($PCI_ID) printf "GPU_PCI_ID=($PCI_ID)
USB_CTL_ID=\"\" USB_CTL_ID=\"\"
" > "$SCRIPTDIR/$QUICKEMU/qemu-vfio_vars.conf" " > "$SCRIPTDIR/$QUICKEMU/qemu-vfio_vars.conf"

View file

@ -23,9 +23,9 @@ echo 0 | sudo tee $VBIOS_PATH
echo 1 | sudo tee $VBIOS_PATH echo 1 | sudo tee $VBIOS_PATH
sudo cat $VBIOS_PATH > "$SCRIPTDIR/$QUICKEMU/vfio_card.rom" sudo cat $VBIOS_PATH > "$SCRIPTDIR/$QUICKEMU/vfio_card.rom"
sudo md5sum $VBIOS_PATH | cut -d " " -f 1 > "$SCRIPTDIR/$QUICKEMU/vfio_card.rom.md5" sudo md5sum $VBIOS_PATH | cut -d " " -f 1 > "$SCRIPTDIR/$QUICKEMU/vfio_card.rom.md5"
ROM_MD5=$(sudo md5sum $VBIOS_PATH | cut -d " " -f 1) local ROM_MD5=$(sudo md5sum $VBIOS_PATH | cut -d " " -f 1)
echo 0 | sudo tee $VBIOS_PATH echo 0 | sudo tee $VBIOS_PATH
ROMFILE_MD5=$(md5sum "$SCRIPTDIR/$QUICKEMU/vfio_card.rom" | cut -d " " -f 1) local ROMFILE_MD5=$(md5sum "$SCRIPTDIR/$QUICKEMU/vfio_card.rom" | cut -d " " -f 1)
if [ -f $SCRIPTDIR/$QUICKEMU/vfio_card.rom ]; if [ -f $SCRIPTDIR/$QUICKEMU/vfio_card.rom ];
then then

View file

@ -24,8 +24,9 @@ read -p "Enter the id for the device you want to passthrough: " USB_CTL_DEVID
if [[ $USB_CTL_DEVID =~ : ]]; if [[ $USB_CTL_DEVID =~ : ]];
then then
# Get the PCI ids # Get the PCI ids
PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "group $1" | cut -d " " -f 4) local PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "group $1" | cut -d " " -f 4)
# Replace the blank USB_CTL_ID with the PCI_ID for the usb controller the user wants to pass through
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" exec "$SCRIPTDIR/lib/set_CMDLINE.sh"
else else

View file

@ -5,7 +5,7 @@ function set_CMDLINE () {
# Get the config paths # Get the config paths
source "$SCRIPTDIR/lib/paths.sh" source "$SCRIPTDIR/lib/paths.sh"
CMDLINE=$(cat "$SCRIPTDIR/config/kernel_args") local CMDLINE=$(cat "$SCRIPTDIR/config/kernel_args")
printf "Configuration is now complete, however no changes have been done to your system. 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 The files needed have just been written to $SCRIPTDIR/config/etc

View file

@ -63,9 +63,11 @@ then
rm -r "$SCRIPTDIR/config" rm -r "$SCRIPTDIR/config"
fi fi
# Get the CPU Vendor
CPU_VENDOR=$(cat /proc/cpuinfo | grep vendor | head -1 | cut -f 2 | cut -d " " -f 2) CPU_VENDOR=$(cat /proc/cpuinfo | grep vendor | head -1 | cut -f 2 | cut -d " " -f 2)
CMDLINE="iommu=pt" CMDLINE="iommu=pt"
# Adjust our kernel_args based on cpu vendor
if [ "$CPU_VENDOR" == "GenuineIntel" ]; if [ "$CPU_VENDOR" == "GenuineIntel" ];
then then
CMDLINE="$CMDLINE intel_iommu=on" CMDLINE="$CMDLINE intel_iommu=on"