Files
Jetson/scripts/detect_platform.sh
T
AngePierreandClaude Opus 5 c167c836e6 Portable Ithaca capture node: one install for every Jetson
Extract the install that was applied by hand to the Jetson Nano into a single
checkout that builds itself for whatever Jetson it lands on.

The two nodes on the rig share no JetPack — tegra210 caps at 4, tegra234 needs
5+ — so nothing binary is portable between them. The source and the procedure
are: install.sh detects the platform (L4T / JetPack / SoC), installs deps,
builds the OrbbecSDK and the preview server from source locally, and generates
a per-user config and systemd unit. The tested bridge.py ships verbatim; all
machine-specific paths live in the generated config, so it stays unmodified —
its one hardcoded path is made home-relative.

The retired GStreamer/RTSP target is dropped: the direct route encodes no video.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 15:57:15 +02:00

58 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Prints the facts every other script branches on, one KEY=value per line, so a
# caller can `eval "$(detect_platform.sh)"`.
#
# The point of the whole repo is that these differ between Jetsons and nothing is
# assumed: the original Nano is tegra210 on L4T R32 (JetPack 4, Ubuntu 18.04,
# CUDA 10.2), an Orin is tegra234 on R35/R36 (JetPack 5/6). One install procedure,
# values read here, binaries built locally to match.
set -euo pipefail
# L4T release, e.g. "32.7.1" or "36.4.3". Two sources; the file is the reliable
# one on every generation, the package is the cross-check.
l4t=""
if [[ -f /etc/nv_tegra_release ]]; then
# "# R32 (release), REVISION: 7.1, ..." -> 32.7.1
rel=$(sed -n 's/^# R\([0-9]*\).*REVISION: \([0-9.]*\).*/\1.\2/p' /etc/nv_tegra_release)
l4t="$rel"
fi
if [[ -z "$l4t" ]] && command -v dpkg-query >/dev/null 2>&1; then
l4t=$(dpkg-query --showformat='${Version}' -W nvidia-l4t-core 2>/dev/null \
| sed 's/-.*//') || true
fi
major="${l4t%%.*}"
# SoC family, from the device tree — the ground truth for what can run here.
soc="unknown"
if [[ -r /proc/device-tree/compatible ]]; then
comp=$(tr '\0' '\n' < /proc/device-tree/compatible)
case "$comp" in
*tegra210*) soc="tegra210" ;; # Nano, TX1
*tegra186*) soc="tegra186" ;; # TX2
*tegra194*) soc="tegra194" ;; # Xavier
*tegra234*) soc="tegra234" ;; # Orin
*tegra264*) soc="tegra264" ;; # Thor
esac
fi
model="unknown"
[[ -r /proc/device-tree/model ]] && model=$(tr -d '\0' < /proc/device-tree/model)
# JetPack generation follows from the L4T major, and it is what decides toolchain
# and dependency names.
case "$major" in
32) jetpack="4" ;;
35) jetpack="5" ;;
36) jetpack="6" ;;
38) jetpack="7" ;;
*) jetpack="unknown" ;;
esac
echo "L4T=${l4t:-unknown}"
echo "L4T_MAJOR=${major:-unknown}"
echo "JETPACK=${jetpack}"
echo "SOC=${soc}"
echo "ARCH=$(uname -m)"
echo "MODEL=${model}"