images imagebuilder: Allow to add sanitized extra name
authorFelix Fietkau <nbd@openwrt.org>
Sun, 3 Jan 2016 14:44:56 +0000 (14:44 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 3 Jan 2016 14:44:56 +0000 (14:44 +0000)
For final output image names allow user to add an
extra string (which is sanitized).  This is particularly
useful with ImageBuilder where you may generate multiple
images from the same base and for the same board,
with different package selections and additional files
(via FILES=).

Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
SVN-Revision: 48083

include/image.mk
target/imagebuilder/files/Makefile

index 4ffad28bd61803c912da78d13d90afc52b7636be..cebe42e9d0f99e01a44c425026c6f650615b53c4 100644 (file)
@@ -31,8 +31,9 @@ $(shell echo $(call tolower,$(1)) | sed 's/_/-/g')
 endef
 
 DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
+EXTRA_NAME_SANITIZED=$(call sanitize,$(EXTRA_IMAGE_NAME))
 
-IMG_PREFIX:=$(DIST_SANITIZED)-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
+IMG_PREFIX:=$(DIST_SANITIZED)-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(if $(EXTRA_NAME_SANITIZED),$(EXTRA_NAME_SANITIZED)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
 
 MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt
 
index f612ea9abc25e04e795791aa99563ef228efb3dc..1056a42ca31a8407f306e01b5b92ca1fbfca3fc6 100644 (file)
@@ -43,7 +43,7 @@ Building images:
        make image PACKAGES="<pkg1> [<pkg2> [<pkg3> ...]]" # include extra packages
        make image FILES="<path>" # include extra files from <path>
        make image BIN_DIR="<path>" # alternative output directory for the images
-
+       make image EXTRA_IMAGE_NAME="<string>" # Add this to the output image filename (sanitized)
 endef
 $(eval $(call shexport,Helptext))
 
@@ -174,7 +174,7 @@ package_postinst: FORCE
 build_image: FORCE
        @echo
        @echo Building images...
-       $(NO_TRACE_MAKE) -C target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 \
+       $(NO_TRACE_MAKE) -C target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \
                $(if $(USER_PROFILE),PROFILE="$(USER_PROFILE)")
 
 clean: