jetson-print-bsp-info

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

jetson-print-bsp-info

jetson-print-bsp-info

Prints a concise summary of a Jetson Linux_for_Tegra (BSP) tree on the host PC.
This skill is intended as a reference example for the
jetson-bsp-skills
repo and the NVIDIA-wide skills CI. It performs read-only inspection — no flashing, no rootfs changes.
在主机PC上打印Jetson Linux_for_Tegra(BSP)目录树的简明摘要。
本技能旨在作为
jetson-bsp-skills
仓库和NVIDIA全平台技能CI的参考示例。它仅执行只读检查——不进行刷机操作,也不修改rootfs。

Purpose

用途

Capture a baseline snapshot of a Linux_for_Tegra BSP tree (release, board configs, rootfs state) before flashing, so issues like "wrong L4T version" or "rootfs never populated" are caught early.
在刷机前捕获Linux_for_Tegra BSP目录树的基准快照(版本、板卡配置、rootfs状态),以便尽早发现诸如“L4T版本错误”或“rootfs未填充”之类的问题。

When to use

使用场景

  • A user has unpacked a Jetson BSP tarball and wants to confirm the L4T version, supported boards, and rootfs state before flashing.
  • You need a quick sanity check that a
    Linux_for_Tegra/
    directory looks valid (expected scripts and config files present).
  • 用户已解压Jetson BSP压缩包,希望在刷机前确认L4T版本、支持的板卡以及rootfs状态。
  • 你需要快速检查
    Linux_for_Tegra/
    目录是否有效(确认所需脚本和配置文件是否存在)。

Prerequisites

前提条件

  • Running on the host PC (Linux), not on the Jetson target.
  • A
    Linux_for_Tegra/
    directory extracted from a Jetson BSP tarball.
  • Standard CLIs available:
    ls
    ,
    head
    ,
    cat
    ,
    paste
    ,
    sed
    .
  • 在主机PC(Linux系统)上运行,而非Jetson目标设备。
  • 已从Jetson BSP压缩包中提取出
    Linux_for_Tegra/
    目录。
  • 具备标准CLI工具:
    ls
    head
    cat
    paste
    sed

Inputs

输入参数

  • L4T_ROOT
    (optional): absolute path to the
    Linux_for_Tegra/
    directory. If unset, use the current working directory.
  • L4T_ROOT
    (可选):
    Linux_for_Tegra/
    目录的绝对路径。若未设置,则使用当前工作目录。

Instructions

操作步骤

Run each step in order and print the captured values into the report shown under Output format.
  1. Resolve
    L4T_ROOT
    and validate the directory is a Linux_for_Tegra root — exit early otherwise.
    flash.sh
    and
    nv_tegra/
    are the two anchor artifacts that every BSP ships:
    bash
    L4T_ROOT="${L4T_ROOT:-$PWD}"
    if [ ! -f "$L4T_ROOT/flash.sh" ] || [ ! -d "$L4T_ROOT/nv_tegra" ]; then
      echo "Not a Linux_for_Tegra root: '$L4T_ROOT' (missing flash.sh or nv_tegra/)"
      exit 1
    fi
    echo "$L4T_ROOT"
  2. Extract the L4T release header line. The canonical host-side location is
    nv_tegra/nv_tegra_release
    ; the same file is copied into the rootfs by
    apply_binaries.sh
    . Only the first line is useful — the rest is a long list of library SHAs:
    bash
    head -1 "$L4T_ROOT/nv_tegra/nv_tegra_release" 2>/dev/null \
      || head -1 "$L4T_ROOT/rootfs/etc/nv_tegra_release" 2>/dev/null \
      || echo "L4T release info not found"
  3. List supported board config files and join them onto one comma-separated line:
    bash
    (cd "$L4T_ROOT" && ls *.conf 2>/dev/null) | paste -sd, -
  4. Check whether the rootfs has been populated. An empty
    rootfs/
    means
    apply_binaries.sh
    has not been run yet:
    bash
    if [ -f "$L4T_ROOT/rootfs/etc/passwd" ]; then
      echo "populated"
    else
      echo "empty"
    fi
按顺序执行每个步骤,并将捕获的值打印到输出格式中所示的报告里。
  1. 解析
    L4T_ROOT
    验证该目录是否为Linux_for_Tegra根目录——否则提前退出。每个BSP都会附带两个核心文件:
    flash.sh
    nv_tegra/
    bash
    L4T_ROOT="${L4T_ROOT:-$PWD}"
    if [ ! -f "$L4T_ROOT/flash.sh" ] || [ ! -d "$L4T_ROOT/nv_tegra" ]; then
      echo "Not a Linux_for_Tegra root: '$L4T_ROOT' (missing flash.sh or nv_tegra/)"
      exit 1
    fi
    echo "$L4T_ROOT"
  2. 提取L4T版本头信息行。主机端的标准位置是
    nv_tegra/nv_tegra_release
    ;该文件会被
    apply_binaries.sh
    复制到rootfs中。只有第一行有用——其余内容是长长的库SHA列表:
    bash
    head -1 "$L4T_ROOT/nv_tegra/nv_tegra_release" 2>/dev/null \
      || head -1 "$L4T_ROOT/rootfs/etc/nv_tegra_release" 2>/dev/null \
      || echo "L4T release info not found"
  3. 列出支持的板卡配置文件,并合并为一行逗号分隔的内容:
    bash
    (cd "$L4T_ROOT" && ls *.conf 2>/dev/null) | paste -sd, -
  4. 检查rootfs是否已填充。若
    rootfs/
    为空,则表示尚未运行
    apply_binaries.sh
    bash
    if [ -f "$L4T_ROOT/rootfs/etc/passwd" ]; then
      echo "populated"
    else
      echo "empty"
    fi

