build: support adding version code to file names (FS#323)
authorJo-Philipp Wich <jo@mein.io>
Mon, 5 Dec 2016 15:44:13 +0000 (16:44 +0100)
committerJo-Philipp Wich <jo@mein.io>
Fri, 9 Dec 2016 16:16:43 +0000 (17:16 +0100)
Now that the VERSION_NUMBER variable holds the human friendly name and not
the commit ID anymore, we need to support adding the revision ID as well.

Introduce a new config variable CONFIG_VERSION_CODE_FILENAMES which, if set,
causes the resulting file names to contain a commit ID designation as printed
by scripts/getver.sh.

Also sanitize the input variables to ensure that the resulting strings are
lowercased and no not contain spaces.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
include/image.mk
package/base-files/image-config.in

index d1dcdd6bad225e95ffc79f330f5b7f35722a680e..93c3bbd2462d1ba2166a6983f1aabcfa9dff2b62 100644 (file)
@@ -40,9 +40,11 @@ KDIR=$(KERNEL_BUILD_DIR)
 KDIR_TMP=$(KDIR)/tmp
 DTS_DIR:=$(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts
 
-EXTRA_NAME_SANITIZED=$(call sanitize,$(EXTRA_IMAGE_NAME))
+IMG_PREFIX_EXTRA:=$(if $(EXTRA_IMAGE_NAME),$(call sanitize,$(EXTRA_IMAGE_NAME))-)
+IMG_PREFIX_VERNUM:=$(if $(CONFIG_VERSION_FILENAMES),$(call sanitize,$(VERSION_NUMBER))-)
+IMG_PREFIX_VERCODE:=$(if $(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERSION_CODE))-)
 
-IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(if $(EXTRA_NAME_SANITIZED),$(EXTRA_NAME_SANITIZED)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
+IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
 
 MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt
 
index 4610c2b995a32ba4abe8353a1e88aaf06ad75b39..b18f2d85b128e354c7275c2625c50af83292d068 100644 (file)
@@ -258,6 +258,15 @@ if VERSIONOPT
                help
                        Enable this to include the version number in firmware image, SDK-
                        and Image Builder archive file names
+
+       config VERSION_CODE_FILENAMES
+               bool
+               prompt "Revision code in filenames"
+               default y
+               help
+                       Enable this to include the revision identifier or the configured
+                       version code into the firmware image, SDK- and Image Builder archive
+                       file names
 endif