treewide: remove implicit SUBTARGET
authorPaul Spooren <mail@aparcar.org>
Mon, 8 Apr 2024 06:05:29 +0000 (08:05 +0200)
committerPaul Spooren <mail@aparcar.org>
Mon, 8 Apr 2024 19:53:05 +0000 (21:53 +0200)
Historically it's possible to leave the `SUBTARGETS` undefined and
automatically fallback to a "generic" subtarget. This however breaks
various downstream scripts which may have expectations around filenames:

While some targets with an explicit generic subtarget contain `generic`
in the filenames of artifacts, implicit "subtargets" don't.

Right now this breaks the CI[1], possibly also scripts using the ImageBuilders.

This commit removes all code that support implicit handling of
subtargets and instead requires every target to define "SUBTARGETS".

[1]: https://github.com/openwrt/openwrt/actions/runs/8592821105/job/23548273630

Signed-off-by: Paul Spooren <mail@aparcar.org>
include/image-commands.mk
include/image.mk
include/kernel.mk
include/version.mk
package/kernel/linux/modules/crypto.mk
target/imagebuilder/Makefile
target/imagebuilder/files/Makefile

index 832c85ee7075ef89d65858c0fac32424c24efc6d..83ecf7c5209f9d4311c5afec89be6ccf71a611a1 100644 (file)
@@ -46,7 +46,7 @@ endef
 
 ifdef IB
 define Build/append-image-stage
-       dd if=$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1) >> $@
+       dd if=$(STAGING_DIR_IMAGE)/$(BOARD)-$(SUBTARGET)-$(DEVICE_NAME)-$(1) >> $@
 endef
 else
 define Build/append-image-stage
@@ -54,7 +54,7 @@ define Build/append-image-stage
        fwtool -s /dev/null -t "$@.stripmeta" || :
        fwtool -i /dev/null -t "$@.stripmeta" || :
        mkdir -p "$(STAGING_DIR_IMAGE)"
-       dd if="$@.stripmeta" of="$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)"
+       dd if="$@.stripmeta" of="$(STAGING_DIR_IMAGE)/$(BOARD)-$(SUBTARGET)-$(DEVICE_NAME)-$(1)"
        dd if="$@.stripmeta" >> "$@"
        rm "$@.stripmeta"
 endef
index 4b6acbe1aad6ac707021d84e78ea1384967fa006..b6b796dd972c1dde9e883b3475eb096b006d0ed5 100644 (file)
@@ -39,7 +39,7 @@ 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)$(BOARD)-$(SUBTARGET)
 IMG_ROOTFS:=$(IMG_PREFIX)-rootfs
 IMG_COMBINED:=$(IMG_PREFIX)-combined
 ifeq ($(DUMP),)
@@ -477,10 +477,10 @@ endef
 ifdef IB
   DEVICE_CHECK_PROFILE = $(filter $(1),DEVICE_$(PROFILE) $(PROFILE))
 else
-  DEVICE_CHECK_PROFILE = $(CONFIG_TARGET_$(if $(CONFIG_TARGET_MULTI_PROFILE),DEVICE_)$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_$(1))
+  DEVICE_CHECK_PROFILE = $(CONFIG_TARGET_$(if $(CONFIG_TARGET_MULTI_PROFILE),DEVICE_)$(call target_conf,$(BOARD)_$(SUBTARGET))_$(1))
 endif
 
-DEVICE_EXTRA_PACKAGES = $(call qstrip,$(CONFIG_TARGET_DEVICE_PACKAGES_$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_DEVICE_$(1)))
+DEVICE_EXTRA_PACKAGES = $(call qstrip,$(CONFIG_TARGET_DEVICE_PACKAGES_$(call target_conf,$(BOARD)_$(SUBTARGET))_DEVICE_$(1)))
 
 define merge_packages
   $(1) :=
@@ -558,7 +558,7 @@ define Device/Build/initramfs
        DEVICE_TITLE="$$(DEVICE_TITLE)" \
        DEVICE_PACKAGES="$$(DEVICE_PACKAGES)" \
        TARGET="$(BOARD)" \
-       SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
+       SUBTARGET="$(SUBTARGET)" \
        VERSION_NUMBER="$(VERSION_NUMBER)" \
        VERSION_CODE="$(VERSION_CODE)" \
        SUPPORTED_DEVICES="$$(SUPPORTED_DEVICES)" \
@@ -692,7 +692,7 @@ define Device/Build/image
        DEVICE_TITLE="$(DEVICE_TITLE)" \
        DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \
        TARGET="$(BOARD)" \
-       SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
+       SUBTARGET="$(SUBTARGET)" \
        VERSION_NUMBER="$(VERSION_NUMBER)" \
        VERSION_CODE="$(VERSION_CODE)" \
        SUPPORTED_DEVICES="$(SUPPORTED_DEVICES)" \
@@ -746,7 +746,7 @@ define Device/Build/artifact
        DEVICE_TITLE="$(DEVICE_TITLE)" \
        DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \
        TARGET="$(BOARD)" \
