Skip to main content
Adding a new target involves creating the directory structure under target/linux/<target>/, writing a target Makefile, providing kernel configuration fragments, Device Tree Sources, and defining image generation rules.
Adding a target from scratch is non-trivial. Start by reading the Makefiles of the closest existing target to understand patterns and conventions.

Required Files

At minimum, a new target needs:
FilePurpose
target/linux/<target>/MakefileDeclares architecture, features, subtargets, default packages
target/linux/<target>/config-<version>Kernel config fragment for the target
target/linux/<target>/image/MakefileImage generation rules
target/linux/<target>/dts/*.dtsDevice Tree Sources for individual boards
Optional but common:
FilePurpose
target/linux/<target>/base-files/Overlay files copied into the rootfs
target/linux/<target>/patches-<version>/Kernel patches specific to this target
target/linux/<target>/modules.mkAdditional kernel module selections

Step-by-Step

1

Create the target directory

mkdir -p target/linux/mytarget/image
mkdir -p target/linux/mytarget/dts
mkdir -p target/linux/mytarget/base-files/etc
2

Write the target Makefile

Create target/linux/mytarget/Makefile:
include $(TOPDIR)/rules.mk

ARCH:=aarch64
BOARD:=mytarget
BOARDNAME:=My New Target
CPU_TYPE:=cortex-a53
SUBTARGETS:=generic

FEATURES:=squashfs ext4 ramdisk

KERNEL_PATCHVER:=6.12

include $(INCLUDE_DIR)/target.mk

DEFAULT_PACKAGES += kmod-gpio-button-hotplug

$(eval $(call BuildTarget))
3

Create a kernel config fragment

Create target/linux/mytarget/config-6.12 with the kernel options required by your SoC:
CONFIG_ARCH_MYHARDWARE=y
CONFIG_SMP=y
CONFIG_NR_CPUS=4
CONFIG_ARM64=y
# CONFIG_VIRTUALIZATION is not set
This fragment is merged on top of the generic kernel config during the build.
4

Add Device Tree Sources

Place .dts files for each board variant in target/linux/mytarget/dts/. These follow the upstream Linux DTS format.
// target/linux/mytarget/dts/my-board-v1.dts
/dts-v1/;
#include "my-soc.dtsi"

/ {
    model = "My Board v1";
    compatible = "myvendor,my-board-v1", "myvendor,my-soc";
};
5

Define image generation

Create target/linux/mytarget/image/Makefile to define how firmware images are built for each device:
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk

define Device/my-board-v1
  DEVICE_VENDOR := MyVendor
  DEVICE_MODEL := My Board
  DEVICE_VARIANT := v1
  DEVICE_DTS := my-board-v1
  IMAGES := sysupgrade.bin factory.bin
  IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | check-size
  IMAGE/factory.bin    := append-kernel | pad-to 64k | append-rootfs | pad-rootfs
endef
TARGET_DEVICES += my-board-v1

$(eval $(call BuildImage))
6

Register the target

The build system automatically discovers targets from target/linux/. Run make menuconfig and verify your target appears under Target System.

Target Makefile Variables

VariableDescriptionExample
ARCHCPU architecture name (used by GCC)mips, arm, aarch64, x86_64
BOARDShort target identifier used in path namesath79, x86, mediatek
BOARDNAMEHuman-readable name shown in menuconfigAtheros ATH79
CPU_TYPECPU type passed to -march=24kc, cortex-a53
SUBTARGETSSpace-separated list of subtarget namesgeneric nand tiny
FEATURESSupported image/filesystem featuressquashfs ext4 ramdisk
KERNEL_PATCHVERLinux kernel version to use6.12
DEFAULT_PACKAGESPackages included in every image for this targetkmod-ath9k uboot-envtools

FEATURES Values

Common values for the FEATURES variable:
FeatureMeaning
squashfsBuild SquashFS rootfs images
ext4Build ext4 rootfs images
ramdiskSupport initramfs images
vdiBuild VirtualBox disk images
vmdkBuild VMware disk images
fpuTarget has hardware floating-point unit
usbgadgetUSB gadget / device-mode support
boot-partSeparate boot partition for kernel
rootfs-partSeparate rootfs partition

Kernel Config Fragments

Kernel configuration is assembled by merging multiple fragments in order:
  1. target/linux/generic/config-<version> — base config shared across all targets
  2. target/linux/<target>/config-<version> — target-specific additions
  3. target/linux/<target>/<subtarget>/config-<version> — subtarget-specific additions (if present)
Fragments use standard Linux Kconfig syntax. Only lines that differ from upstream defaults need to be included.
Use make kernel_menuconfig to interactively configure the kernel and then make kernel_menuconfig CONTROL=save or compare the generated config to extract your changes into the fragment file.

Submitting Upstream

New target submissions should:
  • Follow the OpenWrt contribution guidelines
  • Include at minimum one working device definition with tested factory and sysupgrade images
  • Pass CI build checks
  • Be sent as a patch series to the openwrt-devel mailing list or as a GitHub pull request