Is this R28.2? I’m not certain, but what you can do and how you do it might change slightly depending on release.
You can resize system.img.raw while via covering it with loopback (“sudo losetup --find ./system.img.raw”, then look for “/dev/loop0” or whatever number was indicated) and doing the resize on the loopback device as if it is a real hard drive. Don’t forget to detach the loop device after you finish…the flash.sh script itself has a bug in it and it doesn’t correctly detect if loop0 is already in use. See “man losetup” for detaching.
I have not tried splitting the APP partition, there is some risk, but what you want to do should be possible (make a backup of your clone). Logical sector size is 512 bytes, so any changes should be an even multiple of this. Your extra partition will need a new label other than APP.
I’m also not sure which host “bootloader/” config files are overwritten during a flash based on arguments, but look at the “bootloader/flash.xml” file. This lists partitions to be flashed, labels, so on. If you flashed with max size for rootfs originally, then size is 30742151168…this divided by 1024 twice is “29318MiB”. Any changes would need to be 512 byte increments.
Note that if you were to flash with a size of “-S 29318MiB” you’ve used max size APP. If you wanted something like 10GiB reserved, then “1010241024*1024” is 10737418240 bytes. Or in MiB, 10240. You could just resize your system.img.raw to “30742151168 - 10737418240 == 20004732928”, and then flash with the “-r” to re-use the existing image…but put your image in place of “bootloader/system.img”. The flash command would name size 20004732928 (20004732928/1024/1024 == 19078) like this:
# Resize clone, put it in place of "bootloader/system.img". Flash:
sudo ./flash.sh -S 19078MiB jetson-tx2 mmcblk0p1
Once flash finished you could use normal tools (gdisk) to partition the free space.