A New Target From Scratch

To start a new target just creating a new target directory in target/ is enough [6]. As per default just the directory name is displayed as target name, a more verbose name can be supplied in the config.in files in a commented line starting with 'Description:', like:

#Description: Wireless Router (work in progress!)

Via the file config.in target specific options can be added to the ./scripts/Config option menu, as well as other options forced to specific values

SDECFGSET_PKGFILE_TYPE='none'
SDECFGSET_IMAGE='livecd'

# our embeddd SoC
SDECFGSET_ARCH='x86'
SDECFGSET_X86_OPT='i486'

# space saving
SDECFGSET_OPT='size'

SDECFGSET_DO_REBUILD_STAGE=0

The package selection can be supplied by a rule file , just named pkgsel in the target directory:

O *
X 00-dirtree
X linux-header
X linux26
X binutils
X gcc

X uclibc
X busybox

# ...

Additionally the package selection can be altered by custom code (such as sed expressions or Perl scripts) by calling the pkgfilter function inside the config.in.

Last but not least you need at least a build.sh as it controls what to do when the target is built. Most targets actually just want to inherit the whole T2 default code flow and thus just 'source' the generic build.sh which iterators over all packages to be built and invokes the output image post-processing at the end:

. target/generic/build.sh

For how the generic target loops over all active packages just take a look into the referenced file.



[6] In former times a preconfig.in sniplet was required to register the target in the target list:

CFGTEMP_TARGETLIST="$CFGTEMP_TARGETLIST xyz XYZ_Target"
however since version 6.0 the targets are added to the list automatically.