AGX orin 64GB flash fail

I am using below command to flash AGX orin 64GB

sudo ./flash.sh -d nru230_32GB.dtb nru230_32GB_64GB mmcblk0p1

I can successfully flash the AGX Orin 32GB, but I get an error message when attempting to flash the AGX Orin 64GB.

Error: Return value 4
Command tegraparser_v2 --storageinfo storage_info.bin --generategpt --pt flash.xml.bin
Failed flashing t186ref.

For the full error log, please refer to the attached file.
AGXOrin_64G.txt (77.8 KB)

Add this to your Linux_for_Tegra/p3701.conf.common:

# update_local_cfgfile
update_local_cfgfile()
{
	# Update "num_sectors" in local cfgfile for the device
	# with FAB=501 and BOARDSKU=0004/0005
	local local_cfgfile="${1}"
	if [ "${board_FAB}" == "501" ] && [[ "${board_sku}" == "0004" || "${board_sku}" == "0005" ]]; then
		sed -i 's/num_sectors=\"124321792\"/num_sectors=\"124190720\"/' "${local_cfgfile}"
	fi
}

, and remember to call update_local_cfgfile() in flash.sh.

It’s the same as stated in this topic:

Hello DaveYYY

I am using the AGX Orin 64GB on Jetpack 5.1.1
I have add the update_local_cfgfile() in p3701.conf.common

# update_local_cfgfile
update_local_cfgfile()
{
	# Update "num_sectors" in local cfgfile for the device
	# with FAB=501 and BOARDSKU=0004/0005
	echo "Pohsuan update_local_cfgfile"
	local local_cfgfile="${1}"
	echo "Pohsuan board_FAB:${board_FAB}, board_sku:${board_sku}"
	echo "Pohsuan ${local_cfgfile}"
	if [ "${board_FAB}" == "501" ] && [[ "${board_sku}" == "0004" || "${board_sku}" == "0005" ]]; then
		sed -i 's/num_sectors=\"124321792\"/num_sectors=\"124190720\"/' "${local_cfgfile}"
	fi
	cat ${local_cfgfile}
}

, and I also call update_local_cfgfile() in flash.sh

# For T194 device, mb1_b needs to have a different signed image from mb1.
# The solution here is to prepare an image with different name for mb1_b.
# Then the signing utility later will generate a different signed image for mb1_b
if [ "${tegraid}" = "0x19" ]; then
	# Create a file to store the partition layout with mb1 fix
	localcfgfile_mb1_fix_ext="${localcfgfile##*.}";
	localcfgfile_mb1_fix_name="${localcfgfile%.*}";
	localcfgfile_mb1_fix="${localcfgfile_mb1_fix_name}_mb1_fix.${localcfgfile_mb1_fix_ext}";
	mb1_b_filename="${mb1filename:0:3}_b${mb1filename:3}";
	cp "${mb1file}" "${BL_DIR}/${mb1_b_filename}";
	# Replace the mb1_b filename (the second MB1FILE)
	sed ':a;N;$!ba;s/MB1FILE/'"${mb1_b_filename}"'/2' "${cfgfile}" > "${localcfgfile_mb1_fix}"; chkerr;
	mkfilesoft cfgfile "${localcfgfile_mb1_fix}" "";
fi;

# CFGCONV is a flat string holding a bunch of flags for sed, so should not be
# quoted. Maybe need to convert CFGCONV to a list so that we can quote this.
# For now, though, disable SC2086.
cat "${cfgfile}" | limit_boot_chains | sed ${CFGCONV} > ${localcfgfile}; chkerr;

##### ADDED LINE - Replace number of sectors Pohsuan######
echo "Pohsuan localcfgfile : ${localcfgfile}"
cat ${localcfgfile}
update_local_cfgfile  ${localcfgfile}

I have confirmed that the update_local_cfgfile function is working. It has successfully modified the num_sectors parameter in the flash.xml file from 124321792 to 124190720.
But I get the same error code as below

Error: Return value 4
Command tegraparser_v2 --storageinfo storage_info.bin --generategpt --pt flash.xml.bin
Failed flashing t186ref.

For the full error log, please refer to the attached file.
AGXOrin_64G2.txt (154.8 KB)

