mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 14:38:47 +00:00
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Portable resolver for the reference NVIDIA 580.178.04 `nv-kernel.o_binary`."""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
LEGACY_580_BINARY = Path(
|
|
"/home/geodd/nvidia-driver/analysis-580.178.04/extracted/kernel/nvidia/nv-kernel.o_binary"
|
|
)
|
|
SYSTEM_580_CANDIDATES = (
|
|
Path("/usr/src/nvidia-580.178.04/nvidia/nv-kernel.o_binary"),
|
|
Path("/usr/src/nvidia-srv-580.178.04/nvidia/nv-kernel.o_binary"),
|
|
)
|
|
|
|
|
|
def resolve_580_binary() -> Path:
|
|
"""Resolve `nv-kernel.o_binary` via env overrides, system `/usr/src`, or legacy path."""
|
|
explicit = os.environ.get("NV_RS_580_BINARY")
|
|
if explicit:
|
|
return Path(explicit)
|
|
analysis_root = os.environ.get("NV_RS_ANALYSIS_ROOT")
|
|
if analysis_root:
|
|
cand = Path(analysis_root) / "extracted/kernel/nvidia/nv-kernel.o_binary"
|
|
if cand.is_file():
|
|
return cand
|
|
for cand in SYSTEM_580_CANDIDATES:
|
|
if cand.is_file():
|
|
return cand
|
|
return LEGACY_580_BINARY
|
|
|
|
|
|
if __name__ == "__main__":
|
|
p = resolve_580_binary()
|
|
print(f"resolved 580 binary: {p} (exists={p.is_file()})")
|