Extra tip for headless install of image to eMMC where you first edit the WiFi and other parameters.
Using DietPI image in this example
download image -> extract so you get the native .img file
check partitions that exist in the image using fdisk
sudo fdisk -l DietPi_RadxaZERO3-ARMv8-Bookworm.img
Disk DietPi_RadxaZERO3-ARMv8-Bookworm.img: 1.13 GiB, 1207976448 bytes, 2359329 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 77E56261-4023-4345-91AC-EE144546C393
Device Start End Sectors Size Type
DietPi_RadxaZERO3-ARMv8-Bookworm.img1 32768 2357247 2324480 1.1G Linux filesystem
DietPi_RadxaZERO3-ARMv8-Bookworm.img2 2357248 2359295 2048 1M Microsoft basic data
in this case, 2 partitions exist and the DietPI filesystem resides in the first partition.
We can mount this partition and make changes because there is “free space” in the partition.
to mount we need to calculate the offset of partition by multiplying the start sector (32768) with the sector size (512) = 16777216
use that to mount in Read-Write mode to a mountpoint of your choice (make sure that folder exists first, in this case /mnt/img)
sudo mount -o loop,rw,sync,offset=16777216 DietPi_RadxaZERO3-ARMv8-Bookworm.img /mnt/img
now you can change
/mnt/img/boot/dietpi-wifi.txt for the wireless SSID and password
/mnt/img/boot/dietpi.txt for root password, locale, keyboard, WiFi country code, Timezone
more settings in the DietPi manual but these basic ones are enough
umount /mnt/img
done
now just write this image as normal…