Upstream series415 (#22)

new patch for 415.18 and 415.25
This commit is contained in:
Vladislav Yarmak 2019-01-04 21:59:11 +02:00 committed by GitHub
parent da34ae5167
commit b356c879d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 14 deletions

View File

@ -18,7 +18,8 @@ Requirements:
- [410.73](https://download.nvidia.com/XFree86/Linux-x86_64/410.73/NVIDIA-Linux-x86_64-410.73.run)
- [410.78](https://download.nvidia.com/XFree86/Linux-x86_64/410.78/NVIDIA-Linux-x86_64-410.78.run)
- [410.79](https://uk.download.nvidia.com/tesla/410.79/NVIDIA-Linux-x86_64-410.79.run)
- [415.18](https://download.nvidia.com/XFree86/Linux-x86_64/415.18/NVIDIA-Linux-x86_64-415.18.run)
- [415.25](https://download.nvidia.com/XFree86/Linux-x86_64/415.25/NVIDIA-Linux-x86_64-415.25.run)
Tested on Ubuntu 18.04 LTS (GNU/Linux 4.15.0-23-generic x86\_64)

View File

@ -48,6 +48,24 @@ declare -A patch_list=(
["410.73"]='s/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
["410.78"]='s/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
["410.79"]='s/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
["415.18"]='s/\x00\x00\x00\x84\xc0\x0f\x84\x40\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
["415.25"]='s/\x00\x00\x00\x84\xc0\x0f\x84\x40\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
)
declare -A object_list=(
["375.39"]='libnvidia-encode.so'
["390.87"]='libnvidia-encode.so'
["396.24"]='libnvidia-encode.so'
["396.26"]='libnvidia-encode.so'
["396.37"]='libnvidia-encode.so'
["396.54"]='libnvidia-encode.so'
["410.48"]='libnvidia-encode.so'
["410.57"]='libnvidia-encode.so'
["410.73"]='libnvidia-encode.so'
["410.78"]='libnvidia-encode.so'
["410.79"]='libnvidia-encode.so'
["415.18"]='libnvcuvid.so'
["415.25"]='libnvcuvid.so'
)
driver_version=$(/usr/bin/nvidia-smi --query-gpu=driver_version --format=csv,noheader,nounits | head -n 1)
@ -58,9 +76,10 @@ fi
echo "Detected nvidia driver version: $driver_version"
patch=${patch_list[$driver_version]}
patch="${patch_list[$driver_version]}"
object="${object_list[$driver_version]}"
if [[ ! $patch ]]; then
if [[ ( ! "$patch" ) || ( ! "$object" ) ]]; then
echo "Patch for this ($driver_version) nvidia driver not found." 1>&2
echo "Available patches for: " 1>&2
for drv in "${!patch_list[@]}"; do
@ -70,25 +89,25 @@ if [[ ! $patch ]]; then
fi
if [[ $rollback_flag ]]; then
if [[ -f $backup_path/libnvidia-encode.so.$driver_version ]]; then
cp -p $backup_path/libnvidia-encode.so.$driver_version \
$driver_dir/libnvidia-encode.so.$driver_version
echo "Restore from backup libnvidia-encode.so.$driver_version"
if [[ -f $backup_path/"$object".$driver_version ]]; then
cp -p $backup_path/"$object".$driver_version \
$driver_dir/"$object".$driver_version
echo "Restore from backup $object.$driver_version"
else
echo "Backup not found. Try to patch first."
exit 1;
fi
else
if [[ ! -f $backup_path/libnvidia-encode.so.$driver_version ]]; then
if [[ ! -f $backup_path/"$object".$driver_version ]]; then
echo "Attention! Backup not found. Copy current libnvidia-encode to backup."
mkdir -p $backup_path
cp -p $driver_dir/libnvidia-encode.so.$driver_version \
$backup_path/libnvidia-encode.so.$driver_version
cp -p $driver_dir/"$object".$driver_version \
$backup_path/"$object".$driver_version
fi
sha1sum $backup_path/libnvidia-encode.so.$driver_version
sed "$patch" $backup_path/libnvidia-encode.so.$driver_version > \
$driver_dir/libnvidia-encode.so.$driver_version
sha1sum $driver_dir/libnvidia-encode.so.$driver_version
sha1sum $backup_path/"$object".$driver_version
sed "$patch" $backup_path/"$object".$driver_version > \
$driver_dir/"$object".$driver_version
sha1sum $driver_dir/"$object".$driver_version
ldconfig
echo "Patched!"
fi