Jetson Nano Developer Kit 4GB (A02)が再起動を繰り返す場合の対応方法

# はじめに

ひさびさにJetson Nano Developer Kit 4GB (A02)を動かそうと電源を入れたところ、起動画面(NVIDIAのロゴ)が繰り返し表示→消滅を繰り返して正常に起動しませんでした。

![nVIDIA起動.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/72479/b2deb843-de2e-b8ab-d9d0-80dabbbddf29.jpeg)

動作実績がある過去のJetPackがインストールされた別のSDカードをいくつか試してみましたが同じ事象でした。

# 原因調査

Jetson Nano Developer Kit 4GB (A02)にシリアル接続してコンソールに出力されるログの内容を確認しました。
気になったのは メモリ容量(DRAM:)の項目が4GBにも関わらず、モデル名(Model:)とボード名(Board:)の表示が2GBモデルになっているのを確認しました。
原因の推察としては、2GBモデル用のSDカードを誤って挿してしまい、2GBモデル用のブートローダが上書きされてしまったと思われます。(再現性は未検証)

### 再起動を繰り返す場合のログ出力例

```bash

U-Boot 2020.04-g6b630d64fd (Jun 14 2021 - 11:29:25 -0700)

SoC: tegra210
Model: NVIDIA Jetson Nano 2GB Developer Kit
Board: NVIDIA P3541-0000
DRAM:  4 GiB
MMC:   sdhci@700b0000: 1, sdhci@700b0600: 0
Loading Environment from SPI Flash... SF: Detected mx25u3235f with page size 256 Bytes, erase size 4 KiB, total 4 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
845 bytes read in 27 ms (30.3 KiB/s)
1:      primary kernel
Retrieving file: /boot/initrd
7160133 bytes read in 332 ms (20.6 MiB/s)
Retrieving file: /boot/Image
34484232 bytes read in 1508 ms (21.8 MiB/s)
append: tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,4 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1125 core_edp_ma=4000 gpt tegra_fbmem=0x800000@0x92ca9000 is_hdmi_initialised=1  earlycon=uart8250,mmio32,0x70006000  root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 
## Flattened Device Tree blob at 83100000
   Booting using the fdt blob at 0x83100000
ERROR: reserving fdt memory region failed (addr=0 size=0)
ERROR: reserving fdt memory region failed (addr=0 size=0)
   Using Device Tree in place at 0000000083100000, end 00000000831843cf
copying carveout for /host1x@50000000/dc@54200000...
copying carveout for /host1x@50000000/dc@54240000...

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.253-tegra (buildbrain@mobile-u64-5496-d5000) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05) ) #1 SMP PREEMPT Mon Jul 26 12:13:06 PDT 2021
[    0.000000] Boot CPU: AArch64 Processor [411fd071]
[    0.000000] OF: fdt:memory scan node memory@80000000, reg size 32,
[    0.000000] OF: fdt: - 80000000 ,  7ee00000
[    0.000000] OF: fdt: - 100000000 ,  7f200000
[    0.000000] Found tegra_fbmem: 00800000@92ca9000
[    0.000000] earlycon: uart8250 at MMIO32 0x0000000070006000 (options '')
[    0.000000] bootconsole [uart8250] enabled
```

### 正常に起動する場合のログ出力例(復旧後)

