From 6258a11bacdb5840b40a7a35e7f60b8d68a6eaab Mon Sep 17 00:00:00 2001 From: John Crispin Date: Fri, 18 Sep 2026 20:51:33 +0200 Subject: [PATCH] image: only define the rules of selected devices A target defines more than 100 devices, and the image Makefile expands the kernel, image and artifact rules of every one of them. The rules of a device that is not selected are only reachable through install-disabled and compile-disabled, so nothing uses them. The image Makefile is parsed twice per build, 0.3 s each for mediatek. Only expand Device/Build for selected devices, and for all devices if CONFIG_IB is set, as the ImageBuilder compiles them all. Signed-off-by: John Crispin --- include/image.mk | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/image.mk b/include/image.mk index 3f5268efacc..f65a835a1a6 100644 --- a/include/image.mk +++ b/include/image.mk @@ -966,10 +966,19 @@ define Device $(call Device/Default,$(1)) $(call Device/$(1),$(1)) $(call Device/Check,$(1)) - $(call Device/$(if $(DUMP),Dump,Build),$(1)) + $(if $(DUMP),$(call Device/Dump,$(1)),$(call Device/BuildSelected,$(1))) endef +# The rules of a device that is not selected can not be reached, and a +# target defines more than 100 devices, so do not define them. The whole +# image Makefile is parsed twice per build. +define Device/BuildSelected + ifneq ($(CONFIG_IB)$$(_PROFILE_SET),) +$(call Device/Build,$(1)) + endif +endef + define BuildImage ifneq ($(DUMP),)