Message ID | 20200823082300.915092-1-mail@aparcar.org |
---|---|
State | Under Review |
Delegated to: | Paul Spooren |
Headers | show |
Series | [v2] build: optionally disable target name in filenames | expand |
The PKG_RELEASE must be bumped which I forgot in this patch! On 22.08.20 22:23, Paul Spooren wrote: > The target/subtarget is included in all image filenames by default. This > is useful if the same profile exists in multiple targets or > developers/users want an obvious related of images to targets. > > However this information can also be confusing at it adds a lengthy > string to sysupgrade images containing an information which is likely > unknown to regular users: The target/subtarget. > > This commit therefore adds the new image option called > CONFIG_TARGET_FILENAMES to make the target/subtarget filename part > optional. It is ENABLED by default. To archive this the target/subtarget > is added if CONFIG_VERSIONOPT is disabled and CONFIG_TARGET_FILENAMES > default to `y`. This keeps the current behaviour for OpenWrt & > downstream projects while making the target/subtarget inclusion still > optional. > > Newly produced files would with enabled CONFIG_VERSIONOPT and disabled > CONFIG_TARGET_FILENAMES look like the following: > > * openwrt-linksys_wrt3200acm-initramfs-kernel.bin > * openwrt-linksys_wrt3200acm.manifest > * openwrt-linksys_wrt3200acm-squashfs-factory.img > * openwrt-linksys_wrt3200acm-squashfs-sysupgrade.bin > > ImageBuilder and SDK archive file names are generated individually and > not influenced by the option. > > Signed-off-by: Paul Spooren <mail@aparcar.org> > --- > v2: Make it optional and keep everything as it is right now by default. > > include/image.mk | 13 +++++++++---- > package/base-files/image-config.in | 11 +++++++++++ > 2 files changed, 20 insertions(+), 4 deletions(-) > > diff --git a/include/image.mk b/include/image.mk > index e8c2cf7100..989cc44699 100644 > --- a/include/image.mk > +++ b/include/image.mk > @@ -37,11 +37,16 @@ KDIR=$(KERNEL_BUILD_DIR) > KDIR_TMP=$(KDIR)/tmp > DTS_DIR:=$(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts > > +ifdef CONFIG_VERSIONOPT > + IMG_PREFIX_TARGET:=$(if $(CONFIG_TARGET_FILENAMES),$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-) > +else > + IMG_PREFIX_TARGET:=$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))- > +endif > 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)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) > +IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(IMG_PREFIX_TARGET) > IMG_ROOTFS:=$(IMG_PREFIX)-rootfs > IMG_COMBINED:=$(IMG_PREFIX)-combined > IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | mkhash md5 | cut -b1-8) > @@ -293,7 +298,7 @@ endef > > define Image/Manifest > $(call opkg,$(TARGET_DIR_ORIG)) list-installed > \ > - $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest > + $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),$(PROFILE_SANITIZED)).manifest > endef > > define Image/gzip-ext4-padded-squashfs > @@ -317,7 +322,7 @@ ifdef CONFIG_TARGET_ROOTFS_TARGZ > define Image/Build/targz > $(TAR) -cp --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name \ > $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \ > - -C $(TARGET_DIR)/ . | gzip -9n > $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))-rootfs.tar.gz > + -C $(TARGET_DIR)/ . | gzip -9n > $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),$(PROFILE_SANITIZED))-rootfs.tar.gz > endef > endif > > @@ -385,7 +390,7 @@ define Device/Init > > IMAGES := > ARTIFACTS := > - IMAGE_PREFIX := $(IMG_PREFIX)-$(1) > + IMAGE_PREFIX := $(IMG_PREFIX)$(1) > IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1)-$$(2) > IMAGE_SIZE := > KERNEL_PREFIX = $$(IMAGE_PREFIX) > diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in > index 3432db525a..4bace77db0 100644 > --- a/package/base-files/image-config.in > +++ b/package/base-files/image-config.in > @@ -256,6 +256,7 @@ if VERSIONOPT > 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" > @@ -264,6 +265,16 @@ if VERSIONOPT > Enable this to include the revision identifier or the configured > version code into the firmware image, SDK- and Image Builder archive > file names > + > + config TARGET_FILENAMES > + bool > + prompt "Target and subtarget in filenames" > + default y > + help > + Enable this to include the target (and subtarget) in firmware image > + filenames. SDK and ImageBuilder archive filenames are not influenced > + by this option. > + > endif > >
diff --git a/include/image.mk b/include/image.mk index e8c2cf7100..989cc44699 100644 --- a/include/image.mk +++ b/include/image.mk @@ -37,11 +37,16 @@ KDIR=$(KERNEL_BUILD_DIR) KDIR_TMP=$(KDIR)/tmp DTS_DIR:=$(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts +ifdef CONFIG_VERSIONOPT + IMG_PREFIX_TARGET:=$(if $(CONFIG_TARGET_FILENAMES),$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-) +else + IMG_PREFIX_TARGET:=$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))- +endif 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)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) +IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(IMG_PREFIX_TARGET) IMG_ROOTFS:=$(IMG_PREFIX)-rootfs IMG_COMBINED:=$(IMG_PREFIX)-combined IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | mkhash md5 | cut -b1-8) @@ -293,7 +298,7 @@ endef define Image/Manifest $(call opkg,$(TARGET_DIR_ORIG)) list-installed > \ - $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest + $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),$(PROFILE_SANITIZED)).manifest endef define Image/gzip-ext4-padded-squashfs @@ -317,7 +322,7 @@ ifdef CONFIG_TARGET_ROOTFS_TARGZ define Image/Build/targz $(TAR) -cp --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name \ $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \ - -C $(TARGET_DIR)/ . | gzip -9n > $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))-rootfs.tar.gz + -C $(TARGET_DIR)/ . | gzip -9n > $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),$(PROFILE_SANITIZED))-rootfs.tar.gz endef endif @@ -385,7 +390,7 @@ define Device/Init IMAGES := ARTIFACTS := - IMAGE_PREFIX := $(IMG_PREFIX)-$(1) + IMAGE_PREFIX := $(IMG_PREFIX)$(1) IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1)-$$(2) IMAGE_SIZE := KERNEL_PREFIX = $$(IMAGE_PREFIX) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 3432db525a..4bace77db0 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -256,6 +256,7 @@ if VERSIONOPT 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" @@ -264,6 +265,16 @@ if VERSIONOPT Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive file names + + config TARGET_FILENAMES + bool + prompt "Target and subtarget in filenames" + default y + help + Enable this to include the target (and subtarget) in firmware image + filenames. SDK and ImageBuilder archive filenames are not influenced + by this option. + endif
The target/subtarget is included in all image filenames by default. This is useful if the same profile exists in multiple targets or developers/users want an obvious related of images to targets. However this information can also be confusing at it adds a lengthy string to sysupgrade images containing an information which is likely unknown to regular users: The target/subtarget. This commit therefore adds the new image option called CONFIG_TARGET_FILENAMES to make the target/subtarget filename part optional. It is ENABLED by default. To archive this the target/subtarget is added if CONFIG_VERSIONOPT is disabled and CONFIG_TARGET_FILENAMES default to `y`. This keeps the current behaviour for OpenWrt & downstream projects while making the target/subtarget inclusion still optional. Newly produced files would with enabled CONFIG_VERSIONOPT and disabled CONFIG_TARGET_FILENAMES look like the following: * openwrt-linksys_wrt3200acm-initramfs-kernel.bin * openwrt-linksys_wrt3200acm.manifest * openwrt-linksys_wrt3200acm-squashfs-factory.img * openwrt-linksys_wrt3200acm-squashfs-sysupgrade.bin ImageBuilder and SDK archive file names are generated individually and not influenced by the option. Signed-off-by: Paul Spooren <mail@aparcar.org> --- v2: Make it optional and keep everything as it is right now by default. include/image.mk | 13 +++++++++---- package/base-files/image-config.in | 11 +++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-)