...
However it is more likely that neither Linux nor even U-Boot are available at this point. Refer to section i.MX6 U-Boot how to load u-boot to RAM.
...
resize the rootfs partition
resize the rootfs filesystem
create and format the 2nd and 3rd partitions
extract the archives from /boot into the relevant partitions
delete the archives from /boot
disable itself from systemd
...
calculate the smallest image size that will contain your data
run
du -s -B M /path/to/your/
rootfs
to get the size of your data in megabytesadd 10%
partition size is at least 1MB smaller than the drive.
...
create an image file with a single ext4 partition: and with the bootloader
dd if=/dev/zero of=/path/to/vivi.img bs=1M count=$SIZE_MB
losetup /dev/loop0 /path/to/vivi.img
dd if=path/to/u-boot-imx6/SPL of=/dev/loop0 bs=1k seek=1 oflag=sync
dd if=path/to/u-boot-imx6/u-boot.img of=/dev/loop0 bs=1k seek=42 oflag=sync
Code Block sfdisk -f -uB /dev/loop0 «EOF
1024,${PARTSIZE}
EOF
sync
losetup -d /dev/loop0
...
populate the single partition with the rootfs, the archives of the other partitions, and the firstboot script
losetup -o 1048576 /dev/loop0 /path/to/vivi.img # load the partition and not the entire disk image
mkfs -t ext4 /dev/loop0
mount /dev/loop0 /mnt
do populate
add the firstboot script: systemd firstboot script - Google Search
umount /dev/loop0
losetup -d /dev/loop0
Further reading
Booting from network/PXE