include/image.mk and are available when writing image generation rules in target/linux/<target>/image/Makefile.
Core Directory Variables
Build Directories
Build Directories
| Variable | Description |
|---|---|
KDIR | Kernel build directory: $(BUILD_DIR)/linux-$(BOARD)_$(SUBTARGET) |
KDIR_TMP | Temporary directory inside KDIR: $(KDIR)/tmp |
DTS_DIR | Compiled Device Tree blobs directory: $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts |
TARGET_DIR | Staged rootfs directory: $(BUILD_DIR)/root-$(BOARD) |
BUILD_DIR | Package build base directory |
STAGING_DIR_IMAGE | Image staging directory: $(STAGING_DIR)/image |
Image Naming Variables
Image Prefix Variables
Image Prefix Variables
| Variable | Description | Example |
|---|---|---|
IMG_PREFIX | Base filename prefix for all images | openwrt-ath79-generic |
IMG_PREFIX_EXTRA | Additional suffix from CONFIG_EXTRA_IMAGE_NAME (sanitized) | custom- |
IMG_PREFIX_VERNUM | Version number suffix (if CONFIG_VERSION_FILENAMES) | 23.05.3- |
IMG_PREFIX_VERCODE | Version code suffix (if CONFIG_VERSION_CODE_FILENAMES) | r23809- |
IMG_ROOTFS | Rootfs image name: $(IMG_PREFIX)-rootfs | openwrt-ath79-generic-rootfs |
IMG_COMBINED | Combined image name: $(IMG_PREFIX)-combined | openwrt-ath79-generic-combined |
EXTRA_IMAGE_NAME | Raw value before sanitization; set via CONFIG_EXTRA_IMAGE_NAME | custom |
Image Signature Variables
Image Signature Variables
| Variable | Description |
|---|---|
IMG_PART_SIGNATURE | 8-character MD5 of SOURCE_DATE_EPOCH + LINUX_VERMAGIC. Used for partition UUIDs. |
IMG_PART_DISKGUID | GUID formatted from the same hash. Used in GPT partition tables. |
Profile Variables
Device Profile Variables
Device Profile Variables
| Variable | Description |
|---|---|
PROFILE | Current device profile name being built |
PROFILE_SANITIZED | Lowercase, space-replaced version of PROFILE used in filenames |
PROFILE_PACKAGES | Package list specific to this device profile |
DEVICE_VENDOR | Vendor name (e.g., TP-Link) |
DEVICE_MODEL | Model name (e.g., Archer C7) |
DEVICE_VARIANT | Hardware variant (e.g., v2) |
DEVICE_DTS | DTS file name (without .dts extension) |
IMAGE_SIZE | Maximum image size in bytes or with unit suffix |
Filesystem Option Variables
SquashFS Options
SquashFS Options
| Variable | Description |
|---|---|
SQUASHFS_BLOCKSIZE | SquashFS block size (from CONFIG_TARGET_SQUASHFS_BLOCK_SIZE) |
SQUASHFSOPT | Full mksquashfs options string |
SQUASHFSCOMP | Compression algorithm: gzip or xz $(LZMA_XZ_OPTIONS) |
LZMA_XZ_OPTIONS | XZ compression options: -Xpreset 9 -Xe -Xlc 0 -Xlp 2 -Xpb 2 |
JFFS2 and EROFS Options
JFFS2 and EROFS Options
| Variable | Description |
|---|---|
JFFS2OPTS | JFFS2 mkfs options (endianness, compression, squash UIDs) |
JFFS2_BLOCKSIZE | Default JFFS2 erase block sizes: 64k 128k |
EROFSOPT | EROFS mkfs options |
EROFSCOMP | EROFS compression: lz4hc,12 or lzma,109 |
EROFS_PCLUSTERSIZE | EROFS physical cluster size from CONFIG_TARGET_EROFS_PCLUSTER_SIZE |
Utility Macros
Size and Parameter Macros
Size and Parameter Macros
These are GNU make functions (called with
$(call macro,args)):| Macro | Signature | Description |
|---|---|---|
exp_units | $(call exp_units,<size>) | Convert a size with unit postfix to a byte expression. Postfixes: k (kilobytes), m (megabytes), g (gigabytes). E.g., $(call exp_units,4m) expands to 4 * 1024 * 1024. |
param_get | $(call param_get,<key>,<list>) | Extract the value from a key=value entry in a space-separated list. |
param_get_default | $(call param_get_default,<key>,<list>,<default>) | Like param_get, but returns <default> if the key is not found. |
param_mangle | $(call param_mangle,<str>) | Replace spaces with underscores. |
param_unmangle | $(call param_unmangle,<str>) | Replace underscores with spaces. |
mkfs_packages_id | $(call mkfs_packages_id,<pkg-list>) | Generate an 8-character hash from a sorted package list. |
mkfs_target_dir | $(call mkfs_target_dir,<params>) | Get the target directory, optionally per-package. |
Target Parameters Macro
Target Parameters Macro
Image rules use pattern matching via
$* to pass parameters:Filesystem Type Variables
| Variable | Description |
|---|---|
TARGET_FILESYSTEMS | Space-separated list of enabled filesystem types (e.g., squashfs ext4) |
fs-types-y | Filesystems selected by CONFIG_TARGET_ROOTFS_* variables |
FS_64K / FS_128K / FS_256K | Filesystem lists with specific JFFS2 block sizes |
MKFS_DEVTABLE_OPT | Device table option: -D $(INCLUDE_DIR)/device_table.txt |