-       SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
+       SUBTARGET="$(SUBTARGET)" \
        VERSION_NUMBER="$(VERSION_NUMBER)" \
        VERSION_CODE="$(VERSION_CODE)" \
        SUPPORTED_DEVICES="$(SUPPORTED_DEVICES)" \
index 9969c519dda8c3cfc8ed2dc3a96dcce5a568ce05..479c586ea2d8fe9c1ac84896a9d005edceb0df6d 100644 (file)
@@ -43,7 +43,7 @@ else
     PATCH_DIR ?= $(CURDIR)/patches$(if $(wildcard ./patches-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
     FILES_DIR ?= $(foreach dir,$(wildcard $(CURDIR)/files $(CURDIR)/files-$(KERNEL_PATCHVER)),"$(dir)")
   endif
-  KERNEL_BUILD_DIR ?= $(BUILD_DIR)/linux-$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET))
+  KERNEL_BUILD_DIR ?= $(BUILD_DIR)/linux-$(BOARD)_$(SUBTARGET)
   LINUX_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
   LINUX_UAPI_DIR=uapi/
   LINUX_VERMAGIC:=$(strip $(shell cat $(LINUX_DIR)/.vermagic 2>/dev/null))
@@ -204,7 +204,7 @@ define KernelPackage
   $(eval $(call KernelPackage/Defaults))
   $(eval $(call KernelPackage/$(1)))
   $(eval $(call KernelPackage/$(1)/$(BOARD)))
-  $(eval $(call KernelPackage/$(1)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)))
+  $(eval $(call KernelPackage/$(1)/$(BOARD)/$(SUBTARGET)))
 
   define Package/kmod-$(1)
     TITLE:=$(TITLE)
@@ -216,7 +216,7 @@ define KernelPackage
     PKGFLAGS:=$(PKGFLAGS)
     $(call KernelPackage/$(1))
     $(call KernelPackage/$(1)/$(BOARD))
-    $(call KernelPackage/$(1)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic))
+    $(call KernelPackage/$(1)/$(BOARD)/$(SUBTARGET))
   endef
 
   ifdef KernelPackage/$(1)/conffiles
index f39e35cd099a7df15029cd25001dfe1e169b309b..cdee0976dad29fb1f865a3f3f9761e353b58b697 100644 (file)
@@ -95,7 +95,7 @@ VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \
        -e 's,%d,\L$(call sed_escape,$(subst $(space),_,$(VERSION_DIST))),g' \
        -e 's,%R,$(call sed_escape,$(REVISION)),g' \
        -e 's,%T,$(call sed_escape,$(BOARD)),g' \
-       -e 's,%S,$(call sed_escape,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)),g' \
+       -e 's,%S,$(call sed_escape,$(BOARD)/$(SUBTARGET)),g' \
        -e 's,%A,$(call sed_escape,$(ARCH_PACKAGES)),g' \
        -e 's,%t,$(call sed_escape,$(VERSION_TAINTS)),g' \
        -e 's,%M,$(call sed_escape,$(VERSION_MANUFACTURER)),g' \
index be9893d453967540310fb98856538e58d30714df..4a8a283d3773217711697beb29b2cd9e19e3d0bf 100644 (file)
@@ -11,7 +11,7 @@ CRYPTO_MODULES = \
        ALGAPI2=crypto_algapi \
        BLKCIPHER2=crypto_blkcipher
 
-CRYPTO_TARGET = $(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)
+CRYPTO_TARGET = $(BOARD)/$(SUBTARGET)
 
 crypto_confvar=CONFIG_CRYPTO_$(word 1,$(subst =,$(space),$(1)))
 crypto_file=$(LINUX_DIR)/crypto/$(word 2,$(subst =,$(space),$(1))).ko
index 799ac3be550c2e85215d71e6150c38cfe66e5eb3..c768c992eafad7b3d99f62a5d55c75a99d31e792 100644 (file)
@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/feeds.mk
 
 override MAKEFLAGS=
 
-IB_NAME:=$(VERSION_DIST_SANITIZED)-imagebuilder-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)).$(HOST_OS)-$(HOST_ARCH)
+IB_NAME:=$(VERSION_DIST_SANITIZED)-imagebuilder-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)-$(SUBTARGET).$(HOST_OS)-$(HOST_ARCH)
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(IB_NAME)
 IB_KDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(KERNEL_BUILD_DIR))
 IB_LDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(LINUX_DIR))
index 0466fc7dcc32687500c57818ecb37f7bd7529748..78a75e96a8ffad92fd721863f9f99f170d33fc69 100644 (file)
@@ -103,7 +103,7 @@ PROFILE_LIST = $(foreach p,$(PROFILE_NAMES), \
 
 
 .profiles.mk: .targetinfo
-       @$(SCRIPT_DIR)/target-metadata.pl profile_mk $< '$(BOARD)$(if $(SUBTARGET),/$(SUBTARGET))' > $@
+       @$(SCRIPT_DIR)/target-metadata.pl profile_mk $< '$(BOARD)/$(SUBTARGET)' > $@
 
 staging_dir/host/.prereq-build: include/prereq-build.mk
        mkdir -p tmp