nvidia系列教程-AGX-Orin系统刷机及备份

发布于:2024-08-08 ⋅ 阅读:(169) ⋅ 点赞:(0)

目录

前言

一、准备工作

二、AGX Orin 系统刷机步骤

三、AGX Orin 系统备份

总结


前言

        NVIDIA AGX Orin 是一款高性能的嵌入式计算平台,专为边缘计算和 AI 应用而设计。为了确保系统的稳定性和适应不同的应用场景,用户可能需要对 AGX Orin 进行系统刷机和备份操作。本文将详细介绍如何完成这些操作,帮助您更好地管理和维护 AGX Orin 设备。


一、准备工作

在开始刷机和备份之前,请确保您已经准备好以下工具和资源:

  1. NVIDIA Jetson SDK Manager:这是 NVIDIA 提供的刷机工具,可以在 官方页面 下载。
  2. USB 线缆:用于将 AGX Orin 连接到主机电脑。
  3. Ubuntu 系统电脑:建议使用 Ubuntu 18.04 或 20.04 版本作为主机电脑。
  4. 存储设备:用于备份系统镜像的外部存储设备,如 USB 盘或外置硬盘。

二、AGX Orin 系统刷机步骤

        AGX-Orin刷机方式有两种,一种使用官方Jetson SDK Manager刷写方式,使用nvidia提供装刷机软件进行刷机,该方式在第一篇博文中有介绍,本文主要介绍在ubuntu20.04系统中使用命令的方式进行刷机,具体刷机步骤如下:

a、ubuntu20.04工具安装

  ubuntu20.04系统环境配置:在Linux_for_Tegra目录下执行sudo ./tools/l4t_flash_prerequisites.sh脚本,安装ubuntu系统所需的库,脚本内容如下所示:

sudo apt-get update && \
sudo apt-get install -y abootimg \
                        binfmt-support \
                        binutils \
                        cpp \
                        device-tree-compiler \
                        dosfstools \
                        lbzip2 \
                        libxml2-utils \
                        nfs-kernel-server \
                        python3-yaml \
                        qemu-user-static \
                        sshpass \
                        udev \
                        uuid-runtime \
                        whois \
                        openssl \
                        cpio \
                        rsync \
                        zstd

SYSTEM_VER="$(grep "DISTRIB_RELEASE" </etc/lsb-release | cut -d= -f 2 | sed 's/\.//')"

# Install lz4c utility required for compressing bpmp-fw-dtb.
# For Ubuntu 18.04 and older version, run "sudo apt-get install liblz4-tool".
# For Ubuntu 20.04 and newer version, run "sudo apt-get install lz4".
if [ "${SYSTEM_VER}" -lt 2004 ]; then
        sudo apt-get install -y liblz4-tool
else
        sudo apt-get install -y lz4
fi

        执行以下命令应用Jetson二进制文件,sudo ./apply_binaries.sh脚本位于Linux_for_Tegra目录下:

b、连接 AGX Orin

  • 使用 USB 线缆将 AGX Orin 连接到主机电脑。
  • 将 AGX Orin 置于恢复模式(Recovery Mode)。通常的步骤是先关机,按住恢复按键(Recovery Button),然后按下电源键启动。

c、flash.sh命令刷机

        SDK命令刷机主要是采用flash.sh进行刷机操作,其中flash.sh位于JetPack SDK开发包中,脚本位置在:

flash.sh脚本参数选择如下所示:

cftc@cftc-virtual-machine:~/nvidia/nvidia_sdk/JetPack_5.1.3_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra$ ./flash.sh --help