```bash

U-Boot 2020.04-g46e4604c78 (Jul 26 2021 - 12:09:42 -0700)

SoC: tegra210
Model: NVIDIA Jetson Nano Developer Kit
Board: NVIDIA P3450-0000
DRAM:  4 GiB
MMC:   sdhci@700b0000: 1, sdhci@700b0600: 0
Loading Environment from SPI Flash... SF: Detected mx25u3235f with page size 256 Bytes, erase size 4 KiB, total 4 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
845 bytes read in 28 ms (29.3 KiB/s)
1:      primary kernel
Retrieving file: /boot/initrd
7160133 bytes read in 333 ms (20.5 MiB/s)
Retrieving file: /boot/Image
34484232 bytes read in 1508 ms (21.8 MiB/s)
append: tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,4 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1125 core_edp_ma=4000 gpt tegra_fbmem=0x800000@0x92ca9000 is_hdmi_initialised=1  earlycon=uart8250,mmio32,0x70006000  root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 
## Flattened Device Tree blob at 83100000
   Booting using the fdt blob at 0x83100000
ERROR: reserving fdt memory region failed (addr=0 size=0)
ERROR: reserving fdt memory region failed (addr=0 size=0)
   Using Device Tree in place at 0000000083100000, end 000000008317acef
copying carveout for /host1x@50000000/dc@54200000...
copying carveout for /host1x@50000000/dc@54240000...

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.253-tegra (buildbrain@mobile-u64-5496-d5000) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05) ) #1 SMP PREEMPT Mon Jul 26 12:13:06 PDT 2021
[    0.000000] Boot CPU: AArch64 Processor [411fd071]
[    0.000000] OF: fdt:memory scan node memory@80000000, reg size 32,
[    0.000000] OF: fdt: - 80000000 ,  7ee00000
[    0.000000] OF: fdt: - 100000000 ,  7f200000
[    0.000000] Found tegra_fbmem: 00800000@92ca9000
[    0.000000] earlycon: uart8250 at MMIO32 0x0000000070006000 (options '')
[    0.000000] bootconsole [uart8250] enabled
[    1.153577] tegradc tegradc.1: dpd enable lookup fail:-19
[    1.338772] imx219 6-0010: imx219_board_setup: error during i2c read probe (-121)
```

# 対応方法(復旧方法)

結論から先に書くと、Jetson Nanoをリカバリーモードに設定してホストPCからファームウェアを書き込むことで復旧しました。
最初、SDK Managerを使用して書き込みを行おうと思いましたが、ホストPCのディスク容量の都合で失敗し、最終的にコマンドラインツール(flash.sh)で復旧しました。

# 環境準備

