Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nvidia-patch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
nvidia-patch
Commits
c56db4a5
Commit
c56db4a5
authored
Nov 24, 2023
by
Jai Luthra
Committed by
GitHub
Nov 24, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #734 from jailuthra/linux_action
GH Actions: Add workflow for linux autopatch
parents
4d06da0f
dad6ff50
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
158 additions
and
2 deletions
+158
-2
.github/workflows/gen_linux_patches.yml
.github/workflows/gen_linux_patches.yml
+153
-0
tools/autopatch/find_bytecode.sh
tools/autopatch/find_bytecode.sh
+5
-2
No files found.
.github/workflows/gen_linux_patches.yml
0 → 100644
View file @
c56db4a5
name
:
Generate Linux patches
on
:
workflow_dispatch
:
inputs
:
version
:
description
:
'
Driver
Version'
required
:
true
type
:
string
old_version
:
description
:
'
Old
Driver
Version'
required
:
false
type
:
string
driver_url
:
description
:
'
Driver
URL'
required
:
false
type
:
string
mode
:
description
:
'
Mode'
required
:
true
type
:
choice
default
:
search
options
:
-
copy
-
search
description
:
description
:
'
Commit
description'
required
:
false
type
:
string
permissions
:
contents
:
write
jobs
:
build
:
runs-on
:
ubuntu-latest
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
steps
:
-
name
:
Check Input
id
:
check_input
run
:
|
version="${{ inputs.version }}"
mode="${{ inputs.mode }}"
driver_url="${{ inputs.driver_url }}"
echo "Version: $version"
echo "Mode: $mode"
if [[ $version =~ ([0-9]+\.[0-9]+(-[a-zA-Z]+)?)(-.+)? ]]; then
echo "Valid version"
else
echo "Invalid driver version."
exit 1
fi
if [[ ! -n $driver_url ]]; then
driver_url="http://international.download.nvidia.com/XFree86/Linux-x86_64/$version/NVIDIA-Linux-x86_64-$version.run"
fi
echo "Driver URL: $driver_url"
echo "DRIVER_URL=$driver_url" >> $GITHUB_ENV
echo "VERSION=$version" >> $GITHUB_ENV
-
name
:
Checkout repository
uses
:
actions/checkout@v3
with
:
ref
:
master
-
name
:
Find Bytecode
if
:
${{ inputs.mode == 'search' }}
run
:
|
echo "Running find_bytecode.sh for version ${{ env.VERSION }}"
cd "${{ github.workspace }}/tools/autopatch"
./find_bytecode.sh ${{ env.VERSION }} ${{ env.DRIVER_URL }}
echo "find_bytecode.sh executed successfully"
-
name
:
Update NVENC
run
:
|
echo "Running update_patch.sh for version ${{ env.VERSION }}"
cd "${{ github.workspace }}/tools/autopatch"
old_version="${{ inputs.old_version }}"
case "${{ inputs.mode }}" in
search)
if [[ -z $old_version ]]; then
./update_patch.sh -f ../../patch.sh -b $(./find_bytecode.sh ${{ env.VERSION }} ${{ env.DRIVER_URL }})
else
./update_patch.sh -f ../../patch.sh -b $(./find_bytecode.sh ${{ env.VERSION }} ${{ env.DRIVER_URL }}) -o $old_version
fi
;;
copy)
if [[ -z $old_version ]]; then
./update_patch.sh -f ../../patch.sh -v ${{ env.VERSION }}
else
./update_patch.sh -f ../../patch.sh -v ${{ env.VERSION }} -o $old_version
fi
;;
*)
echo "ERROR: Wrong mode"
;;
esac
echo "update_patch.sh executed successfully"
-
name
:
Update NVFBC
run
:
|
echo "Running update_patch.sh for FBC for version ${{ env.VERSION }}"
cd "${{ github.workspace }}/tools/autopatch"
old_version="${{ inputs.old_version }}"
if [[ -z $old_version ]]; then
./update_patch.sh -f ../../patch-fbc.sh -v ${{ env.VERSION }}
else
./update_patch.sh -f ../../patch-fbc.sh -v ${{ env.VERSION }} -o $old_version
fi
echo "update_patch.sh for FBC executed successfully"
-
name
:
Run add_driver.py
run
:
|
echo "Running add_driver.py with version ${{ env.VERSION }}"
cd "${{ github.workspace }}/tools/readme-autogen"
python add_driver.py -L -U ${{ env.DRIVER_URL }} ${{ env.VERSION }}
echo "add_driver.py executed successfully"
-
name
:
Run readme_autogen.py
run
:
|
echo "Running readme_autogen.py"
cd "${{ github.workspace }}/tools/readme-autogen"
python readme_autogen.py
echo "readme_autogen.py executed successfully"
-
name
:
Commit and push changes
run
:
|
echo "Committing and pushing changes"
branch=autopatch_${{ env.VERSION }}
cd "${{ github.workspace }}"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git checkout -b $branch
git add -A
git diff --quiet --exit-code --cached || git commit -m "linux: add support for driver ${{ env.VERSION }}" -m "${{ inputs.description }}"
git push origin $branch
echo "Committed and pushed changes"
tools/autopatch/find_bytecode.sh
View file @
c56db4a5
...
@@ -13,19 +13,22 @@ driver_url=$2
...
@@ -13,19 +13,22 @@ driver_url=$2
driver_file
=
NVIDIA-Linux-x86_64-
$driver_version
.run
driver_file
=
NVIDIA-Linux-x86_64-
$driver_version
.run
download_driver
()
{
download_driver
()
{
wget
-c
$driver_url
-O
$driver_file
1>&2
wget
-
nv
-
c
$driver_url
-O
$driver_file
1>&2
chmod
+x
$driver_file
chmod
+x
$driver_file
>
&2
echo
"Successfully Downloaded Driver
$driver_file
"
}
}
extract_driver
()
{
extract_driver
()
{
if
[[
!
-e
${
driver_file
%
".run"
}
]]
;
then
if
[[
!
-e
${
driver_file
%
".run"
}
]]
;
then
./
$driver_file
-x
./
$driver_file
-x
fi
fi
>
&2
echo
"Successfully Extracted Driver
$driver_file
"
}
}
search_bytecode
()
{
search_bytecode
()
{
nvenc_file
=
${
driver_file
%
".run"
}
/libnvidia-encode.so.
$driver_version
nvenc_file
=
${
driver_file
%
".run"
}
/libnvidia-encode.so.
$driver_version
bytecode
=
$(
xxd
-c0
-ps
$nvenc_file
|
grep
-oP
".{0,6}
$MATCH_STR
"
)
bytecode
=
$(
xxd
-c10000000
-ps
$nvenc_file
|
grep
-oP
".{0,6}
$MATCH_STR
"
)
>
&2
echo
"Found bytecode
$bytecode
"
echo
$bytecode
echo
$bytecode
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment