Modify APP and APP_b partitions sizes

Hi,
I wish to set APP and APP_b partitions with different sizes.
APP will be the operational partition.
APP_b will be a backup/rescue partition with slim kernel and smaller simpler rootfs.

I’ve done this successfully on the Orin NX with both partitions in the external NVMe.
Now I wish to do the same with the AGX Orin and both partitions on the internal eMMC.

I modified the partitions sizes in the file: flash_t234_qspi_sdmmc_rootfs_ab.xml
(for testing I manually set both sizes to 12884901888 (12GB) )

The flash.sh hangs and the serial output the following error:

[16:25:23:733] I> Writing APP partition.␍␊

[16:25:23:773] E> NV3P_SERVER: Could not write 1048576 bytes.␍␊

Did you specify the size of rootfs with the -S flag while flashing?

No because in the next steps I want to specify different size to each partition.
Do you say I have to use this flag and flash twice, each time another APP partition?

NO, you just need one time. Something like -S 12GiB.
Anyway, I don’t think 12GB is enough, and please find the required size yourself.

But I want different size to each partition…

I’m saying that 12GB is not enough, and not that they cannot be different.

I apologise but maybe I misunderstand something.

If I use -S 20GiB for example, it will use this flag for both APP and APP_b right?
I wish to create both partitions with different sizes

It’s just how large the system image will be, not how large the partition is.

How did you do it to have different rootfs flashed?

flashed twice.
first without -k flag (creates both APP and APP_b rootfs)
second with -k APP_b (modify only APP_b rootfs)

Is it possible to flash “regularly” , modify the partitions sizes with gparted, backup whole partitions (with modified sizes) with backup_restore tool and then flash it again in future use and it will keep the modified partitions sizes?

I think YES, but you would like to be careful when adjusting the partition size.

I tried using the tool (generate backup imgae) but it failed.
this is the log:
backup.log (91.7 KB)

mmcblk0, not mmcblk0p1.

The backup tool works but now I left with last problem:

If I flash with A/B enabled and then resize partitions sizes with gparted then I get fragmentation because I reduced partition APP size and got free space between APP and APP_b partitions.
The only way to overcome this is to move APP_b partition but then the system won’t boot (I get a warning message from gparted)

So my only option is to flash with A/B enabled and specify the APP partition size.
How can I do it?

What does move mean here?

I’m not sure if this will work, but you can give it a try:

At first, you don’t enable ROOTFS_AB, and you flash the complete rootfs, clone the system.img, and then you flash the minimized rootfs, and also clone it.
Then you modify the partition layout file with the size you want, place the two cloned images in the right place, and flash with -r so it doesn’t generate new system images.

I’ll explain myself:
For example the partitions layout is:

  1. Before gparted:

| partition 0 | partition 1 | . . . | APP | APP_b | Free Space |

  1. After gparted (I reduced both APP and APP_b sizes):

| partition 0 | partition 1 | . . . | APP (smaller) | Free Space | APP_b (smaller) | Free Space (bigger) |

  1. So I need to “move” APP_b in order to get:
    | partition 0 | partition 1 | . . . | APP (smaller) | APP_b (smaller) | Free Space (bigger) |

So we can return to the basic question:
How to reduce APP size when using A/B mechanism.
If I’ll manage to do that, I won’t need to reduce the APP partition with gparted (because I already modified it size) and then continue with the backup tool and everything will work.