A simple Makefile wrapper for OpenWrt imagebuilder
It is a simple tool that uses package templates from text files.
% cd example
% make C=config2 image
% make C=cfg_name [image|copy|install]
Where cfg_name
is a folder containing the configuration described in config.mk
.
image
: Build image and put it into thecfg_name
folder.copy
: Make image and scp it to each host inHOSTS
.install
: All above and sysupgrade. Use with caution!
The build will be performed in /tmp/imgbldr-XXXXX
folder, which will be removed afterwards.
To leave it for debug, set LEAVE_BUILD
:
% make LEAVE_BUILD=yes C=example image
Use listpks
target to check PACKAGES
:
% make C=cfg_name listpks
See example
to get instances.
At least TARGET
, SUBTARGET
and PLATFORM
must be defined.
HOSTS
is set to cfg_name
by default and required for copy
and install
targets.
IMAGE
is the last part of the image file.
The default is squashfs-sysupgrade.bin
which is fine for most cases.
Not all imagebuilder archives and image files match the patterns:
openwrt-imagebuilder-${RELEASE}-${TARGET}-${SUBTARGET}.Linux-x86_64
openwrt-${RELEASE}-${TARGET}-${SUBTARGET}-${PLATFORM}-${IMAGE}
For example, x86/64/Generic
requires:
IMAGE = combined-squashfs.img.gz
image = openwrt-${RELEASE}-${TARGET}-${SUBTARGET}-${IMAGE}
and octeon
requires:
IMAGE = squashfs-sysupgrade.tar
imagebuilder = openwrt-imagebuilder-${RELEASE}-${TARGET}.Linux-x86_64
image = openwrt-${RELEASE}-${TARGET}-${PLATFORM}-${IMAGE}
INSTALL_LISTS
and REMOVE_LISTS
contain template files from lists
.
INSTALL_PKGS
and REMOVE_PKGS
contain individual package names.
Files from cfg_name/files
directory as well as FILES_INSTALL
instructions
will populate a directory passed to
FILES
and thus be included into the image.
The upper level config.mk
is included for all configurations.
It looks like there is no simple and clear way to get the latest release.
Forum thread.
So RELEASE
must be defined in config.mk
or from the command line for now:
% make C=cfg_name RELEASE=22.03.5 image