Skip to content

Instantly share code, notes, and snippets.

@noahbliss
Created November 12, 2019 14:50
Show Gist options
  • Save noahbliss/75c7500c491c8b346b807b04fba7cb9f to your computer and use it in GitHub Desktop.
Save noahbliss/75c7500c491c8b346b807b04fba7cb9f to your computer and use it in GitHub Desktop.
Signs kernel module of proprietary NVIDIA driver on OpenSUSE.
#!/usr/bin/env bash
nvidiafile="$1"
# For OpenSUSE systems that are securebooted.
# You need the package: kernel-devel
# You need your own signing key in mok.
# sudo su
# cd
# openssl req -new -x509 -newkey rsa:2048 -keyout gpusigningkey.pri -outform DER -out gpusigningkey.pub -nodes -days 36500 -subj "/CN=Graphics Drivers"
# mokutil --import gpusigningkey.pub
# Usage: $0 NVIDIA-*.run
private=/root/gpusigningkey.pri
public=/root/gpusigningkey.pub
echo "Make sure the latest installed kernel is the same one that is running."
kver="$(uname -r)"
ln -s /usr/src/${kver%-*}-obj/x86_64/default/scripts/sign-file /lib/modules/"$kver"/source/scripts/sign-file
if [ -z $1 ]; then "Need to specify nvidia run file."; exit; fi
if [ $UID -ne "0" ]; then echo "Must be run as root."; exit; fi
"$1" -s --module-signing-secret-key="$private" --module-signing-public-key="$public"
@noahbliss
Copy link
Author

Good stuff, thanks! I'm not on OpenSUSE anymore but if you found this maybe others will and benefit from your update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment