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.

Upstream-Status: Submitted [https://github.com/openwrt/openwrt/pull/18820]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Christian Marangi
2025-04-26 15:58:05 +02:00
committed by Hela Saadani
parent b911cc619f
commit e4635d24b2

View File

@@ -139,7 +139,7 @@ ifeq ($(TARGET_BUILD),1)
endif
endif
GENERIC_PLATFORM_DIR := $(TOPDIR)/target/linux/generic
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