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.
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
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.
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
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.
<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.