Fix NVIDIA module version selection and add load diagnostics

This commit is contained in:
Mikhail Chusavitin
2026-03-06 17:30:41 +03:00
parent a55b4108d5
commit f84ec9320c
5 changed files with 33 additions and 5 deletions

View File

@@ -20,12 +20,20 @@ DIST_DIR="$2"
[ -n "$NVIDIA_VERSION" ] || { echo "usage: $0 <nvidia-version> <dist-dir>"; exit 1; }
[ -n "$DIST_DIR" ] || { echo "usage: $0 <nvidia-version> <dist-dir>"; exit 1; }
# Detect kernel version from installed headers
KVER=$(ls /usr/src/ 2>/dev/null | grep '^linux-headers-' | sed 's/linux-headers-//' | head -1)
# Detect kernel version from installed headers (pick highest version if multiple).
detect_kver() {
ls /usr/src/ 2>/dev/null \
| grep '^linux-headers-' \
| sed 's/linux-headers-//' \
| sort -V \
| tail -1
}
KVER="$(detect_kver)"
if [ -z "$KVER" ]; then
echo "=== installing linux-lts-dev ==="
apk add --quiet linux-lts-dev
KVER=$(ls /usr/src/ | grep '^linux-headers-' | sed 's/linux-headers-//' | head -1)
KVER="$(detect_kver)"
fi
KDIR="/usr/src/linux-headers-${KVER}"
echo "=== NVIDIA ${NVIDIA_VERSION} (proprietary) for kernel ${KVER} ==="