Usage: sudo ./flash.sh [options] <target_board> <rootdev>
  Where,
        target board: Valid target board name.
        rootdev: Proper root device.
    options:
        -c <cfgfile> ---------- Flash partition table config file.
        -d <dtbfile> ---------- device tree file.
        -f <flashapp> --------- Path to flash application (tegraflash.py)
        -h -------------------- print this message.
        -i <enc rfs key file>-- key for disk encryption support.
        -k <partition id> ----- partition name or number specified in flash.cfg.
        -m <mts preboot> ------ MTS preboot such as mts_preboot_si.
        -n <nfs args> --------- Static nfs network assignments
                                <Client IP>:<Server IP>:<Gateway IP>:<Netmask>
        -o <odmdata> ---------- ODM data.
        -r -------------------- skip building and reuse existing system.img.
        -t <tegraboot> -------- tegraboot binary such as nvtboot.bin
        -u <PKC key file>------ PKC key used for odm fused board.
        -v <SBK key file>------ Secure Boot Key (SBK) key used for ODM fused board.
        -w <wb0boot> ---------- warm boot binary such as nvtbootwb0.bin
        -x <tegraid> ---------- Tegra CHIPID.
        -B <boardid> ---------- BoardId.
        -C <cmdline> ---------- Kernel commandline arguments.
                                WARNING:
                                Each option in this kernel commandline gets
                                higher preference over the values set by
                                flash.sh. In case of NFS booting, this script
                                adds NFS booting related arguments, if -i option
                                is omitted.
        -F <flasher> ---------- Flash server such as cboot.bin.
        -G <file name> -------- Read partition and save image to file.
        -I <initrd> ----------- initrd file. Null initrd is default.
        -K <kernel> ----------- Kernel image file such as zImage or Image.
        -L <bootloader> ------- Bootloader such as cboot.bin or u-boot-dtb.bin.
        -M <mts boot> --------- MTS boot file such as mts_si.
        -N <nfsroot> ---------- i.e. <my IP addr>:/my/exported/nfs/rootfs.
        -R <rootfs dir> ------- Sample rootfs directory.
        -S <size> ------------- Rootfs size in bytes. Valid only for internal
                                rootdev. KiB, MiB, GiB short hands are allowed,
                                for example, 1GiB means 1024 * 1024 * 1024 bytes.
        -T <ext num sectors> ---The number of the sectors of the external storage device.
                                The default value is 122159104 if this option is not set.
        -Z -------------------- Print configurations and then exit.
        --no-flash ------------ perform all steps except physically flashing the board.
                                This will create a system.img.
        --external-device------ Generate flash images for external devices
        --sparseupdate--------- only flash partitions that have changed. Currently only support SPI flash memory
        --no-systemimg -------- Do not create or re-create system.img.
        --bup ----------------- Generate bootloader update payload(BUP).
        --single-image-bup <part name> Generate specified single image BUP, this must work with --bup.
        --bup-type <type> ----- Generate specific type bootloader update payload(BUP), such as bl or kernel.
        --multi-spec----------- Enable support for building multi-spec BUP.
        --clean-up------------- Clean up BUP buffer when multi-spec is enabled.
        --usb-instance <id> --- Specify the USB instance to connect to;
                                <id> = USB port path (e.g. 3-14).
        --no-root-check ------- Typical usage of this script require root permissions.
                                Pass this option to allow running the script as a
                                regular user, in which case only specific combinations
                                of command-line options will be functional.
        --uefi-keys <keys_conf> Specify UEFI keys configuration file.
        --rcm-boot ------------ Do RCM boot instead of physically flashing the board.
        --sign ---------------- Sign images and store them under "bootloader/signed"
                                directory. The board will not be physically flashed.
        --image --------------- Specify the image to be written into board.
        --boot-chain-flash <c>  Flash only a specific boot chain (ex. "A, "B", "all").
                                Defaults to "all", inputs are case insensitive.
                                Not suitable for production.
        --boot-chain-select <c> Specify booting chain (ex. "A" or "B") after the board is flashed.
                                Defaults to "A", inputs are case insensitive.
        --pv-crt -------------- The certificate for the key that is used to sign cpu_bootloader
        --with-systemimg ------ Generate system images also when using -k option
        --pv-enc <enc_key>----- The encryption key that is used to encrypt cpu_bootloader.
        --uefi-enc <uefi_enc_key> Key file (0x19: 16-byte; 0x23: 32-byte) to encrypt UEFI payloads
        --uda-dir-------------- Directory to store user data that will be encrypted in UDA partition.
        --separate-rcmboot-binary ------ Enable use of different binaries for rcmboot and coldboot.
        --generic-passphrase -- Use generic passphrase for disk encryption.
        --disable-random-iv --- Disable generation of random IV, SALT1, SALT2 and DERSTR.
        --read-info ----------- Read and display board related info, fuse info (based on fuse_t234.xml),
                                and EEPROM content.
        --reuse-uuid ---------  Reuse uuid which is already generated first time.

        flash.sh主要包含烧写参数、板卡配置、烧写分区等重要参数输入,具体参数请参考--help 参数说明,烧写命令如下所示:

sudo ./flash.sh -r jetson-agx-orin-devkit mmcblk0p1

        其中-r表示跳过根文件系统system.img制作,重用已经生成的镜像文件系统文件,如果是首次刷机,则需要去掉-r参数。其中mmcblk0p1为根文件系统分区,agx-orin默认烧录至emmc分区中。jetson-agx-orin-devkit为官方AGX-Orin模组配置,具体板卡配置说明如下:

其他刷机指令,单独刷写内核:

sudo ./flash.sh -k kernel y-c8-agx-orin-3550 mmcblk0p1

更新设备树文件:

sudo ./flash.sh -r -k kernel-dtb y-c8-agx-orin-3550 mmcblk0p1

 更新MB1_BCT 配置文件:

sudo ./flash.sh -k MB1_BCT y-c8-agx-orin-3550 mmcblk0p1

三、AGX Orin 系统备份

备份操作可以在刷机前或系统配置完成后进行,以确保在出现问题时能够快速恢复。

  1. 连接存储设备

    • 将外部存储设备连接到 AGX Orin,确保存储空间足够大以保存整个系统镜像。
  2. 创建备份镜像

sudo  ./flash.sh  -r  -k   APP -G  system_n102.img  y-c8-agx-orin-3550  mmcblk0p1

其中参数说明如下:

  1. -k APP:表示的是文件系统分区名称;
  2. -G system_n102.img:指定备份文件系统文件名称;

系统备份如下图所示:

备份途中会有百分比打印,全部部分完成有successfully打印


总结

        通过以上步骤,您可以成功地为 NVIDIA AGX Orin 刷写系统并创建备份。这些操作不仅能帮助您保持系统的更新和安全,还能在遇到问题时快速恢复系统。定期进行系统备份是保障系统稳定运行的重要措施,建议大家在进行重要更改前都进行备份操作。

        如果您在操作过程中遇到任何问题,可以查阅 NVIDIA 的官方文档或寻求社区支持。希望这篇教程对您有所帮助!


网站公告

今日签到

点亮在社区的每一天
去签到