"is not mulple of 4096" bug is back in Jetson 35.2.1 and Orin cannot be cloned anymore

Hi,
I just run
sudo ./flash.sh jetson-agx-orin-devkit mmcblk0p1
sudo ./flash.sh -r -k APP -G backup jetson-agx-orin-devkit mmcblk0p1
and got error
size of backup.img.raw is not mulple of 4096.

I know that Jetson 35.1.0 had a patch for nvresizefs.sh, which ensured that APP partition size is a multiple of 4096 and cloning use to work. This patch was already applied in Jetson 35.2.1, but nvresizefs.sh still fails
and APP partition size remains odd:
sudo blockdev --getsize64 /dev/mmcblk0p1
62091116032
I tried to run myself:
sudo /usr/lib/nvidia/resizefs/nvresizefs.sh
but it fails. I found that the following line returns error:
sudo sgdisk --move-second-header /dev/mmcblk0
and then nvresizefs.sh aborts silently.
I tried to run
sudo sgdisk --move-second-header /dev/mmcblk0
and got error:
Warning! Secondary partition table overlaps the last partition by
6 blocks!
Try reducing the partition table size by 24 entries.
(Use the ‘s’ item on the experts’ menu.)
Aborting write of new partition table.
This is the full output from parted:
sudo parted /dev/mmcblk0
unit B
p
Model: MMC G1M15M (sd/mmc)
Disk /dev/mmcblk0: 63652757504B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start        End           Size          File system  Name                Flags
2      20480B       134238207B    134217728B                 A_kernel            msftdata
3      134238208B   135024639B    786432B                    A_kernel-dtb        msftdata
4      135024640B   168185855B    33161216B                  A_reserved_on_user  msftdata
5      168185856B   302403583B    134217728B                 B_kernel            msftdata
6      302403584B   303190015B    786432B                    B_kernel-dtb        msftdata
7      303190016B   336351231B    33161216B                  B_reserved_on_user  msftdata
8      336351232B   420237311B    83886080B                  recovery            msftdata
9      420237312B   420761599B    524288B                    recovery-dtb        msftdata
10      420761600B   487870463B    67108864B     fat32        esp                 boot, esp
11      487870464B   571756543B    83886080B                  recovery_alt        msftdata
12      571756544B   572280831B    524288B                    recovery-dtb_alt    msftdata
13      572280832B   639389695B    67108864B                  esp_alt             msftdata
14      639389696B   1561612287B   922222592B                 reserved            msftdata
1      1561624576B  63652740607B  62091116032B  ext4         APP                 msftdata

What should I do?

Thank you

Hi jhmlmn,

Did you restore the cloned image w/o specifying the size of rootfs on this board before?

Please refer to the following thread for the clone and restore operation in r35.2.1
Can not flash by use clone image of orin agx platform - #2

No, -S does not help.
I found that error happens if I change allocation_attribute of APP partition from 0x8 to 0x808 in Linux_for_Tegra/bootloader/t186ref/cfg/flash_t234_qspi_sdmmc.xml as you told me in

If I leave allocation_attribute unmodified, then partition size ends up being a multiple of 4096 and making a backup of system.img works, but later attempt to flash that image to new devices fail.

But if I change attribute to 0x808, then partition size ends up being odd and I cannot take a backup.
In either case there is no process to perform the full cycle without errors - flash, backup, clone.

Here are my exact steps:

export JETPACK=$HOME/Jetson_Linux_R35.2.1_aarch64_manual/Linux_for_Tegra
mkdir -p $JETPACK/rootfs
cd $JETPACK/…
tar xf $HOME/Downloads/jetson-linux-r3521/jetson_linux_r35.2.1_aarch64.tbz2
cd $JETPACK/rootfs
sudo tar xpf $HOME/Downloads/jetson-linux-r3521/linux-sample-root-filesystem-r3521aarch64.tbz2
sudo $JETPACK/apply_binaries.sh
cd $JETPACK

Now manually edit $JETPACK/bootloader/t186ref/cfg/flash_t234_qspi_sdmmc.xml and
modify allocation_attribute of APP from 0x8 to 0x808.

I first do flash --no-flash to get the size of system.img.raw :

sudo ./flash.sh --no-flash jetson-agx-orin-devkit mmcblk0p1
Making system.img…
ls -l bootloader/system.img*
-rwxr-xr-x 1 root root 5699429012 Mar 15 20:52 bootloader/system.img
-rw-r–r-- 1 root root 59055800320 Mar 15 20:51 bootloader/system.img.raw
Note that 59055800320 is multiple of 4096:

Note: here used -S parameter, as you suggested, but it makes no difference:

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

[ 483.2732 ] Writing partition APP with system.img [ 5699429012 bytes ]
[ 483.2791 ] […] 100%
… configure device …
sudo blockdev --getsize64 /dev/mmcblk0p1
62091116032
so, it is bad again - not a multiple of 4096
Attempt to run
sudo /usr/lib/nvidia/resizefs/nvresizefs.sh
fails
sudo sgdisk --move-second-header /dev/mmcblk0
Warning! Secondary partition table overlaps the last partition by

Could you, please, write a single sequence of steps which performs the full cycle: flash, backup, clone
without errors?

Thank you

Yes, I found that it would cause size of rootfs changed.

Yes, do not modify allocation_attribute to 0x808.
When you want to flash the image to new device, please specify the size of rootfs with -S parameter in flash.sh. In this way, it would not cause flash failed.

Please refer to the full steps as follow:

1. cloning
Generate the clone image at the path(~/nvidia/nvidia_sdk/JetPack_5.1_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra) via SDK Manager with the following command:
$ sudo ./flash.sh -r -k APP -G clone.img jetson-agx-orin-devkit mmcblk0p1

2.flashing
2-1. replace the Linux_for_Tegra/bootloader/system.img with clone.img.
2-2. flash the cloned image with ROOTFSSIZE parameter (to meet the actual size of mmcblk0p1) in the following command:
$ sudo ./flash.sh -r -S 59055800320 jetson-agx-orin-devkit mmcblk0p1

3. checking the size 
3-1 on host PC
$ ls -l clone.img.raw
3-2 on the board
$ sudo blockdev --getsize64 /dev/mmcblk0p1

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.