选项
首页首页 Skill 开发运营和 CI/CD jetson-print-device-info

jetson-print-device-info

NVIDIA/skills NVIDIA/skills

捕获 Jetson 设备模块型号、L4T 版本、内核、操作系统版本和电源模式的基线快照,用于性能测试或验证。

...展开全部
0
更新时间 2026-09-27

jetson-print-device-info

打印运行此技能的 Jetson 设备的简明摘要。

此技能旨在作为 jetson-device-skills 仓库和 NVIDIA 全局技能 CI 的参考示例。它在 Jetson 目标设备(而非主机 PC)上运行,并执行只读检查——在运行性能测试之前作为基线捕获非常有用。

目的

在运行性能、回归或兼容性测试之前,捕获 Jetson 目标设备软件栈和电源模式的基线快照。

使用场景

  • 启动性能测试时,希望捕获设备软件栈和电源模式的基线数据。
  • 验证新刷写的 Jetson 设备是否符合预期的 L4T / JetPack 版本。

前置条件

  • 在 Jetson 目标设备上运行(而非主机 PC)。
  • 可用的标准命令行工具:tr、cat、uname、uptime、lsb_release(或 /etc/os-release)。
  • 可用 nvpmodel 获取电源模式(可选——技能会优雅地回退)。

输入

无。该技能仅从本地 Jetson 文件系统和标准命令行工具中读取数据。

指令

