# Debian/Ubuntu
sudo apt install genimage
When populating filesystems directly from a directory, you can exclude files:
image rootfs.ext4
ext4
rootpath = "build/target_root"
exclude = [
"usr/src/.*", # regex
"run/*", # glob
".git"
]
Genimage supports multiple output "image" definitions:
| Tool | Use Case | GenImage Advantage |
| :--- | :--- | :--- |
| dd + mkfs scripts | Manual, one-off images | Reproducibility – GenImage uses deterministic configs. |
| genext2fs | ext2/3 images only | Multi-format – GenImage supports FAT, ext*, squashfs, ubifs, and more. |
| mkisofs / xorriso | Optical media (ISO) | Block device focus – GenImage targets flash/disk images. |
| Buildroot post-scripts | Custom steps | Simplicity – No shell scripting; just a .conf file. | genimage
One of GenImage’s killer features is creating a complete block image with a partition table, bootloader, kernel, and rootfs. Here’s a config for a typical ARM board:
image sdcard.img
# Create an MBR partition table
hdimage
align = 1M
gpt = false
The most powerful feature of Genimage is its automatic partition layout logic. You define partitions in sequence, and Genimage: # Debian/Ubuntu sudo apt install genimage When populating
You can also fill a partition directly from a directory without creating an intermediate image using the rootpath option, though using intermediate images is cleaner for debugging.
yay -S genimage
For modern UEFI systems, you can set precise partition attributes: You can also fill a partition directly from
partition boot
partition-type-uuid = "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" # ESP
attributes = 0x8000000000000000 # GPT attribute: Required partition