154 lines
4.8 KiB
XML
154 lines
4.8 KiB
XML
<?xml version='1.0' standalone='yes'?>
|
|
<!DOCTYPE PLUGIN [
|
|
<!ENTITY name "AMD-Vendor-Reset">
|
|
<!ENTITY author "ich777">
|
|
<!ENTITY version "2022.03.21">
|
|
<!ENTITY gitURL "https://raw.githubusercontent.com/&author;/unraid-amd-vendor-reset/master">
|
|
<!ENTITY pluginURL "&gitURL;/amd-vendor-reset.plg">
|
|
<!ENTITY plugin "/boot/config/plugins/amd-vendor-reset">
|
|
<!ENTITY emhttp "/usr/local/emhttp/plugins/AMD-Vendor-Reset">
|
|
]>
|
|
|
|
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" min="6.10.0-beta17">
|
|
|
|
<CHANGES>
|
|
|
|
###2022.03.21
|
|
- Added change for reset_method for Kernel 5.15+
|
|
|
|
###2021.06.23
|
|
- Changed package download repo
|
|
|
|
###2021.05.25
|
|
- Initial release
|
|
|
|
</CHANGES>
|
|
|
|
<FILE Name="&emhttp;/README.md">
|
|
<INLINE>
|
|
**AMD Vendor Reset**
|
|
|
|
This package contains the Vendor Reset module for Polaris, Vega10/20 and Navi10/12/14 cards by Adam Madsen and Geoffrey McRae. You can get more details here: https://github.com/gnif/vendor-reset
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<FILE Run="/bin/bash">
|
|
<INLINE>
|
|
|
|
KERNEL_V="$(uname -r)"
|
|
PACKAGE="gnif_vendor_reset-plugin-${KERNEL_V}"
|
|
DL_URL="https://github.com/ich777/unraid-amd-vendor-reset/releases/download/$KERNEL_V"
|
|
|
|
#Wait for Network and timeout after 30 seconds
|
|
HOST="8.8.8.8"
|
|
for i in {1..10}; do
|
|
ping -c1 $HOST &> /dev/null && break;
|
|
done
|
|
|
|
if [ ! -d "&plugin;/packages/${KERNEL_V%%-*}" ]; then
|
|
mkdir -p "&plugin;/packages/${KERNEL_V%%-*}"
|
|
fi
|
|
|
|
#Check for old packages
|
|
rm -rf $(ls -d &plugin;/packages/* | grep -v "${KERNEL_V%%-*}")
|
|
|
|
if [ ! -f "&plugin;/AMD-Vendor-Reset.png" ]; then
|
|
wget -q -nc --show-progress --progress=bar:force:noscroll -O "&plugin;/&name;.png" "https://raw.githubusercontent.com/ich777/docker-templates/master/ich777/images/gnif.png"
|
|
fi
|
|
|
|
download() {
|
|
#Download vendor-reset
|
|
if wget -q -nc --show-progress --progress=bar:force:noscroll -O "&plugin;/packages/${KERNEL_V%%-*}/${PACKAGE}-1.txz" "${DL_URL}/${PACKAGE}-1.txz" ; then
|
|
if [ "$(md5sum "&plugin;/packages/${KERNEL_V%%-*}/${PACKAGE}-1.txz" | cut -d ' ' -f1)" != "$(wget -qO- "${DL_URL}/${PACKAGE}-1.txz.md5" | cut -d ' ' -f1)" ]; then
|
|
echo
|
|
echo "-----ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR------"
|
|
echo "--------------------------------CHECKSUM ERROR!---------------------------------"
|
|
exit 1
|
|
fi
|
|
echo
|
|
echo "----------Successfully downloaded AMD Vendor Reset, please wait...!-----------"
|
|
else
|
|
echo
|
|
echo "-----ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR-----"
|
|
echo "----------------------Can't download AMD Vendor Reset--------------------------"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
check() {
|
|
if [ ! -f "&plugin;/packages/${KERNEL_V%%-*}/${PACKAGE}-1.txz" ]; then
|
|
echo
|
|
echo "-----------------Downloading AMD Vendor Reset, please wait...!----------------"
|
|
echo "----------This could take some time, please don't close this window!----------"
|
|
download
|
|
else
|
|
echo
|
|
echo "-----------------------AMD Vendor Reset found locally!------------------------"
|
|
fi
|
|
}
|
|
|
|
install() {
|
|
#Install AMD Vendor Reset
|
|
/sbin/installpkg "&plugin;/packages/${KERNEL_V%%-*}/${PACKAGE}-1.txz"
|
|
depmod -a
|
|
modprobe vendor_reset
|
|
}
|
|
|
|
#Check if AMD Vendor Reset is already downloaded
|
|
check
|
|
|
|
if [ ! -z "$(lsmod | grep "vendor_reset")" ]; then
|
|
modprobe vendor_reset
|
|
echo
|
|
echo "------------Nothing to do, AMD Vendor Reset is already installed!-------------"
|
|
echo
|
|
else
|
|
echo
|
|
echo "-----------------Installing AMD Vendor Reset, please wait...!-----------------"
|
|
install > /dev/null
|
|
echo
|
|
echo "----------------Installation of AMD Vendor Reset successful-------------------"
|
|
echo
|
|
fi
|
|
|
|
#Change reset_method for installed AMD VGA adapters for Kernel 5.15+
|
|
#https://github.com/gnif/vendor-reset/issues/46#issuecomment-992282166
|
|
TARGET_V="5.14.99"
|
|
COMPARE="$(uname -r | cut -d '-' -f1)
|
|
$TARGET_V"
|
|
if [ "$TARGET_V" != "$(echo "$COMPARE" | sort -V | tail -1)" ]; then
|
|
while read -r line
|
|
do
|
|
echo 'device_specific' > $(find /sys/bus/pci/devices/* -name "*$line")/reset_method
|
|
done <<< "$(lspci -nn | grep -E "VGA compatible controller|Display controller" | grep -E "AMD|ATI|Advanced Micro Devices" | awk '{print $1}')"
|
|
fi
|
|
|
|
#Install icon
|
|
if [ ! -f "&emhttp;/images/&name;.png" ]; then
|
|
if [ ! -d "&emhttp;/images" ]; then
|
|
mkdir -p &emhttp;/images
|
|
fi
|
|
cp &plugin;/&name;.png &emhttp;/images/
|
|
fi
|
|
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<FILE Run="/bin/bash" Method="remove">
|
|
<INLINE>
|
|
|
|
echo "----------------------------------------"
|
|
echo "-----Uninstalling AMD Vendor Reset------"
|
|
echo "----------------------------------------"
|
|
# Remove plugin related files
|
|
rm -rf &emhttp;
|
|
rm -rf &plugin;
|
|
echo
|
|
echo "----------------------------------------------------------------------------"
|
|
echo "---------AMD Vendor Reset uninstalled, please reboot your server!-----------"
|
|
echo "----------------------------------------------------------------------------"
|
|
echo
|
|
|
|
</INLINE>
|
|
</FILE>
|
|
</PLUGIN> |