Output format

输出格式

Print a short report with these sections, one line each where possible:
text
L4T root:        <path>
L4T release:     <release header line>
Board configs:   <comma-separated list>
Rootfs:          populated | empty
打印一份包含以下部分的简短报告,尽可能每行对应一个部分:
text
L4T root:        <path>
L4T release:     <release header line>
Board configs:   <comma-separated list>
Rootfs:          populated | empty

Examples

示例

Example output on an Orin AGX BSP (L4T R36):
text
L4T root:        $HOME/Linux_for_Tegra
L4T release:     # R36 (release), REVISION: 3.0
Board configs:   jetson-agx-orin-devkit.conf,jetson-orin-nano-devkit.conf
Rootfs:          populated
Example output on a freshly untarred BSP where
apply_binaries.sh
has not been run yet:
text
L4T root:        /tmp/Linux_for_Tegra
L4T release:     # R39 (release), REVISION: 0.0
Board configs:   jetson-agx-thor-devkit.conf
Rootfs:          empty
Orin AGX BSP(L4T R36)的示例输出:
text
L4T root:        $HOME/Linux_for_Tegra
L4T release:     # R36 (release), REVISION: 3.0
Board configs:   jetson-agx-orin-devkit.conf,jetson-orin-nano-devkit.conf
Rootfs:          populated
刚解压完成且尚未运行
apply_binaries.sh
的BSP示例输出:
text
L4T root:        /tmp/Linux_for_Tegra
L4T release:     # R39 (release), REVISION: 0.0
Board configs:   jetson-agx-thor-devkit.conf
Rootfs:          empty

Error handling

错误处理

Each command falls back to a clearly labeled
"... not found"
string if the underlying file is missing — the skill never errors out mid-report. If
L4T_ROOT
does not contain
flash.sh
and
nv_tegra/
, exit early with a clear "not a Linux_for_Tegra root" message rather than printing misleading info.
如果底层文件缺失,每个命令都会回退到明确标记的
"... not found"
字符串——本技能不会在报告中途报错。如果
L4T_ROOT
不包含
flash.sh
nv_tegra/
,会提前退出并显示清晰的“不是Linux_for_Tegra根目录”消息,而非打印误导性信息。

Limitations

局限性

  • Read-only inspection only — does not validate signatures, kernel images, or device-tree overlays.
  • Only checks the presence of
    rootfs/etc/passwd
    as a populated-rootfs proxy; will not detect a half-populated rootfs.
  • Lists all
    *.conf
    board configs in
    L4T_ROOT/
    ; does not try to infer which one the user intends to flash.
  • 仅支持只读检查——不验证签名、内核镜像或设备树覆盖层。
  • 仅通过
    rootfs/etc/passwd
    的存在来判断rootfs是否已填充;无法检测部分填充的rootfs。
  • 会列出
    L4T_ROOT/
    中所有
    *.conf
    板卡配置文件;不会尝试推断用户打算刷写哪一个。

Troubleshooting

故障排除

  • Error:
    Not a Linux_for_Tegra root: '...' (missing flash.sh or nv_tegra/)
    Cause:
    L4T_ROOT
    points at a parent directory, an extracted rootfs, or an unrelated path. Solution: Point
    L4T_ROOT
    at the directory that contains
    flash.sh
    (typically
    Linux_for_Tegra/
    ).
  • Error:
    L4T release info not found
    Cause: Neither
    nv_tegra/nv_tegra_release
    nor
    rootfs/etc/nv_tegra_release
    exists — the BSP tarball may be incomplete or
    apply_binaries.sh
    was never run. Solution: Re-extract the BSP tarball or run
    apply_binaries.sh
    to populate the rootfs.
  • 错误:
    Not a Linux_for_Tegra root: '...' (missing flash.sh or nv_tegra/)
    原因:
    L4T_ROOT
    指向父目录、已提取的rootfs或无关路径。 **解决方案:**将
    L4T_ROOT
    指向包含
    flash.sh
    的目录(通常为
    Linux_for_Tegra/
    )。
  • 错误:
    L4T release info not found
    原因:
    nv_tegra/nv_tegra_release
    rootfs/etc/nv_tegra_release
    均不存在——BSP压缩包可能不完整,或从未运行
    apply_binaries.sh
    。 **解决方案:**重新解压BSP压缩包,或运行
    apply_binaries.sh
    以填充rootfs。

Notes

注意事项

  • Do not modify any files. This skill is read-only.
  • If multiple board config files exist, list all of them — do not try to guess which one the user intends to flash.
  • 请勿修改任何文件。本技能为只读操作。
  • 如果存在多个板卡配置文件,请列出所有文件——不要尝试猜测用户打算刷写哪一个。