patches: add external target directory support (0007)

Introduces default location for external target directories, allowing custom targets to be maintained outside the main tree.

New patch for 24.10.

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2025-10-19 00:00:00 +02:00
parent 58bdced835
commit 09f4938435

View File

@@ -0,0 +1,59 @@
From 3fb8c7bc36d959e9705c8651ca5ee41d6e53a19a Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Sat, 26 Apr 2025 15:58:05 +0200
Subject: [PATCH 07/55] target: introduce default location for external target
linux generic
An external target provided by a custom feed might depend on a specific
kernel version and might need to apply generic patches for the specific
kernel version.
Now that the kernel version file is defined in the generic target
director, it's possible to handle this scenario for an external target
from feed.
To do this, we introduce additional logic for GENERIC_PLATFORM_DIR where
we check if the target feed have in his upper directory a linux/generic
path and use that instead of the default TOPLEVEL linux/generic path.
An example for an external target from feed would have the following
path structure:
mediatek/Makefile
linux/generic
linux/generic/config-6.6
...
An external target from feed is also defined by creating a symbolic link
in target/linux/${BOARD} to the feed directory with board as the name of
the external target.
This is to try to enforce a more consistent way to handle external
target in downstream project that makes use of OpenWrt build system.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
include/target.mk | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/target.mk b/include/target.mk
index e5f45714bf..efaf8cb0bd 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -167,11 +167,12 @@ ifeq ($(TARGET_BUILD),1)
endif
endif
+GENERIC_PLATFORM_DIR := $(firstword $(wildcard $(TOPDIR)/target/linux/feeds/$(BOARD)/../linux/generic $(TOPDIR)/target/linux/generic))
+
ifneq ($(TARGET_BUILD)$(if $(DUMP),,1),)
include $(INCLUDE_DIR)/kernel-version.mk
endif
-GENERIC_PLATFORM_DIR := $(TOPDIR)/target/linux/generic
GENERIC_BACKPORT_DIR := $(GENERIC_PLATFORM_DIR)/backport$(if $(wildcard $(GENERIC_PLATFORM_DIR)/backport-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/pending$(if $(wildcard $(GENERIC_PLATFORM_DIR)/pending-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
GENERIC_HACK_DIR := $(GENERIC_PLATFORM_DIR)/hack$(if $(wildcard $(GENERIC_PLATFORM_DIR)/hack-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
--
2.34.1