按顺序执行每个步骤,并将捕获的值打印到“输出格式”部分显示的报告中。

  1. 捕获模块型号并验证其为 Jetson 目标设备——否则提前退出:```

    设备树字符串以空字符结尾,因此在打印前需去除 NUL 字符。

    model=$(tr -d '\0' /dev/null) case "$model" in Jetson) ;; *) echo "未在 Jetson 目标设备上运行 (型号: '${model:-unknown}')"; exit 1 ;; esac echo "$model"

  2. 提取 L4T 发行版标题行——跳过文件其余部分(长列表的库 SHA 值):``` head -1 /etc/nv_tegra_release 2>/dev/null || echo "未找到 L4T 发行版信息"

    等效命令: grep -m1 '^# R' /etc/nv_tegra_release

  3. 运行 nvpmodel -q 并合并其两行输出(NV Power Mode: <name></name> 和模式编号)到一行。paste -sd 仅使用分隔符的第一个字符,因此使用 awk 插入字面量 / 分隔符:``` nvpmodel -q 2>/dev/null | awk 'NR==1{a=$0; next} {print a" / "$0}' \ || echo "nvpmodel 不可用"

  4. 打印内核版本和运行时间:``` uname -r uptime -p

  5. 打印操作系统版本(优先使用 lsb_release,回退到 /etc/os-release):``` lsb_release -ds 2>/dev/null || (. /etc/os-release && echo "$PRETTY_NAME") || echo "未找到操作系统版本"

输出格式

打印包含以下部分的简短报告,尽可能每部分一行:

Model:           <device-tree>
L4T release:     <release>
Power mode:      <nvpmodel> / <mode>
Kernel:          <uname>
Uptime:          <uptime>
OS version:      <lsb_release></lsb_release></uptime></uname></mode></nvpmodel></release></device-tree>

示例

Orin AGX 开发套件(L4T R36 / Ubuntu 22.04)上的示例输出:

Model:           NVIDIA Jetson AGX Orin Developer Kit
L4T release:     # R36 (release), REVISION: 3.0
Power mode:      NV Power Mode: MAXN / 0
Kernel:          5.15.136-tegra
Uptime:          up 2 hours, 14 minutes
OS version:      Ubuntu 22.04.4 LTS

AGX Thor(L4T R39 / Ubuntu 24.04)上的示例输出:

Model:           NVIDIA Jetson AGX Thor Developer Kit
L4T release:     # R39 (release), REVISION: 0.0
Power mode:      NV Power Mode: 120W / 1
Kernel:          6.8.0-tegra
Uptime:          up 12 minutes
OS version:      Ubuntu 24.04 LTS

错误处理

如果底层文件或二进制文件缺失,每个命令都会回退到带有清晰标签的 "... not found" / "... not available" 字符串——该技能在报告过程中绝不会报错。如果 /proc/device-tree/model 缺失或不包含 Jetson 字符串,则提前退出并显示清晰的“未在 Jetson 目标设备上运行”消息。

局限性

  • 仅进行只读检查——不检测 GPU/CPU 时钟、热状态或各供电轨功耗。
  • nvpmodel 的输出格式因 L4T 版本而异;该技能会原样打印,而不进行解析。

故障排除

  • 错误: /proc/device-tree/model: No such file or directory原因: 在主机 PC 上运行,而非 Jetson 目标设备。解决方案: 直接在 Jetson 设备上运行该技能(例如通过 SSH)。
  • 错误: nvpmodel: command not found原因: 未安装 L4T BSP,或在没有 nvpmodel 的最小化容器中运行。解决方案: 在非 Jetson 或精简环境中预期会出现此情况——该技能会打印 "nvpmodel not available" 并继续执行。

备注

  • 只读。请勿更改电源模式、安装软件包或修改任何文件。
  • 如果误在主机 PC 上调用该技能,/proc/device-tree/model 将不包含 Jetson 型号字符串——检测到这一点后,应显示清晰消息并退出,而不是打印误导性信息。
在 GitHub 上查看
---
name: jetson-print-device-info
description: Captures a baseline snapshot of a Jetson device's module model, L4T version, kernel, OS version, and power mode for performance testing or verification.
license: Apache-2.0
---

# jetson-print-device-info

Prints a concise summary of the Jetson device this skill runs on.

This skill is intended as a reference example for the `jetson-device-skills` repo and the NVIDIA-wide skills CI. It runs on the Jetson target (not the host PC) and performs read-only inspection — useful as a baseline capture before running performance tests.

## Purpose

Capture a baseline snapshot of a Jetson target's software stack and power mode before running performance, regression, or compatibility tests.

## When to use

- Starting a performance run and you want a captured baseline of the device's software stack and power mode.
- Verifying that a freshly flashed Jetson matches an expected L4T / JetPack version.

## Prerequisites

- Running on a Jetson target (not the host PC).
- Standard CLIs available: `tr`, `cat`, `uname`, `uptime`, `lsb_release` (or `/etc/os-release`).
- `nvpmodel` available for power mode (optional — skill falls back gracefully).

## Inputs

None. The skill reads only from the local Jetson filesystem and standard CLIs.

## Instructions

Run each step in order and print the captured values into the report shown under [Output format](#output-format).

1. **Capture** the module model and **validate** it is a Jetson target — exit early otherwise:
   ```bash
   # Device-tree strings are null-terminated, so strip NULs before printing.
   model=$(tr -d '\0' < /proc/device-tree/model 2>/dev/null)
   case "$model" in
     *Jetson*) ;;
     *) echo "Not running on a Jetson target (model: '${model:-unknown}')"; exit 1 ;;
   esac
   echo "$model"
   ```
2. **Extract** the L4T release header line — skip the rest of the file (long list of library SHAs):
   ```bash
   head -1 /etc/nv_tegra_release 2>/dev/null || echo "L4T release info not found"
   # Equivalent: grep -m1 '^# R' /etc/nv_tegra_release
   ```
3. **Run** `nvpmodel -q` and **join** its two output lines (`NV Power Mode: <name>` and the mode number) onto one line. `paste -sd` only uses the first char of its delimiter, so use `awk` to insert the literal ` / ` separator:
   ```bash
   nvpmodel -q 2>/dev/null | awk 'NR==1{a=$0; next} {print a" / "$0}' \
     || echo "nvpmodel not available"
   ```
4. **Print** the kernel version and uptime:
   ```bash
   uname -r
   uptime -p
   ```
5. **Print** the OS version (prefer `lsb_release`, fall back to `/etc/os-release`):
   ```bash
   lsb_release -ds 2>/dev/null || (. /etc/os-release && echo "$PRETTY_NAME") || echo "OS version not found"
   ```

## Output format

Print a short report with these sections, one line each where possible:

```text
Model:           <device-tree model string>
L4T release:     <release header line>
Power mode:      <nvpmodel name> / <mode number>
Kernel:          <uname -r>
Uptime:          <uptime -p>
OS version:      <lsb_release / /etc/os-release output>
```

## Examples

Example output on an Orin AGX dev kit (L4T R36 / Ubuntu 22.04):

```text
Model:           NVIDIA Jetson AGX Orin Developer Kit
L4T release:     # R36 (release), REVISION: 3.0
Power mode:      NV Power Mode: MAXN / 0
Kernel:          5.15.136-tegra
Uptime:          up 2 hours, 14 minutes
OS version:      Ubuntu 22.04.4 LTS
```

Example output on an AGX Thor (L4T R39 / Ubuntu 24.04):

```text
Model:           NVIDIA Jetson AGX Thor Developer Kit
L4T release:     # R39 (release), REVISION: 0.0
Power mode:      NV Power Mode: 120W / 1
Kernel:          6.8.0-tegra
Uptime:          up 12 minutes
OS version:      Ubuntu 24.04 LTS
```

## Error handling

Each command falls back to a clearly labeled `"... not found"` / `"... not available"` string if the underlying file or binary is missing — the skill never errors out mid-report. If `/proc/device-tree/model` is missing or does not contain a Jetson string, exit early with a clear "not running on a Jetson target" message.

## Limitations

- Read-only inspection only — does not detect GPU/CPU clocks, thermal state, or per-rail power.
- `nvpmodel` output format varies between L4T versions; the skill prints it verbatim rather than parsing.

## Troubleshooting

- **Error:** `/proc/device-tree/model: No such file or directory`
  **Cause:** Running on a host PC, not a Jetson target.
  **Solution:** Run the skill on the Jetson device directly (e.g. via SSH).

- **Error:** `nvpmodel: command not found`
  **Cause:** L4T BSP not installed, or running in a minimal container without `nvpmodel`.
  **Solution:** Expected on non-Jetson or stripped environments — the skill prints `"nvpmodel not available"` and continues.

## Notes

- Read-only. Do not change power mode, install packages, or modify any files.
- If the skill is invoked on a host PC by mistake, `/proc/device-tree/model` will not contain a Jetson model string — detect that and exit with a clear message rather than printing misleading info.

安装 jetson-print-device-info

将技能文件下载并解压至你的 .claude/skills/ 目录。

下载ZIP

克隆仓库并复制技能文件到您的项目中。

git clone https://github.com/NVIDIA/skills/tree/main/skills/jetson-print-device-info # Copy SKILL.md to your .claude/skills/ directory

复制 复制
快速设置: 将技能文件夹复制到 .claude/skills/ 目录。Claude 将自动检测并使用该技能。
仓库 NVIDIA/skills

相关技能

Verification &amp; Quality Assurance
更新时间 2026-06-29
klingai-upgrade-migration
更新时间 2026-07-03
base44-cli
更新时间 2026-06-29
Railway CLI Management
更新时间 2026-07-02
OR