Did you change anything else in flash_t234_qspi_sdmmc.xml prior to flashing?

Hello DaveYYY

Because I need to clone a system.img, so I modified the APP size to 62090379264 to be a multiple of 4096.

        <partition name="APP" id="1" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 62090379264 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x8 </allocation_attribute>
            <align_boundary> 16384 </align_boundary>
            <percent_reserved> 0 </percent_reserved>
            <unique_guid> APPUUID </unique_guid>
            <filename> APPFILE </filename>
            <description> **Required.** Contains the rootfs. This partition must be assigned
              the "1" for id as it is physically put to the end of the device, so that it
              can be accessed as the fixed known special device `/dev/mmcblk0p1`. </description>
        </partition>

Then of course it still exceeds the disk size limit…
Don’t modify it and do a clean re-flash.

If you do need to backup your running system, you should use the backup/restore tool.
Check Linux_for_Tegra/tools/backup_restore/README_backup_restore.txt.

Hello DaveYYY

I modified the APP partition size in the flash_t234_qspi_sdmmc.xml file to “APPSIZE”.

<partition name="APP" id="1" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> APPSIZE </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x8 </allocation_attribute>
            <align_boundary> 16384 </align_boundary>
            <percent_reserved> 0 </percent_reserved>
            <unique_guid> APPUUID </unique_guid>
            <filename> APPFILE </filename>
            <description> **Required.** Contains the rootfs. This partition must be assigned
              the "1" for id as it is physically put to the end of the device, so that it
              can be accessed as the fixed known special device `/dev/mmcblk0p1`. </description>
        </partition>

As a result, the APP partition size in the flash.xml file was also changed to 59055800320

        <partition name="APP" id="1" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 59055800320 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x8 </allocation_attribute>
            <align_boundary> 16384 </align_boundary>
            <percent_reserved> 0 </percent_reserved>
            <unique_guid>  </unique_guid>
            <filename> system.img </filename>
            <description> **Required.** Contains the rootfs. This partition must be assigned
              the "1" for id as it is physically put to the end of the device, so that it
              can be accessed as the fixed known special device `/dev/mmcblk0p1`. </description>
        </partition>

However, I used flowing command to restore system .img

sudo ./flash.sh -r -d nru230_32GB.dtb nru230_32GB_64GB mmcblk0p1

But, I get the error code as below

[ 466.5084 ] Writing partition APP with system.img [ 25387008372 bytes ]
Error: Return value 3                                         ] 000%
Command tegradevflash_v2 --pt flash.xml.bin --create
Failed flashing t186ref.

real    25m0.596s
user    0m51.634s
sys     0m8.001s

For the full error log, please refer to the attached file.
AGXOrin_64G3.txt (89.1 KB)

你是不是沒看懂我在說什麼
你現在的問題是你從一個disk size比較大的裝置上備份出image 要還原到disk size比較小的image是行不通的
這樣懂嗎

如果你是用dd備份的話會連整個file system的資訊都一起備份出來
大小不一樣的話當然沒辦法還原 光是第一步把partition header寫回去就會掛掉了

如果要備份的話請用這個

DaveYYY 您好

感謝您這麼快速的回應
還是有些疑問想要請教一下

我目前的流程如下

  1. 修改 APP partition size
  2. 使用以下指令刷新 AGX Orin 64G
sudo ./flash.sh -d nru230_32GB.dtb nru230_32GB_64GB mmcblk0p1
  1. 使用 dd 備份 AGX Orin 64G,指令如下
dd if=/dev/mmcblk0p1 | ssh po@$HOST_IP dd of=/$SYS_IMG_RAW.raw status=progress
./mksparse -v --fillpattern=0 $SYS_IMG_RAW.raw $SYS_IMG_RAW.img
  1. 使用下列指令還原 AGX Orin 64G
time sudo ./flash.sh -r -d nru230_32GB.dtb nru230_32GB_64GB mmcblk0p1

想請教一下,因為先修改 APP partition size,後再重刷,不是應該已經重新定義 APP partition 的大小了嗎?
那我再使用 dd 備份的大小應該已經是修改後的,請問這樣還會有大小不匹配的問題嗎?

