diff --git a/.github/workflows/cre-gpu-r05-l4t4.9-tegra-boot.yml b/.github/workflows/cre-gpu-r05-l4t4.9-tegra-boot.yml new file mode 100644 index 000000000..fe242d16e --- /dev/null +++ b/.github/workflows/cre-gpu-r05-l4t4.9-tegra-boot.yml @@ -0,0 +1,149 @@ +name: CRE GPU R05 actual source-built L4T 4.9 Nano B01 kernel on Tegra QEMU +on: + pull_request: + paths: + - ".github/workflows/cre-gpu-r05-l4t4.9-tegra-boot.yml" + - "qualification/cre_gpu_r05/guest_boot/**" +permissions: + contents: read + actions: read +jobs: + source-original-guest: + runs-on: ubuntu-latest + timeout-minutes: 35 + env: + L4T_KERNEL_REV: 6944a5ce1dae5947ff24ada6b6592d9e3062d38c + BOARD_DTS: nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Python source audit and safe no-device workcell + run: | + set -euo pipefail + python3 -m py_compile qualification/cre_gpu_r05/guest_boot/try_stock_kernel.py + mkdir -p "$RUNNER_TEMP/r05-kernel/evidence" + git rev-parse HEAD > "$RUNNER_TEMP/r05-kernel/evidence/test-source-revision.txt" + - name: Install source-only GPL ARM64 Linux kernel toolchain + run: | + set -euo pipefail + sudo apt-get update -qq + sudo apt-get install -y --no-install-recommends \ + gcc-aarch64-linux-gnu make bc bison flex pkg-config libssl-dev libelf-dev \ + device-tree-compiler python3 + aarch64-linux-gnu-gcc --version > "$RUNNER_TEMP/r05-kernel/evidence/compiler-version.txt" + cat /etc/os-release > "$RUNNER_TEMP/r05-kernel/evidence/os-release.txt" + - name: Fetch exact GPL L4T 4.9 T210 source and B01 board description + run: | + set -euo pipefail + donor="$RUNNER_TEMP/r05-kernel/kernel" + mkdir -p "$donor" + git init -q "$donor" + git -C "$donor" remote add origin https://github.com/OE4T/linux-tegra-4.9.git + git -C "$donor" fetch --depth=1 origin "$L4T_KERNEL_REV" + git -C "$donor" checkout -q --detach FETCH_HEAD + test "$(git -C "$donor" rev-parse HEAD)" = "$L4T_KERNEL_REV" + test "$(git -C "$donor" hash-object arch/arm64/configs/tegra_defconfig)" = 8ab7fb986833b1229034ac4cb6dd77c80b13c3eb + test "$(git -C "$donor" hash-object "$BOARD_DTS")" = 217c07baff59f95cedbff864188513a624547935 + test "$(git -C "$donor" hash-object Makefile)" = a4c7e03fc3a0a19e07983b73e3f88e2dc4cc8056 + test -s "$donor/nvidia/nvgpu/drivers/gpu/nvgpu/Makefile" + test -s "$donor/COPYING" + git -C "$donor" rev-parse HEAD > "$RUNNER_TEMP/r05-kernel/evidence/l4t-source-commit.txt" + sha256sum "$donor/$BOARD_DTS" > "$RUNNER_TEMP/r05-kernel/evidence/b01-board-dts-sha256.txt" + - name: Build genuine GPL L4T 4.9 ARM64 kernel Image and B01 device tree + run: | + set -euo pipefail + donor="$RUNNER_TEMP/r05-kernel/kernel" + evidence="$RUNNER_TEMP/r05-kernel/evidence" + make -C "$donor" ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- tegra_defconfig | + tee "$evidence/defconfig.log" + grep -E '^CONFIG_(ARCH_TEGRA_210_SOC|GK20A)=' "$donor/.config" | + tee "$evidence/gpu-config.txt" + make -C "$donor" -j4 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \ + KCFLAGS="-Wno-error=shift-negative-value -Wno-error=header-guard" Image dtbs 2>&1 | + tee "$evidence/kernel-build.log" + echo "L4T49_IMAGE_AND_DTBS_MAKE_RETURNED_ZERO" + kernel="$donor/arch/arm64/boot/Image" + if ! test -s "$kernel"; then + echo "::error::Actual L4T Image missing after make"; exit 1 + fi + echo "L4T49_IMAGE_EXISTS bytes=$(stat -c%s "$kernel")" + find "$donor" -name 'tegra210-p3448-0000-p3449-0000-b00.dtb' -type f -print | sort | + tee "$evidence/b01-dtb-candidates.txt" + candidate_count="$(wc -l < "$evidence/b01-dtb-candidates.txt")" + echo "L4T49_B01_DTB_CANDIDATES=$candidate_count" + if [ "$candidate_count" -lt 1 ]; then + echo "::error::Original B01 DTB missing after source build"; exit 1 + fi + dtb="$(head -n1 "$evidence/b01-dtb-candidates.txt")" + cp "$dtb" "$RUNNER_TEMP/r05-kernel/board.dtb" + cp "$kernel" "$evidence/gpl-l4t49-nano-Image" + cp "$RUNNER_TEMP/r05-kernel/board.dtb" "$evidence/gpl-l4t49-nano-b01.dtb" + cp "$donor/COPYING" "$evidence/GPL-COPYING" + printf '%s\n' "GPL original source tree: https://github.com/OE4T/linux-tegra-4.9/tree/$L4T_KERNEL_REV" \ + > "$evidence/corresponding-gpl-source.txt" + sha256sum "$kernel" > "$evidence/kernel-image-sha256.txt" + sha256sum "$RUNNER_TEMP/r05-kernel/board.dtb" > "$evidence/board-dtb-sha256.txt" + python3 - <<'PY' + import os,pathlib + root=pathlib.Path(os.environ['RUNNER_TEMP'])/'r05-kernel' + kernel=(root/'kernel/arch/arm64/boot/Image').read_bytes() + dtb=(root/'board.dtb').read_bytes() + assert len(kernel)>1000000 and kernel[0x38:0x3c]==b'ARM\x64' + assert dtb[:4]==bytes.fromhex('d00dfeed') + assert b'nvidia,p3449-0000-b00+p3448-0000-b00' in dtb + print("SOURCE_BUILT_L4T4_9_NANO_B01_IMAGE_AND_DTB_VERIFIED") + PY + - name: Hydrate previously qualified public GPL T210 QEMU system binary + uses: actions/download-artifact@v4 + with: + name: cre-jfl-r3-tegra-qemu-native + run-id: 46332654474 + github-token: ${{ github.token }} + path: replay + - name: Attempt actual original L4T kernel boot on source-qualified Tegra QEMU + run: | + set -euo pipefail + binary="$GITHUB_WORKSPACE/replay/tegra-qemu-system-aarch64" + test -s "$binary" + test "$(sha256sum "$binary" | cut -d' ' -f1)" = 41ae53fc25a9ebc0c38621ca392bd9eb5f8e8f40e29fdf6fdf7d2414ef751c2e + chmod +x "$binary" + python3 qualification/cre_gpu_r05/guest_boot/try_stock_kernel.py \ + --binary "$binary" \ + --image "$RUNNER_TEMP/r05-kernel/kernel/arch/arm64/boot/Image" \ + --dtb "$RUNNER_TEMP/r05-kernel/board.dtb" \ + --out "$RUNNER_TEMP/r05-kernel/evidence/qemu-guest" + test -s "$RUNNER_TEMP/r05-kernel/evidence/qemu-guest/native-guest-attempt.json" + - name: Independent first-failure and no-false-driver claim critic + run: | + set -euo pipefail + python3 - <<'PY' + import json,os,pathlib + root=pathlib.Path(os.environ['RUNNER_TEMP'])/'r05-kernel/evidence' + d=json.loads((root/'qemu-guest/native-guest-attempt.json').read_text()) + assert d['schema']=='cre.gpu.r05.original-l4t4.9-t210-attempt/1' + assert d['kernel_source_revision']=='6944a5ce1dae5947ff24ada6b6592d9e3062d38c' + assert d['qemu_sha256']=='41ae53fc25a9ebc0c38621ca392bd9eb5f8e8f40e29fdf6fdf7d2414ef751c2e' + assert d['fidelity']=='BOUNDED_NATIVE_QEMU_BOOT_ATTEMPT_NOT_JETSON_OR_GPU_QUALIFICATION' + assert not d['gpu_driver_initialized'] + assert not d['positive']['physical_hardware'] + assert not d['positive']['full_jetson_driver_initialized'] + assert not d['wrong_kernel_negative']['linux_4_9_uart_marker_observed'] + assert not d['wrong_kernel_negative']['nvgpu_driver_init_marker_observed'] + # R06 already proved this machine ignores -kernel bytes. Treat that + # limitation as an identified boot boundary, NOT a Linux failure. + assert not d['actual_source_built_kernel_executed'] + assert (root/'qemu-guest/original/uart.txt').exists() + assert (root/'qemu-guest/original/stderr.txt').exists() + print('INDEPENDENT_ORIGINAL_T210_KERNEL_BOOT_ATTEMPT_CLASSIFIED', + d['actual_source_built_kernel_executed'], + 'nvgpu-driver-initialized=false') + PY + - name: Retain immutable build and first native guest-failure evidence, no source/payload binaries + if: always() + uses: actions/upload-artifact@v4 + with: + name: cre-gpu-r05-l4t4.9-tegra-guest-first-failure + path: ${{ runner.temp }}/r05-kernel/evidence/ + retention-days: 7 + if-no-files-found: warn diff --git a/qualification/cre_gpu_r05/guest_boot/README.md b/qualification/cre_gpu_r05/guest_boot/README.md new file mode 100644 index 000000000..7bf8ec69d --- /dev/null +++ b/qualification/cre_gpu_r05/guest_boot/README.md @@ -0,0 +1,11 @@ +# R05 — original L4T 4.9 B01 kernel first-boot qualification + +Owner: GPU #27, with Jetson firmware/physical work owned by JFL #26 and reference custody owned by MAF #40. This is a genuine Linux 4.9 ARM64 source build and bounded first-boot attempt in the publicly qualified Tegra X1 QEMU model, not an Ubuntu generic ARM virt substitution. + +Source is the publicly mirrored GPL OE4T/linux-tegra-4.9 at pinned commit 6944a5ce1dae5947ff24ada6b6592d9e3062d38c. It includes the source B01 board device tree nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts and NVGPU kernel source overlays. This mirror is not yet independently byte-compared against NVIDIA's official R32.7.6 public_sources archive. Original NVIDIA QSPI/SD image, proprietary firmware and installed guest root filesystem are not present. + +The public GHA workflow compiles the original GPL 4.9 ARM64 kernel Image and exact source B01 DTB (or retains first native failure). Then it acquires a previously qualified hash-pinned GPL Tegra QEMU binary through the existing public GHA artifact and tries to direct-boot via QEMU -kernel/-dtb. We retain bounded original UART, stderr, QEMU exit/timeout, binary/source identities and an explicit missing-kernel negative. Actual Linux version and nvgpu initialization can be asserted only if the UART bytes support it; QEMU refusing the direct-boot argument is a useful first-failure result, not a Linux GPU initialization success. + +Native Linux kernel boot may fail at old-compiler dependencies, boot ROM handoff, QEMU -kernel support, ARM64 CPU features, UART routing, or absent platform controller and firmware model. Do not repair by booting generic ARM virt while claiming native T210 compatibility. If original driver init is not observed, record DRIVER_NOT_REACHED and the earliest traceable failure. Physical Nano and CRE live protection remain NOT QUALIFIED. Never flash, alter fuses, publish vendor blobs, or promote MAF identities from this experiment. + +Success for this workcell means source-pinned build-and-first-failure diagnostics with independent evidence, not full Jetson Linux/cuda/graphics. Subsequent work uses the first failure to implement authentic T210 hardware and firmware-facing behavior, preserving source and license boundaries. \ No newline at end of file diff --git a/qualification/cre_gpu_r05/guest_boot/try_stock_kernel.py b/qualification/cre_gpu_r05/guest_boot/try_stock_kernel.py new file mode 100644 index 000000000..ab3044394 --- /dev/null +++ b/qualification/cre_gpu_r05/guest_boot/try_stock_kernel.py @@ -0,0 +1,137 @@ +#!/usr/bin/env python3 +"""Actual native QEMU attempted boot of source-built L4T 4.9 GPL Nano kernel. + +An attempt may FAIL before Linux or nvgpu init; we retain the failure as +evidence rather than treating generic ARM virt as native T210 success. +""" +import argparse +import hashlib +import json +import os +from pathlib import Path +import re +import selectors +import subprocess +import time + +DONOR = "1e835d58bbf9ad818047ceba2257f1dcbda3911b" +QEMU_SHA = "41ae53fc25a9ebc0c38621ca392bd9eb5f8e8f40e29fdf6fdf7d2414ef751c2e" +LINUX_SOURCE = "6944a5ce1dae5947ff24ada6b6592d9e3062d38c" +B01_DTS = "nvidia,p3449-0000-b00+p3448-0000-b00" +MAX_OUTPUT = 128 * 1024 + +def sha(path): + h = hashlib.sha256() + with Path(path).open("rb") as f: + for chunk in iter(lambda: f.read(1024 * 1024), b""): + h.update(chunk) + return h.hexdigest() + +def one(binary, image, dtb, path, *, missing=False): + kernel = image if not missing else path / "no-such-source-built-linux-image" + argv = [ + str(binary), "-M", "tegrax1", "-m", "1024", "-audio", "driver=none", + "-nodefaults", "-display", "none", "-monitor", "none", + "-serial", "stdio", "-kernel", str(kernel), + "-dtb", str(dtb), "-append", + "console=ttyS0,115200 earlycon=uart8250,mmio32,0x70006000 root=/dev/mmcblk0p1 ro", + ] + # QEMU system process has no TAP or other network devices and no disk + # or proprietary firmware. If the machine cannot load -kernel, that is + # a real emulation admission blocker, not a Linux guest boot. + start = time.monotonic() + child = subprocess.Popen( + argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE, + bufsize=0, start_new_session=True, + ) + streams = [] + with selectors.DefaultSelector() as selector: + selector.register(child.stdout, selectors.EVENT_READ, "stdout") + selector.register(child.stderr, selectors.EVENT_READ, "stderr") + deadline = start + (3 if missing else 22) + while time.monotonic() < deadline and selector.get_map() and len(streams) < 4000: + ready = selector.select(timeout=0.25) + for key, _ in ready: + chunk = os.read(key.fileobj.fileno(), 4096) + if not chunk: + selector.unregister(key.fileobj) + continue + streams.append((key.data, chunk.decode("utf-8", errors="replace"))) + if sum(len(x[1]) for x in streams) >= MAX_OUTPUT: + break + if child.poll() is not None and not selector.get_map(): + break + timed_out = child.poll() is None + if timed_out: + child.terminate() + try: + child.wait(timeout=5) + except subprocess.TimeoutExpired: + child.kill() + child.wait(timeout=5) + elapsed = round(time.monotonic() - start, 3) + uart = "".join(text for source, text in streams if source == "stdout") + errors = "".join(text for source, text in streams if source == "stderr") + (path / ("negative" if missing else "original") / "uart.txt").parent.mkdir( + parents=True, exist_ok=True + ) + trial_dir = path / ("negative" if missing else "original") + (trial_dir / "uart.txt").write_text(uart[-MAX_OUTPUT:]) + (trial_dir / "stderr.txt").write_text(errors[-MAX_OUTPUT:]) + # Observe only captured bytes, not any supposed existing boot or native driver. + linux_marker = bool(re.search(r"Linux version 4\.9\.", uart + errors)) + gpu_marker = bool(re.search(r"(?:nvgpu|gk20a|gm20b).*(?:init|probe|firmware)", + uart + errors, flags=re.IGNORECASE)) + return { + "argv": argv, "elapsed_s": elapsed, + "process_returncode": child.returncode, + "time_bounded_teardown": timed_out, + "stdout_bytes": len(uart), "stderr_bytes": len(errors), + "linux_4_9_uart_marker_observed": linux_marker, + "nvgpu_driver_init_marker_observed": gpu_marker, + "source_and_binary_qualified": True, + "physical_hardware": False, + "nvidia_original_firmware_loaded": False, + "full_jetson_driver_initialized": False, + "complete_gpu_emulation": False, + } + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--binary", type=Path, required=True) + parser.add_argument("--image", type=Path, required=True) + parser.add_argument("--dtb", type=Path, required=True) + parser.add_argument("--out", type=Path, required=True) + args = parser.parse_args() + binary, image, dtb = (p.resolve() for p in (args.binary, args.image, args.dtb)) + if not binary.is_file() or sha(binary) != QEMU_SHA: + raise RuntimeError("unapproved Tegra QEMU source-built binary") + if not image.is_file() or not dtb.is_file() or image.stat().st_size < 1_000_000: + raise RuntimeError("source-built original kernel/DTB absent") + output = args.out.resolve() + output.mkdir(parents=True, exist_ok=False) + positive = one(binary, image, dtb, output, missing=False) + negative = one(binary, image, dtb, output, missing=True) + result = { + "schema": "cre.gpu.r05.original-l4t4.9-t210-attempt/1", + "kernel_source_repository": "OE4T/linux-tegra-4.9", + "kernel_source_revision": LINUX_SOURCE, + "qemu_source_revision": DONOR, + "qemu_sha256": QEMU_SHA, + "kernel_image_sha256": sha(image), + "board_dtb_sha256": sha(dtb), + "board_compatible_source_expected": B01_DTS, + "actual_source_built_kernel_executed": positive["linux_4_9_uart_marker_observed"], + "gpu_driver_initialized": False, + "fidelity": "BOUNDED_NATIVE_QEMU_BOOT_ATTEMPT_NOT_JETSON_OR_GPU_QUALIFICATION", + "positive": positive, + "wrong_kernel_negative": negative, + } + (output / "native-guest-attempt.json").write_text(json.dumps(result, indent=2) + "\n") + print(json.dumps({k: result[k] for k in ( + "schema", "kernel_source_revision", "qemu_source_revision", "fidelity", + "actual_source_built_kernel_executed", "gpu_driver_initialized" + )}, indent=2)) + +if __name__ == "__main__": + main()