| 必要なもの | 用途 |
|--|--|
|Surface Pro3|ホストPCとして使用。ディスクスペースは最低30GB必要。メモリ容量は推奨は8GBだが、4GBでも問題なかった。ディスク(SSD)の容量が少ない(64GB)しかないので、最初ディスクスペースを少なく区切ってUbuntuをインストールしたら、後半の作業手順でディスク容量が不足することが判明。flash.shツールがSDカードへ書き込むイメージファイルを作成するためのディスクスペースが必要になる。|
|Ubuntu Desktop 18.04 LTS|最新のLTSリリースは20.04 (https://jp.ubuntu.com/download) だが、18.04 (https://releases.ubuntu.com/18.04.6/) が必要になる。|
|USBメモリ|4GB以上のUSBメモリを用意します。USB起動でインストーラーを起動して、ホストPCにUbuntuをインストールするために使用します。|
|ジャンパーピン 2個|J48(DCプラグ電源アダプタを使用するため)とJ40(リカバリーモードに設定するためピン3と4をショート)に必要
|DCプラグ電源アダプタ|Jetson Nano Developer Kit 4GBへ電源を供給します。USB Micro B端子はホストPCと通信接続に使用します。|
|USB A - Micro Bケーブル|Jetson Nano Developer Kit 4GBとホストPCを接続します。|
|SDカード|16GB以上の空(フォーマット済)のSDカードを用意します。|

## ホストPCにUbuntuをインストール手順

### 1. UbuntuのインストールUSBメディアを作成する

こちらを参考に作業を進めました。特に問題となる箇所はありませんでした。

https://diagnose-fix.com/topic2-003/

### 2. ホストPCへUbuntuをインストールする

「アップデートと他のソフトウェア」の項目では、Minimal(最小インストール)を選択し、その他のオプションはチェックを外しました。(ディスク容量とアップデートの時間を省略するため)

「インストールの種類」の項目では、Install Ubuntu alongside Windows10(UbuntuをWindows Boot Managerとは別にインストール)を選択します。

「パーティションの設定」では空き領域を30GB以上確保して、パーティションを作成します。

### 3. ホストPCのUbuntuを起動する

Surface Pro3でUbuntuを動かすと起動後しばらくするとWi-Fi機能が無効になる症状が出たので、以下の情報を参考に設定変更しました。

https://viasnake.com/running-ubuntu-desktop-on-surface-3/

### 4. Jetson Nano Developer Kit 4GBをリカバリーモードに設定して電源を入れる

J40のリカバリーモード(ピン3、4)の位置
![image.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/72479/38d392ca-867c-a1d0-4862-9b6e6c49d373.jpeg)

### 5. Jetson Nano Developer Kit 4GBをホストPCへUSBケーブルで接続する

lsusbコマンドで以下が表示されることを確認します。

```bash
Bus 001 Device 002: ID 0955:7f21 NVIDIA Corp. APX
```

### 6. ホストPCにファームウェア書き換えツールをダウンロードする

下記へアクセスして、L4T Driver Package [BSP]とSample Root Filesystemをダウンロードする。

https://developer.nvidia.com/embedded/linux-tegra-r3261

![スクリーンショット 2022-02-21 14.41.54.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/72479/db67ba13-beb2-db15-3f9c-8535246de9ce.png)

### 7. ファームウェア書き換えツールを展開、実行する

ツールの実行に必要な追加パッケージをインストールします。

```bash
$ sudo apt update
$ sudo apt install qemu-user-static
$ sudo apt install libxml2-utils
```

ツールを展開します。
L4T Driver Package (BSP)を展開するとLinux_for_Tegraディレクトリが作成され、ディレクトリ配下にファイルが展開されます。
Sample Root FilesystemはLinux_for_Tegra/rootfsディレクトリ配下にファイルを展開する必要があります。

```bash
$ sudo tar xpf jetson-210_linux_r32.6.1_aarch64.tbz2
$ cd Linux_for_Tegra/rootfs
$ sudo tar xpf ../../tegra_linux_sample-root-filesystem_r32.6.1_aarch64.tbz2
```

# Jetson Nano Developer Kit 4GBの復旧手順

Linux_for_Tegraディレクトリで、apply_binaries.shツールを実行します。

```bash
$ cd ..
$ pwd
/home/jetson/Linux_for_Tegra
$ sudo ./apply_binaries.sh 
Using rootfs directory of: /home/jetson/Linux_for_Tegra/rootfs
Installing extlinux.conf into /boot/extlinux in target rootfs
/home/jetson/Linux_for_Tegra/nv_tegra/nv-apply-debs.sh
Root file system directory is /home/jetson/Linux_for_Tegra/rootfs
Copying public debian packages to rootfs
Start L4T BSP package installation
QEMU binary is not available, looking for QEMU from host system
Found /usr/bin/qemu-aarch64-static
Installing QEMU binary in rootfs
~/Linux_for_Tegra/rootfs ~/Linux_for_Tegra
Installing BSP Debian packages in /home/jetson/Linux_for_Tegra/rootfs
Selecting previously unselected package nvidia-l4t-core.
(Reading database ... 142475 files and directories currently installed.)
Preparing to unpack .../nvidia-l4t-core_32.6.1-20210726122000_arm64.deb ...
Pre-installing... skip compatibility checking.
Unpacking nvidia-l4t-core (32.6.1-20210726122000) ...
Setting up nvidia-l4t-core (32.6.1-20210726122000) ...
Selecting previously unselected package jetson-gpio-common.
(Reading database ... 142521 files and directories currently installed.)
Preparing to unpack .../jetson-gpio-common_2.0.17_arm64.deb ...
Unpacking jetson-gpio-common (2.0.17) ...
Selecting previously unselected package python3-jetson-gpio.
Preparing to unpack .../python3-jetson-gpio_2.0.17_arm64.deb ...
Unpacking python3-jetson-gpio (2.0.17) ...
Selecting previously unselected package python-jetson-gpio.
Preparing to unpack .../python-jetson-gpio_2.0.17_arm64.deb ...
Unpacking python-jetson-gpio (2.0.17) ...
Selecting previously unselected package nvidia-l4t-3d-core.
Preparing to unpack .../nvidia-l4t-3d-core_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-3d-core (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-apt-source.
Preparing to unpack .../nvidia-l4t-apt-source_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-apt-source (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-camera.
Preparing to unpack .../nvidia-l4t-camera_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-camera (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-configs.
Preparing to unpack .../nvidia-l4t-configs_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-configs (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-cuda.
Preparing to unpack .../nvidia-l4t-cuda_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-cuda (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-firmware.
Preparing to unpack .../nvidia-l4t-firmware_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-firmware (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-gputools.
Preparing to unpack .../nvidia-l4t-gputools_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-gputools (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-graphics-demos.
Preparing to unpack .../nvidia-l4t-graphics-demos_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-graphics-demos (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-gstreamer.
Preparing to unpack .../nvidia-l4t-gstreamer_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-gstreamer (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-init.
Preparing to unpack .../nvidia-l4t-init_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-init (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-initrd.
Preparing to unpack .../nvidia-l4t-initrd_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-initrd (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-jetson-io.
Preparing to unpack .../nvidia-l4t-jetson-io_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-jetson-io (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-libvulkan.
Preparing to unpack .../nvidia-l4t-libvulkan_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-libvulkan (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-multimedia.
Preparing to unpack .../nvidia-l4t-multimedia_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-multimedia (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-multimedia-utils.
Preparing to unpack .../nvidia-l4t-multimedia-utils_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-multimedia-utils (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-oem-config.
Preparing to unpack .../nvidia-l4t-oem-config_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-oem-config (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-tools.
Preparing to unpack .../nvidia-l4t-tools_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-tools (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-wayland.
Preparing to unpack .../nvidia-l4t-wayland_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-wayland (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-weston.
Preparing to unpack .../nvidia-l4t-weston_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-weston (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-x11.
Preparing to unpack .../nvidia-l4t-x11_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-x11 (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-xusb-firmware.
Preparing to unpack .../nvidia-l4t-xusb-firmware_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-xusb-firmware (32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-kernel.
Preparing to unpack .../nvidia-l4t-kernel_4.9.253-tegra-32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-kernel (4.9.253-tegra-32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-kernel-dtbs.
Preparing to unpack .../nvidia-l4t-kernel-dtbs_4.9.253-tegra-32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-kernel-dtbs (4.9.253-tegra-32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-kernel-headers.
Preparing to unpack .../nvidia-l4t-kernel-headers_4.9.253-tegra-32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-kernel-headers (4.9.253-tegra-32.6.1-20210726122000) ...
Selecting previously unselected package nvidia-l4t-bootloader.
Preparing to unpack .../nvidia-l4t-bootloader_32.6.1-20210726122000_arm64.deb ...
Unpacking nvidia-l4t-bootloader (32.6.1-20210726122000) ...
Setting up jetson-gpio-common (2.0.17) ...
Setting up python3-jetson-gpio (2.0.17) ...
Setting up python-jetson-gpio (2.0.17) ...
Setting up nvidia-l4t-apt-source (32.6.1-20210726122000) ...
Pre-installing... skip changing source list.
Setting up nvidia-l4t-configs (32.6.1-20210726122000) ...
Setting up nvidia-l4t-firmware (32.6.1-20210726122000) ...
Setting up nvidia-l4t-gputools (32.6.1-20210726122000) ...
Setting up nvidia-l4t-init (32.6.1-20210726122000) ...
Setting up nvidia-l4t-libvulkan (32.6.1-20210726122000) ...
Setting up nvidia-l4t-multimedia-utils (32.6.1-20210726122000) ...
Setting up nvidia-l4t-oem-config (32.6.1-20210726122000) ...
Setting up nvidia-l4t-tools (32.6.1-20210726122000) ...
Setting up nvidia-l4t-wayland (32.6.1-20210726122000) ...
Setting up nvidia-l4t-weston (32.6.1-20210726122000) ...
Setting up nvidia-l4t-x11 (32.6.1-20210726122000) ...
Setting up nvidia-l4t-xusb-firmware (32.6.1-20210726122000) ...
Pre-installing xusb firmware package, skip flashing
Setting up nvidia-l4t-kernel (4.9.253-tegra-32.6.1-20210726122000) ...
Using the existing boot entry 'primary'
Pre-installing kernel package, skip flashing
Setting up nvidia-l4t-kernel-dtbs (4.9.253-tegra-32.6.1-20210726122000) ...
Pre-installing kernel-dtbs package, skip flashing
Setting up nvidia-l4t-kernel-headers (4.9.253-tegra-32.6.1-20210726122000) ...
Setting up nvidia-l4t-bootloader (32.6.1-20210726122000) ...
Pre-installing bootloader package, skip flashing
Setting up nvidia-l4t-3d-core (32.6.1-20210726122000) ...
Setting up nvidia-l4t-cuda (32.6.1-20210726122000) ...
Setting up nvidia-l4t-graphics-demos (32.6.1-20210726122000) ...
Setting up nvidia-l4t-initrd (32.6.1-20210726122000) ...
Pre-installing initrd package, skip flashing
Setting up nvidia-l4t-jetson-io (32.6.1-20210726122000) ...
Setting up nvidia-l4t-multimedia (32.6.1-20210726122000) ...
Setting up nvidia-l4t-camera (32.6.1-20210726122000) ...
Setting up nvidia-l4t-gstreamer (32.6.1-20210726122000) ...
Processing triggers for nvidia-l4t-kernel (4.9.253-tegra-32.6.1-20210726122000) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
~/Linux_for_Tegra
Removing QEMU binary from rootfs
Removing stashed Debian packages from rootfs
L4T BSP package installation completed!
Rename ubuntu.desktop --> ux-ubuntu.desktop
Disabling NetworkManager-wait-online.service
Disable the ondemand service by changing the runlevels to 'K'
Success!
```

次にflash.shツールを実行します。
flash.shツールは引数にboardとrootdevの情報を指定する必要があります。
Jetson Nano Developer Kit 4GBは
board　→jetson-nano-qspi-sd (QSPI-NORフラッシュメモリとSDカードを使用)
rootdev　→mmcblk0p1 (SDカードから起動)
を指定します。

![スクリーンショット 2022-02-21 17.57.02.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/72479/38f14961-234b-7e44-9460-8129ee574223.png)

```bash
$ sudo ./flash.sh jetson-nano-qspi-sd mmcblk0p1
###############################################################################
# L4T BSP Information:
# R32 , REVISION: 6.1
###############################################################################
# Target Board Information:
# Name: jetson-nano-qspi-sd, Board Family: t210ref, SoC: Tegra 210, 
# OpMode: production, Boot Authentication: , 
# Disk encryption: disabled ,
###############################################################################
./tegraflash.py --chip 0x21 --applet "/home/jetson/Linux_for_Tegra/bootloader/nvtboot_recovery.bin" --skipuid --cmd "dump eeprom boardinfo cvm.bin" 
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands
 
[   0.0068 ] Generating RCM messages
[   0.0162 ] tegrarcm --listrcm rcm_list.xml --chip 0x21 0 --download rcm /home/jetson/Linux_for_Tegra/bootloader/nvtboot_recovery.bin 0 0
[   0.0222 ] RCM 0 is saved as rcm_0.rcm
[   0.0283 ] RCM 1 is saved as rcm_1.rcm
[   0.0283 ] List of rcm files are saved in rcm_list.xml
[   0.0284 ] 
[   0.0286 ] Signing RCM messages
[   0.0374 ] tegrasign --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   0.0422 ] Assuming zero filled SBK key
[   0.0667 ] 
[   0.0669 ] Copying signature to RCM mesages
[   0.0733 ] tegrarcm --chip 0x21 0 --updatesig rcm_list_signed.xml
[   0.0800 ] 
[   0.0802 ] Boot Rom communication
[   0.0866 ] tegrarcm --chip 0x21 0 --rcm rcm_list_signed.xml --skipuid
[   0.0914 ] RCM version 0X210001
[   0.1434 ] Boot Rom communication completed
[   1.1532 ] 
[   1.1539 ] dump EEPROM info
[   1.1663 ] tegrarcm --oem platformdetails eeprom /home/jetson/Linux_for_Tegra/bootloader/cvm.bin
[   1.1711 ] Applet version 00.01.0000
[   1.1911 ] Saved platform info in /home/jetson/Linux_for_Tegra/bootloader/cvm.bin
[   1.2734 ] 
[   1.2840 ] tegrarcm --reboot recovery
[   1.2914 ] Applet version 00.01.0000
[   1.3110 ] 
Board ID(3448) version(200) 
copying bctfile(/home/jetson/Linux_for_Tegra/bootloader/t210ref/BCT/P3448_A00_lpddr4_204Mhz_P987.cfg)... done.
copying bootloader(/home/jetson/Linux_for_Tegra/bootloader/t210ref/cboot.bin)... done.
copying initrd(/home/jetson/Linux_for_Tegra/bootloader/l4t_initrd.img)... done.
Making Boot image... done.
Existing sosfile(/home/jetson/Linux_for_Tegra/bootloader/nvtboot_recovery.bin) reused.
copying tegraboot(/home/jetson/Linux_for_Tegra/bootloader/t210ref/nvtboot.bin)... done.
copying cpu_bootloader(/home/jetson/Linux_for_Tegra/bootloader/t210ref/cboot.bin)... done.
copying bpffile(/home/jetson/Linux_for_Tegra/bootloader/t210ref/sc7entry-firmware.bin)... done.
copying wb0boot(/home/jetson/Linux_for_Tegra/bootloader/t210ref/warmboot.bin)... done.
Existing tosfile(/home/jetson/Linux_for_Tegra/bootloader/tos-mon-only.img) reused.
Existing eksfile(/home/jetson/Linux_for_Tegra/bootloader/eks.img) reused.
copying dtbfile(/home/jetson/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb)... done.
Copying nv_boot_control.conf to rootfs
	populating kernel to rootfs... done.
	populating initrd to rootfs... done.
	populating kernel_tegra210-p3448-0000-p3449-0000-a02.dtb to rootfs... done.
Making system.img... 
	populating rootfs from /home/jetson/Linux_for_Tegra/rootfs ... 	populating /boot/extlinux/extlinux.conf ... done.
	Sync'ing system.img ... done.
	Converting RAW image to Sparse image... done.
system.img built successfully. 
Existing tbcfile(/home/jetson/Linux_for_Tegra/bootloader/nvtboot_cpu.bin) reused.
copying tbcdtbfile(/home/jetson/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb)... done.
copying cfgfile(/home/jetson/Linux_for_Tegra/bootloader/t210ref/cfg/flash_l4t_t210_max-spi_sd_p3448.xml) to flash.xml... done.
copying flasher(/home/jetson/Linux_for_Tegra/bootloader/t210ref/cboot.bin)... done.
Existing flashapp(/home/jetson/Linux_for_Tegra/bootloader/tegraflash.py) reused.
./tegraflash.py --bl cboot.bin --bct  P3448_A00_lpddr4_204Mhz_P987.cfg --odmdata 0xa4000 --bldtb kernel_tegra210-p3448-0000-p3449-0000-a02.dtb --applet nvtboot_recovery.bin  --cmd "flash; reboot"  --cfg flash.xml --chip 0x21    --bins "EBT cboot.bin; DTB tegra210-p3448-0000-p3449-0000-a02.dtb" 
saving flash command in /home/jetson/Linux_for_Tegra/bootloader/flashcmd.txt
saving Windows flash command to /home/jetson/Linux_for_Tegra/bootloader/flash_win.bat
assign_value: crc-flash.xml.bin 1 65520 1
printf '\x1' | dd of=crc-flash.xml.bin bs=1 seek=65520 count=1 conv=notrunc
1+0 records in
1+0 records out
1 byte copied, 0.000234981 s, 4.3 kB/s
assign_value: crc-flash.xml.bin 0 65521 1
printf '\x0' | dd of=crc-flash.xml.bin bs=1 seek=65521 count=1 conv=notrunc
1+0 records in
1+0 records out
1 byte copied, 0.000316708 s, 3.2 kB/s
assign_string: crc-flash.xml.bin PTHD 65528 4
echo PTHD | dd of=crc-flash.xml.bin bs=1 seek=65528 count=4 conv=notrunc
4+0 records in
4+0 records out
4 bytes copied, 0.000171567 s, 23.3 kB/s
*** Flashing target device started. ***
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands
 
[   0.0197 ] tegrasign --getmode mode.txt --key None
[   0.0268 ] Assuming zero filled SBK key
[   0.0359 ] 
[   0.0371 ] Generating RCM messages
[   0.0471 ] tegrarcm --listrcm rcm_list.xml --chip 0x21 0 --download rcm nvtboot_recovery.bin 0 0
[   0.0522 ] RCM 0 is saved as rcm_0.rcm
[   0.0625 ] RCM 1 is saved as rcm_1.rcm
[   0.0626 ] List of rcm files are saved in rcm_list.xml
[   0.0627 ] 
[   0.0628 ] Signing RCM messages
[   0.0700 ] tegrasign --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   0.0747 ] Assuming zero filled SBK key
[   0.0930 ] 
[   0.0931 ] Copying signature to RCM mesages
[   0.0996 ] tegrarcm --chip 0x21 0 --updatesig rcm_list_signed.xml
[   0.1160 ] 
[   0.1162 ] Parsing partition layout
[   0.1246 ] tegraparser --pt flash.xml.tmp
[   0.1341 ] 
[   0.1350 ] Using default ramcode: 0
[   0.1351 ] Disable BPMP dtb trim, using default dtb
[   0.1352 ] 
[   0.1353 ] Creating list of images to be signed
[   0.1424 ] tegrahost --chip 0x21 0 --partitionlayout flash.xml.bin --list images_list.xml
[   0.2491 ] 
[   0.2496 ] Generating signatures
[   0.2621 ] tegrasign --key None --list images_list.xml --pubkeyhash pub_key.key
[   0.2697 ] Assuming zero filled SBK key
[   0.4933 ] 
[   0.4938 ] Generating br-bct
[   0.5415 ] tegrabct --bct P3448_A00_lpddr4_204Mhz_P987.cfg --chip 0x21 0
[   0.5755 ] 
[   0.5757 ] Updating boot device parameters
[   0.5829 ] tegrabct --bct P3448_A00_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updatedevparam flash.xml.bin
[   0.5875 ] Warning: No sdram params
[   0.5884 ] 
[   0.5884 ] Updating bl info
[   0.5940 ] tegrabct --bct P3448_A00_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updateblinfo flash.xml.bin --updatesig images_list_signed.xml
[   0.6152 ] 
[   0.6154 ] Updating secondary storage information into bct
[   0.6249 ] tegraparser --pt flash.xml.bin --chip 0x21 0 --updatecustinfo P3448_A00_lpddr4_204Mhz_P987.bct
[   0.6322 ] 
[   0.6324 ] Updating Odmdata
[   0.6387 ] tegrabct --bct P3448_A00_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updatefields Odmdata =0xa4000
[   0.6432 ] Warning: No sdram params
[   0.6444 ] 
[   0.6446 ] Get Signed section of bct
[   0.6519 ] tegrabct --bct P3448_A00_lpddr4_204Mhz_P987.bct --chip 0x21 0 --listbct bct_list.xml
[   0.6577 ] 
[   0.6578 ] Signing BCT
[   0.6703 ] tegrasign --key None --list bct_list.xml --pubkeyhash pub_key.key
[   0.6754 ] Assuming zero filled SBK key
[   0.6772 ] 
[   0.6773 ] Updating BCT with signature
[   0.6848 ] tegrabct --bct P3448_A00_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updatesig bct_list_signed.xml
[   0.6910 ] 
[   0.6913 ] Copying signatures
[   0.6973 ] tegrahost --chip 0x21 0 --partitionlayout flash.xml.bin --updatesig images_list_signed.xml
[   0.7365 ] 
[   0.7367 ] Updating BFS information on BCT
[   0.7448 ] tegrabct --bct P3448_A00_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updatebfsinfo flash.xml.bin
[   0.7519 ] 
[   0.7522 ] Boot Rom communication
[   0.7595 ] tegrarcm --chip 0x21 0 --rcm rcm_list_signed.xml
[   0.7643 ] BR_CID: 0x321010016441d5c90400000016fe8040
[   0.7688 ] RCM version 0X210001
[   0.7844 ] Boot Rom communication completed
[   1.7942 ] 
[   1.7947 ] Sending BCTs
[   1.8077 ] tegrarcm --download bct P3448_A00_lpddr4_204Mhz_P987.bct
[   1.8129 ] Applet version 00.01.0000
[   1.8329 ] Sending bct
[   1.8337 ] [................................................] 100%
[   2.0628 ] 
[   2.0779 ] tegrahost --chip 0x21 --align cboot.bin
[   2.0874 ] 
[   2.0938 ] tegrahost --magicid EBT --appendsigheader cboot.bin cboot.bin_blheader
[   2.1083 ] 
[   2.1177 ] tegrasign --key None --list cboot.bin_list.xml
[   2.1240 ] Assuming zero filled SBK key
[   2.1675 ] 
[   2.1748 ] tegrahost --updatesigheader cboot.bin_blheader.encrypt cboot.bin_blheader.hash zerosbk
[   2.1840 ] 
[   2.1941 ] tegrahost --chip 0x21 --align tegra210-p3448-0000-p3449-0000-a02.dtb
[   2.1977 ] 
[   2.2045 ] tegrahost --magicid DTB --appendsigheader tegra210-p3448-0000-p3449-0000-a02.dtb tegra210-p3448-0000-p3449-0000-a02.dtb_blheader
[   2.2124 ] 
[   2.2187 ] tegrasign --key None --list tegra210-p3448-0000-p3449-0000-a02.dtb_list.xml
[   2.2229 ] Assuming zero filled SBK key
[   2.2452 ] 
[   2.2544 ] tegrahost --updatesigheader tegra210-p3448-0000-p3449-0000-a02.dtb_blheader.encrypt tegra210-p3448-0000-p3449-0000-a02.dtb_blheader.hash zerosbk
[   2.2613 ] 
[   2.2636 ] Sending bootloader and pre-requisite binaries
[   2.2694 ] tegrarcm --download ebt cboot.bin.encrypt 0 0 --download rp1 tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt 0
[   2.2743 ] Applet version 00.01.0000
[   2.2955 ] Sending ebt
[   2.2966 ] [................................................] 100%
[   2.4136 ] Sending rp1
[   2.4149 ] [................................................] 100%
[   2.4745 ] 
[   2.4846 ] tegrarcm --boot recovery
[   2.4886 ] Applet version 00.01.0000
[   2.5102 ] 
[   2.5105 ] Retrieving storage infomation
[   2.5186 ] tegrarcm --oem platformdetails storage storage_info.bin
[   2.5224 ] Applet is not running on device. Continue with Bootloader
[   3.1693 ] 
[   3.2127 ] tegradevflash --oem platformdetails storage storage_info.bin
[   3.2185 ] Cboot version 00.01.0000
[   3.2255 ] Saved platform info in storage_info.bin
[   3.2292 ] 
[   3.2294 ] Flashing the device
[   3.2354 ] tegradevflash --pt flash.xml.bin --storageinfo storage_info.bin --create
[   3.2397 ] Cboot version 00.01.0000
[   3.2438 ] Writing partition GPT with gpt.bin
[   3.2455 ] [................................................] 100%
[   3.2514 ] Writing partition PT with crc-flash.xml.bin
[  17.1538 ] [................................................] 100%
[  17.1597 ] Writing partition NVC with nvtboot.bin.encrypt
[  21.0774 ] [................................................] 100%
[  21.0913 ] Writing partition NVC_R with nvtboot.bin.encrypt
[  31.1124 ] [................................................] 100%
[  31.1372 ] Writing partition TBC with nvtboot_cpu.bin.encrypt
[  41.1675 ] [................................................] 100%
[  41.1766 ] Writing partition RP1 with kernel_tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt
[  45.3538 ] [................................................] 100%
[  45.3711 ] Writing partition EBT with cboot.bin.encrypt
[  59.3061 ] [................................................] 100%
[  59.3498 ] Writing partition WB0 with warmboot.bin.encrypt
[  88.4097 ] [................................................] 100%
[  88.4214 ] Writing partition BPF with sc7entry-firmware.bin.encrypt
[  88.6914 ] [................................................] 100%
[  88.7000 ] Writing partition TOS with tos-mon-only.img.encrypt
[  88.9670 ] [................................................] 100%
[  88.9832 ] Writing partition DTB with kernel_tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt
[  92.4261 ] [................................................] 100%
[  92.4444 ] Writing partition LNX with boot.img.encrypt
[ 106.3803 ] [................................................] 100%
[ 106.4330 ] Warning: EKS partition magic header mismatch!
[ 146.2568 ] Writing partition EKS with eks.img
[ 146.2593 ] [................................................] 100%
[ 146.2654 ] Writing partition BMP with bmp.blob
[ 146.5362 ] [................................................] 100%
[ 146.5814 ] Writing partition RP4 with rp4.blob
[ 155.6337 ] [................................................] 100%
[ 155.6758 ] Writing partition VER_b with qspi_bootblob_ver.txt
[ 163.5059 ] [................................................] 100%
[ 163.5350 ] Writing partition VER with qspi_bootblob_ver.txt
[ 163.8056 ] [................................................] 100%
[ 163.8166 ] Writing partition APP with system.img
[ 164.0756 ] [................................................] 100%
[ 723.6365 ] 
[ 723.6754 ] tegradevflash --write BCT P3448_A00_lpddr4_204Mhz_P987.bct
[ 723.6841 ] Cboot version 00.01.0000
[ 723.6883 ] Writing partition BCT with P3448_A00_lpddr4_204Mhz_P987.bct
[ 723.6902 ] [................................................] 100%
[ 730.3504 ] 
[ 730.3508 ] Flashing completed

[ 730.3515 ] Coldbooting the device
[ 730.3652 ] tegradevflash --reboot coldboot
[ 730.3725 ] Cboot version 00.01.0000
[ 730.3766 ] 
*** The target t210ref has been flashed successfully. ***
Reset the board to boot from internal eMMC.
```

正常に終了すれば復旧完了です。

## 参考にした情報

https://www.macnica.co.jp/business/semiconductor/articles/nvidia/137000/

https://qiita.com/akira-sasaki/items/444c8966befbf5166b9e

https://ebi-works.com/jetson-recovery/

https://mattari-diy.com/2021/02/13/jetsonnano%e3%81%a7suspend%e6%9c%89%e5%8a%b9%e5%8c%96/