mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 06:28:39 +00:00
Keep gp106/bar2_setup.py compatible with _binary_path and NV_RS_ORIGINAL_BINARY
- Honor NV_RS_ORIGINAL_BINARY in tools/_binary_path.py::resolve_580_binary(). - Add tools/ to sys.path in tools/gp106/bar2_setup.py::load_harness() before exec'ing tools/check_gpu_bar2_setup_binary.py and patch ORIGINAL = resolve_580_binary() with the resolved binary path.
This commit is contained in:
@ -35,7 +35,11 @@ def verify_580_binary(path: Path, expected_sha256: str = REFERENCE_580_SHA256) -
|
||||
def resolve_580_binary(*, verify: bool = False) -> Path:
|
||||
"""Resolve `nv-kernel.o_binary` via env overrides, local target, system `/usr/src`, or legacy path."""
|
||||
path: Path | None = None
|
||||
explicit = os.environ.get("NV_RS_580_BINARY") or os.environ.get("NV_RS_ORIGINAL")
|
||||
explicit = (
|
||||
os.environ.get("NV_RS_580_BINARY")
|
||||
or os.environ.get("NV_RS_ORIGINAL_BINARY")
|
||||
or os.environ.get("NV_RS_ORIGINAL")
|
||||
)
|
||||
if explicit:
|
||||
path = Path(explicit)
|
||||
else:
|
||||
|
||||
@ -43,18 +43,24 @@ BUS_BYTES, GPU_BYTES = 0xB400, 0x1000
|
||||
|
||||
def load_harness():
|
||||
"""Definitions of the frozen GV100 harness, with the binary path injected."""
|
||||
local = ROOT / "target/reference-580.178.04/kernel/nvidia/nv-kernel.o_binary"
|
||||
default = (
|
||||
local
|
||||
if local.is_file()
|
||||
else Path("/home/geodd/nvidia-driver/analysis-580.178.04/extracted/kernel/nvidia/nv-kernel.o_binary")
|
||||
)
|
||||
binary = Path(os.environ.get("NV_RS_ORIGINAL_BINARY", os.environ.get("NV_RS_ORIGINAL", default)))
|
||||
tools_dir = str(ROOT / "tools")
|
||||
if tools_dir not in sys.path:
|
||||
sys.path.insert(0, tools_dir)
|
||||
from _binary_path import resolve_580_binary
|
||||
|
||||
binary = resolve_580_binary()
|
||||
if not binary.is_absolute():
|
||||
binary = (ROOT / binary).resolve()
|
||||
source = HARNESS.read_text()
|
||||
source = re.sub(r"^ORIGINAL = Path\(.*\)$", "ORIGINAL = Path(%r)" % str(binary),
|
||||
source, count=1, flags=re.M)
|
||||
source, replaced = re.subn(
|
||||
r"^ORIGINAL = (?:Path\(.*\)|resolve_580_binary\(.*\))$",
|
||||
"ORIGINAL = Path(%r)" % str(binary),
|
||||
source,
|
||||
count=1,
|
||||
flags=re.M,
|
||||
)
|
||||
if replaced != 1:
|
||||
raise SystemExit("the frozen GV100 harness no longer has a patchable ORIGINAL assignment")
|
||||
head, marker, _ = source.partition("\nrows = []\n")
|
||||
if not marker:
|
||||
raise SystemExit("the frozen GV100 harness no longer has its case-list marker")
|
||||
|
||||
Reference in New Issue
Block a user