你的修改APP partition size到底是什麼改成什麼
你現在是同一塊板子備份出來的還原到同一塊板子?
另外麻煩看一下這裡
https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/SD/FlashingSupport.html#cloning-a-jetson-device-and-flashing

If root file system of the source device for clone is resized during oem-config, the eMMC configuration file of destination device must be updated accordingly. For example, with jetson-agx-orin-devkit, root file system (APP) is the final partition before secondary_gpt. If the APP is resized to maximum allowed size, the allocation_attribute of APP partition in Linux_for_Tegra/bootloader/generic/cfg/flash_t234_qspi_sdmmc.xml must be updated from 0x8 to 0x808.

allocation_attribute要改成0x808

Hi DaveYYY

不好意思延遲了一些時間回覆您的問題

你的修改APP partition size到底是什麼改成什麼
->這是我目前 APP partition 改的樣子,附件有完整 flash_t234_qspi_sdmmc.xml

        <partition name="APP" id="1" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 59055800320 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x808 </allocation_attribute>
            <align_boundary> 16384 </align_boundary>
            <percent_reserved> 0 </percent_reserved>
            <unique_guid> APPUUID </unique_guid>
            <filename> APPFILE </filename>
            <description> **Required.** Contains the rootfs. This partition must be assigned
              the "1" for id as it is physically put to the end of the device, so that it
              can be accessed as the fixed known special device `/dev/mmcblk0p1`. </description>
        </partition>

你現在是同一塊板子備份出來的還原到同一塊板子?
->我嘗試使用 AGX Orin 32G 或 AGX Orin 64G 備份跟還原都會出現一樣的問題
當我把 allocation_attribute 改成 0x808 後想要複製image ,會出現 以下Error,Log 如附件

Converting RAW image to Sparse image... size of /home/po/nvidia_NRU230/Linux_for_Tegra/NRU230_clone_2024-05-21_1416.raw is not mulple of 4096.

備份 image 的指令有嘗試過兩組,如下,皆出些上述 Error

sudo ./flash.sh -r -k APP -G ${packname} nru230_32GB_64GB mmcblk0p1
dd if=/dev/mmcblk0p1 | ssh po@$HOST_IP dd of=/home/po/nvidia_NRU230/$SYS_IMG_RAW.raw status=progress

另外跟您講一下我想要成功做到的功能
我想要在 AGX Orin 32GB 上備份出 image,然後可以還原在 AGX Orin 32G & 64G 上面
並且不管是否為 FAB=501 的模組

Log.zip (13.9 KB)

partition大小不是4096的倍數這件事我記得是很久之前的bug了
原始大小就不對的話你再怎麼搞都是沒用的 麻煩至少升到5.1.3再測試

麻煩也用這個測試
我應該建議不只第一次了

Hi Dave

我使用 README_backup_restore.txt 內的的備份 image 指令
出現了 timeout,Log 如附件麻煩在再幫忙確認一下,謝謝

sudo ./tools/backup_restore/l4t_backup_restore.sh -b nru230_32GB_64GB

AGX_Orin_Backup.txt (90.6 KB)

麻煩抓serial console log
只有host log什麼都看不出來

Hi Dave

附件為使用以下指令抓到的 serial & Host log

sudo ./tools/backup_restore/l4t_backup_restore.sh -b nru230_32GB_64GB

麻煩再幫忙確認一下,謝謝
AGX_Orin_Backup_serial.txt (133.0 KB)
AGX_Orin_Backup_Host.txt (90.8 KB)

Hi DaveYYY:
有關於Partition大小不是4096的倍數,很有可能是因為Flash的時候,已經將Allocation attribue改成0x808了
如果要修正的話,可以透過:

(sudo) qumu-img resize system.img.raw 55G

來修正

你們的板子之前都是只有用flash.sh燒嗎
沒有試過任何USB/NVMe?看起來是USB device tree部份就有問題 所以ssh連線開不起來
但是這也不是這個topic該處理的

那我再問一下
你在allocation_attribute分別是0x8和0x808的情況下
完整重燒一次BSP 開機進去之後sudo fdisk -l的大小是多少?
OEM config應該有一個選項會讓你選要不要調整rootfs的大小 可以的話不要改