* [Buildroot] [PATCH v2 01/23] package: prepare removal of <pkg>_DIR
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 02/23] infra: introduce a global SRC_DIR variable Florian Fainelli via buildroot
` (21 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Eric Le Bihan, Jérôme Pouiller,
Florian Fainelli, Gary Bisson, Romain Naour, Bernd Kuhls,
Thomas Perale, Maxime Chevallier, Refik Tuzakli, Francois Perrad,
Thomas Petazzoni, Arnout Vandecappelle, Petr Vorel,
Spenser Gilliland, Giulio Benetti, Pascal de Bruijn,
Luca Ceresoli, Yann E. MORIN, Mahyar Koshkouei
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
As part of the out-of-tree mechanism introduction, we want to get rid
of the <pkg>_DIR variable, because it isn't clear whether it refers to
the source or build directory.
Therefore, we modify the package infrastructure to no longer use
<pkg>_DIR, but instead use <pkg>_SRCDIR or <pkg>_BUILDDIR where
appropriate.
Since some of the build steps now have their stamp files in the package
source directory, we also adjust the corresponding make rules.
There is one single stamp we take special care of: the dirclean one.
This stamp file is never created; it only serves to have a correct $(@D)
to be able to remove the package directory. What is really important in
fact is to remove the build directory, so that's where we move it into.
Note that at this point, $(BUILD_DIR) and $(SRC_DIR) still point to the
same directory, so this commit is really a no-op.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[yann.morin.1998@free.fr:
- rebase on master
- change the location of the dirclean stamp
- expand commit log accordingly
]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
(cherry picked from commit a1048c500d134df5ba3d92be463e190ce7768274)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/pkg-generic.mk | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 4e2ce2e7a09a..fe5200475504 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -171,7 +171,7 @@ endef
################################################################################
# Retrieve the archive
-$(BUILD_DIR)/%/.stamp_downloaded:
+$(SRC_DIR)/%/.stamp_downloaded:
@$(call step_start,download)
$(call prepare-per-package-directory,$($(PKG)_FINAL_DOWNLOAD_DEPENDENCIES))
$(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
@@ -196,7 +196,7 @@ $(BUILD_DIR)/%/.stamp_downloaded:
$(Q)touch $@
# Retrieve actual source archive, e.g. for prebuilt external toolchains
-$(BUILD_DIR)/%/.stamp_actual_downloaded:
+$(SRC_DIR)/%/.stamp_actual_downloaded:
@$(call step_start,actual-download)
$(call DOWNLOAD,$($(PKG)_ACTUAL_SOURCE_SITE)/$($(PKG)_ACTUAL_SOURCE_TARBALL))
$(Q)mkdir -p $(@D)
@@ -204,7 +204,7 @@ $(BUILD_DIR)/%/.stamp_actual_downloaded:
$(Q)touch $@
# Unpack the archive
-$(BUILD_DIR)/%/.stamp_extracted:
+$(SRC_DIR)/%/.stamp_extracted:
@$(call step_start,extract)
@$(call MESSAGE,"Extracting")
$(call prepare-per-package-directory,$($(PKG)_FINAL_EXTRACT_DEPENDENCIES))
@@ -219,7 +219,7 @@ $(BUILD_DIR)/%/.stamp_extracted:
# Rsync the source directory if the <pkg>_OVERRIDE_SRCDIR feature is
# used.
-$(BUILD_DIR)/%/.stamp_rsynced:
+$(SRC_DIR)/%/.stamp_rsynced:
@$(call step_start,rsync)
@$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
@mkdir -p $(@D)
@@ -231,7 +231,7 @@ $(BUILD_DIR)/%/.stamp_rsynced:
$(Q)touch $@
# Patch
-$(BUILD_DIR)/%/.stamp_patched:
+$(SRC_DIR)/%/.stamp_patched:
@$(call step_start,patch)
@$(call MESSAGE,"Patching")
$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
@@ -836,19 +836,19 @@ $(2)_FINAL_RECURSIVE_RDEPENDENCIES = $$(sort \
$$($(2)_FINAL_RECURSIVE_RDEPENDENCIES__X))
# define sub-target stamps
-$(2)_TARGET_INSTALL = $$($(2)_DIR)/.stamp_installed
-$(2)_TARGET_INSTALL_TARGET = $$($(2)_DIR)/.stamp_target_installed
-$(2)_TARGET_INSTALL_STAGING = $$($(2)_DIR)/.stamp_staging_installed
-$(2)_TARGET_INSTALL_IMAGES = $$($(2)_DIR)/.stamp_images_installed
-$(2)_TARGET_INSTALL_HOST = $$($(2)_DIR)/.stamp_host_installed
-$(2)_TARGET_BUILD = $$($(2)_DIR)/.stamp_built
-$(2)_TARGET_CONFIGURE = $$($(2)_DIR)/.stamp_configured
-$(2)_TARGET_RSYNC = $$($(2)_DIR)/.stamp_rsynced
-$(2)_TARGET_PATCH = $$($(2)_DIR)/.stamp_patched
-$(2)_TARGET_EXTRACT = $$($(2)_DIR)/.stamp_extracted
-$(2)_TARGET_SOURCE = $$($(2)_DIR)/.stamp_downloaded
-$(2)_TARGET_ACTUAL_SOURCE = $$($(2)_DIR)/.stamp_actual_downloaded
-$(2)_TARGET_DIRCLEAN = $$($(2)_DIR)/.stamp_dircleaned
+$(2)_TARGET_INSTALL = $$($(2)_BUILDDIR)/.stamp_installed
+$(2)_TARGET_INSTALL_TARGET = $$($(2)_BUILDDIR)/.stamp_target_installed
+$(2)_TARGET_INSTALL_STAGING = $$($(2)_BUILDDIR)/.stamp_staging_installed
+$(2)_TARGET_INSTALL_IMAGES = $$($(2)_BUILDDIR)/.stamp_images_installed
+$(2)_TARGET_INSTALL_HOST = $$($(2)_BUILDDIR)/.stamp_host_installed
+$(2)_TARGET_BUILD = $$($(2)_BUILDDIR)/.stamp_built
+$(2)_TARGET_CONFIGURE = $$($(2)_BUILDDIR)/.stamp_configured
+$(2)_TARGET_RSYNC = $$($(2)_SRCDIR)/.stamp_rsynced
+$(2)_TARGET_PATCH = $$($(2)_SRCDIR)/.stamp_patched
+$(2)_TARGET_EXTRACT = $$($(2)_SRCDIR)/.stamp_extracted
+$(2)_TARGET_SOURCE = $$($(2)_SRCDIR)/.stamp_downloaded
+$(2)_TARGET_ACTUAL_SOURCE = $$($(2)_SRCDIR)/.stamp_actual_downloaded
+$(2)_TARGET_DIRCLEAN = $$($(2)_BUILDDIR)/.stamp_dircleaned
# default extract command
$(2)_EXTRACT_CMDS ?= \
@@ -1176,7 +1176,7 @@ else
$$$${f} \
$$($(2)_REDIST_SOURCES_DIR) || exit 1; \
printf "%s\n" "$$$${f##*/}" >>$$($(2)_REDIST_SOURCES_DIR)/series || exit 1; \
- done <$$($(2)_DIR)/.applied_patches_list
+ done <$$($(2)_SRCDIR)/.applied_patches_list
endif # other packages
endif # redistribute
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 02/23] infra: introduce a global SRC_DIR variable
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 01/23] package: prepare removal of <pkg>_DIR Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 03/23] package: fix <pkg>_SRCDIR and <pkg>_BUILDDIR values Florian Fainelli via buildroot
` (20 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Eric Le Bihan, Jérôme Pouiller,
Florian Fainelli, Gary Bisson, Romain Naour, Bernd Kuhls,
Thomas Perale, Maxime Chevallier, Refik Tuzakli, Francois Perrad,
Thomas Petazzoni, Arnout Vandecappelle, Petr Vorel,
Spenser Gilliland, Giulio Benetti, Pascal de Bruijn,
Luca Ceresoli, Yann E. MORIN, Mahyar Koshkouei
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit introduces the global SRC_DIR variable, to point to a
directory where we will want to extract the packages sources into.
For now, it points to the same directory as BUILD_DIR, since we
don't yet support out-of-tree build of packages.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[yann.morin.1998@free.fr:
- rebase on master
- slightly expand commit log
]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
(cherry picked from commit 3471f1620f8d78c5533d16d1c6d73b58e3e69962)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index 9b62da3e4065..c1f12a4bfc38 100644
--- a/Makefile
+++ b/Makefile
@@ -211,6 +211,7 @@ endif
# Avoids doing the $(or...) everytime
BR_GRAPH_OUT := $(or $(BR2_GRAPH_OUT),pdf)
+SRC_DIR := $(BASE_DIR)/build
BUILD_DIR := $(BASE_DIR)/build
BINARIES_DIR := $(BASE_DIR)/images
BASE_TARGET_DIR := $(BASE_DIR)/target
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 03/23] package: fix <pkg>_SRCDIR and <pkg>_BUILDDIR values
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 01/23] package: prepare removal of <pkg>_DIR Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 02/23] infra: introduce a global SRC_DIR variable Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 04/23] boot/boot-wrapper-aarch64: needs LINUX_BUILDDIR Florian Fainelli via buildroot
` (19 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Eric Le Bihan, Jérôme Pouiller,
Florian Fainelli, Gary Bisson, Romain Naour, Bernd Kuhls,
Thomas Perale, Maxime Chevallier, Refik Tuzakli, Francois Perrad,
Thomas Petazzoni, Arnout Vandecappelle, Petr Vorel,
Spenser Gilliland, Giulio Benetti, Pascal de Bruijn,
Luca Ceresoli, Yann E. MORIN, Mahyar Koshkouei
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
Until now, <pkg>_SRCDIR and <pkg>_BUILDDIR were taking into account the
potential <pkg>_SUBDIR, which indicates that the configure script is not
at the root of the source directory, but in some subdirectory.
However, in preparation for the out-of-tree build of packages, we want
to get rid of the <pkg>_DIR definition (because <pkg>_DIR doesn't
explicit whether it's the source or build directory), so we want
<pkg>_SRCDIR and <pkg>_BUILDDIR to become the real locations of the
source and build directories, respectively. To do so, they no longer
take into account <pkg>_SUBDIR.
Instead, a separate <pkg>_SRCSUBDIR variable has been introduced, which
points to the sub-directory in which the configure script (or
CMakeLists.txt file) is.
The autotools infrastructure is fixed to used <pkg>_SRCSUBDIR instead of
PKG_SRCDIR.
The cmake infrastructure is fixed to use <pkg>_SRCSUBDIR everywhere,
even in places where it was using <pkg>_BUILDDIR. The reason is that
now, <pkg>_BUILDDIR doesn't take into account the <pkg>_SUBDIR. Of
course, later patches will fix the CMake infrastructure back to use a
separate build directory.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[yann.morin.1998@free.fr:
- rebase on master
- cmake already has its own BUILDDIR now
- also convert the extract commands
- also move the filelist step-hooks
- convert pkg-kconfig and pkg-luarocks
]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
(cherry picked from commit 49b7c84d4a23fd562c0e054acea4e8ebdbd8cb41)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/pkg-autotools.mk | 20 +++++++++---------
package/pkg-cmake.mk | 8 ++++----
package/pkg-generic.mk | 9 ++++----
package/pkg-kconfig.mk | 44 ++++++++++++++++++++--------------------
package/pkg-luarocks.mk | 6 +++---
5 files changed, 44 insertions(+), 43 deletions(-)
diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
index bb65d639dff1..58b63317cb60 100644
--- a/package/pkg-autotools.mk
+++ b/package/pkg-autotools.mk
@@ -59,7 +59,7 @@ endef
#
define LIBTOOL_PATCH_HOOK
@$(call MESSAGE,"Patching libtool")
- $(Q)for i in `find $($(PKG)_DIR) -name ltmain.sh`; do \
+ $(Q)for i in `find $($(PKG)_SRCSUBDIR) -name ltmain.sh`; do \
ltmain_version=`sed -n '/^[ \t]*VERSION=/{s/^[ \t]*VERSION=//;p;q;}' $$i | \
sed -e 's/\([0-9]*\.[0-9]*\).*/\1/' -e 's/\"//'`; \
ltmain_patchlevel=`sed -n '/^[ \t]*VERSION=/{s/^[ \t]*VERSION=//;p;q;}' $$i | \
@@ -92,7 +92,7 @@ endef
#
define CONFIGURE_FIX_POWERPC64_HOOK
@$(call MESSAGE,"Checking configure (powerpc64/powerpc64le)")
- support/scripts/fix-configure-powerpc64.sh $($(PKG)_DIR)
+ support/scripts/fix-configure-powerpc64.sh $($(PKG)_SRCSUBDIR)
endef
#
@@ -100,7 +100,7 @@ endef
#
define AUTORECONF_HOOK
@$(call MESSAGE,"Autoreconfiguring")
- $(Q)cd $($(PKG)_SRCDIR) && $($(PKG)_AUTORECONF_ENV) $(AUTORECONF) $($(PKG)_AUTORECONF_OPTS)
+ $(Q)cd $($(PKG)_SRCSUBDIR) && $($(PKG)_AUTORECONF_ENV) $(AUTORECONF) $($(PKG)_AUTORECONF_OPTS)
endef
################################################################################
@@ -171,7 +171,7 @@ ifeq ($(4),target)
# Configure package for target
define $(2)_CONFIGURE_CMDS
- (cd $$($$(PKG)_SRCDIR) && rm -rf config.cache && \
+ (cd $$($$(PKG)_SRCSUBDIR) && rm -rf config.cache && \
$$(TARGET_CONFIGURE_OPTS) \
$$(TARGET_CONFIGURE_ARGS) \
$$($$(PKG)_CONF_ENV) \
@@ -206,7 +206,7 @@ else
# because it often relies on host tools which may or may not be
# installed.
define $(2)_CONFIGURE_CMDS
- (cd $$($$(PKG)_SRCDIR) && rm -rf config.cache; \
+ (cd $$($$(PKG)_SRCSUBDIR) && rm -rf config.cache; \
$$(HOST_CONFIGURE_OPTS) \
$$($$(PKG)_CONF_ENV) \
CONFIG_SITE=/dev/null \
@@ -272,11 +272,11 @@ endif
ifndef $(2)_BUILD_CMDS
ifeq ($(4),target)
define $(2)_BUILD_CMDS
- $$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) -C $$($$(PKG)_SRCDIR)
+ $$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) -C $$($$(PKG)_SRCSUBDIR)
endef
else
define $(2)_BUILD_CMDS
- $$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) -C $$($$(PKG)_SRCDIR)
+ $$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) -C $$($$(PKG)_SRCSUBDIR)
endef
endif
endif
@@ -287,7 +287,7 @@ endif
#
ifndef $(2)_INSTALL_CMDS
define $(2)_INSTALL_CMDS
- $$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_OPTS) -C $$($$(PKG)_SRCDIR)
+ $$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_OPTS) -C $$($$(PKG)_SRCSUBDIR)
endef
endif
@@ -297,7 +297,7 @@ endif
#
ifndef $(2)_INSTALL_STAGING_CMDS
define $(2)_INSTALL_STAGING_CMDS
- $$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_STAGING_OPTS) -C $$($$(PKG)_SRCDIR)
+ $$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_STAGING_OPTS) -C $$($$(PKG)_SRCSUBDIR)
endef
endif
@@ -307,7 +307,7 @@ endif
#
ifndef $(2)_INSTALL_TARGET_CMDS
define $(2)_INSTALL_TARGET_CMDS
- $$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_TARGET_OPTS) -C $$($$(PKG)_SRCDIR)
+ $$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_TARGET_OPTS) -C $$($$(PKG)_SRCSUBDIR)
endef
endif
diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index f572bdebb3da..d0dcdfbd50fd 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -57,9 +57,9 @@ $(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES
$(3)_CMAKE_BACKEND ?= make
ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),YES)
-$(2)_BUILDDIR = $$($(2)_SRCDIR)
+$(2)_BUILDDIR = $$($(2)_SRCSUBDIR)
else
-$(2)_BUILDDIR = $$($(2)_SRCDIR)/buildroot-build
+$(2)_BUILDDIR = $$($(2)_SRCSUBDIR)/buildroot-build
endif
ifeq ($$($(3)_CMAKE_BACKEND),make)
@@ -103,7 +103,7 @@ define $(2)_CONFIGURE_CMDS
rm -f CMakeCache.txt && \
PATH=$$(BR_PATH) \
$$(if $$(BR2_INSTALL_LIBSTDCPP),,CXX=/bin/false) \
- $$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
+ $$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCSUBDIR) \
-G$$($$(PKG)_GENERATOR) \
-DCMAKE_MAKE_PROGRAM="$$($$(PKG)_GENERATOR_PROGRAM)" \
-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/share/buildroot/toolchainfile.cmake" \
@@ -135,7 +135,7 @@ define $(2)_CONFIGURE_CMDS
PKG_CONFIG_LIBDIR="$$(HOST_DIR)/lib/pkgconfig:$$(HOST_DIR)/share/pkgconfig" \
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
- $$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
+ $$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCSUBDIR) \
-G$$($$(PKG)_GENERATOR) \
-DCMAKE_MAKE_PROGRAM="$$($$(PKG)_GENERATOR_PROGRAM)" \
-DCMAKE_INSTALL_SO_NO_EXE=0 \
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index fe5200475504..138fe9ccef4f 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -558,8 +558,9 @@ ifndef $(2)_STRIP_COMPONENTS
endif
endif
-$(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR)
-$(2)_BUILDDIR ?= $$($(2)_SRCDIR)
+$(2)_SRCDIR = $$($(2)_DIR)
+$(2)_BUILDDIR = $$($(2)_DIR)
+$(2)_SRCSUBDIR = $$($(2)_SRCDIR)/$$($(2)_SUBDIR)
ifneq ($$($(2)_OVERRIDE_SRCDIR),)
$(2)_VERSION = custom
@@ -854,7 +855,7 @@ $(2)_TARGET_DIRCLEAN = $$($(2)_BUILDDIR)/.stamp_dircleaned
$(2)_EXTRACT_CMDS ?= \
$$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $$($(2)_DL_DIR)/$$($(2)_SOURCE) | \
$$(TAR) --strip-components=$$($(2)_STRIP_COMPONENTS) \
- -C $$($(2)_DIR) \
+ -C $$($(2)_SRCDIR) \
$$(foreach x,$$($(2)_EXCLUDES),--exclude='$$(x)' ) \
$$(TAR_OPTIONS) -)
@@ -1141,7 +1142,7 @@ ifneq ($$(call qstrip,$$($(2)_SOURCE)),)
ifeq ($$(call qstrip,$$($(2)_LICENSE_FILES)),)
$(Q)$$(call legal-warning-pkg,$$($(2)_BASENAME_RAW),cannot save license ($(2)_LICENSE_FILES not defined))
else
- $(Q)$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$(call UPPERCASE,$(4)),$$($(2)_RAWNAME),$$($(2)_BASENAME_RAW),$$(F),$$($(2)_DIR)/$$(F),$$($(2)_HASH_FILES))$$(sep))
+ $(Q)$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$(call UPPERCASE,$(4)),$$($(2)_RAWNAME),$$($(2)_BASENAME_RAW),$$(F),$$($(2)_SRCDIR)/$$(F),$$($(2)_HASH_FILES))$$(sep))
endif # license files
ifeq ($$($(2)_REDISTRIBUTE),YES)
diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk
index 8000de16c49e..8a63d55be033 100644
--- a/package/pkg-kconfig.mk
+++ b/package/pkg-kconfig.mk
@@ -23,8 +23,8 @@ define kconfig-package-update-config
exit 1; \
fi
$(Q)mkdir -p $(dir $($(PKG)_KCONFIG_FILE))
- cp -f $($(PKG)_DIR)/$(1) $($(PKG)_KCONFIG_FILE)
- $(Q)touch --reference $($(PKG)_DIR)/$($(PKG)_KCONFIG_STAMP_DOTCONFIG) $($(PKG)_KCONFIG_FILE)
+ cp -f $($(PKG)_BUILDDIR)/$(1) $($(PKG)_KCONFIG_FILE)
+ $(Q)touch --reference $($(PKG)_BUILDDIR)/$($(PKG)_KCONFIG_STAMP_DOTCONFIG) $($(PKG)_KCONFIG_FILE)
endef
PKG_KCONFIG_COMMON_OPTS = \
@@ -117,8 +117,8 @@ endif
# Call the generic package infrastructure to generate the necessary
# make targets.
-# Note: this must be done _before_ attempting to use $$($(2)_DIR) in a
-# dependency expression
+# Note: this must be done _before_ attempting to use either $$($(2)_SRCDIR)
+# or $$($(2)_BUILDDIR) in a dependency expression
$(call inner-generic-package,$(1),$(2),$(3),$(4))
# Do not use $(2)_KCONFIG_DOTCONFIG as stamp file, because the package
@@ -148,23 +148,23 @@ $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES): | $(1)-patch
done
$(2)_KCONFIG_MAKE = \
- $$($(2)_MAKE_ENV) $$($(2)_MAKE) -C $$($(2)_DIR) \
+ $$($(2)_MAKE_ENV) $$($(2)_MAKE) -C $$($(2)_BUILDDIR) \
$$(PKG_KCONFIG_COMMON_OPTS) $$($(2)_KCONFIG_OPTS)
# The specified source configuration file and any additional configuration file
# fragments are merged together to .config, after the package has been patched.
# Since the file could be a defconfig file it needs to be expanded to a
# full .config first.
-$$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
+$$($(2)_BUILDDIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
$$(call prepare-per-package-directory,$$($(2)_KCONFIG_DEPENDENCIES))
$$(call kconfig-package-merge-config,$(2),$$(@D)/$$($(2)_KCONFIG_DOTCONFIG),\
$$($(2)_KCONFIG_FRAGMENT_FILES))
- $$(Q)touch $$(@D)/$$($(2)_KCONFIG_STAMP_DOTCONFIG)
+ $$(Q)touch $$($(2)_BUILDDIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG)
# If _KCONFIG_FILE or _KCONFIG_FRAGMENT_FILES exists, this dependency is
# already implied, but if we only have a _KCONFIG_DEFCONFIG we have to add
# it explicitly. It doesn't hurt to always have it though.
-$$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG): | $(1)-patch
+$$($(2)_BUILDDIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG): | $(1)-patch
# Some packages may need additional tools to be present by the time their
# kconfig structure is parsed (e.g. the linux kernel may need to call to
@@ -176,21 +176,21 @@ $$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG): | $$($(2)_KCONFIG_DEPENDENCIES)
define $(2)_FIXUP_DOT_CONFIG
$$($(2)_KCONFIG_FIXUP_CMDS)
$$(call kconfig-package-regen-dot-config,$(2))
- $$(Q)touch $$($(2)_DIR)/.stamp_kconfig_fixup_done
+ $$(Q)touch $$($(2)_BUILDDIR)/.stamp_kconfig_fixup_done
endef
-$$($(2)_DIR)/.stamp_kconfig_fixup_done: PKG=$(2)
-$$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG)
+$$($(2)_BUILDDIR)/.stamp_kconfig_fixup_done: PKG=$(2)
+$$($(2)_BUILDDIR)/.stamp_kconfig_fixup_done: $$($(2)_BUILDDIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG)
$$($(2)_FIXUP_DOT_CONFIG)
# Before running configure, the configuration file should be present and fixed
-$$($(2)_TARGET_CONFIGURE): $$($(2)_DIR)/.stamp_kconfig_fixup_done
+$$($(2)_TARGET_CONFIGURE): $$($(2)_BUILDDIR)/.stamp_kconfig_fixup_done
# Force olddefconfig again on -reconfigure
$(1)-clean-for-reconfigure: $(1)-clean-kconfig-for-reconfigure
$(1)-clean-kconfig-for-reconfigure:
- rm -f $$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG)
+ rm -f $$($(2)_BUILDDIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG)
# Only enable the foo-*config targets when the package is actually enabled.
# Note: the variable $(2)_KCONFIG_VAR is not related to the kconfig
@@ -236,18 +236,18 @@ $(2)_CONFIGURATOR_MAKE_ENV = \
# with a stamp-like file which path is in the package build dir, so we
# end up having a valid @D.
#
-$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $(1)-%: $$($(2)_DIR)/.kconfig_editor_%
-$$($(2)_DIR)/.kconfig_editor_%: PKG=$(2)
-$$($(2)_DIR)/.kconfig_editor_%: $$($(2)_DIR)/.stamp_kconfig_fixup_done
- $$($(2)_CONFIGURATOR_MAKE_ENV) $$($(2)_MAKE) -C $$($(2)_DIR) \
+$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $(1)-%: $$($(2)_BUILDDIR)/.kconfig_editor_%
+$$($(2)_BUILDDIR)/.kconfig_editor_%: PKG=$(2)
+$$($(2)_BUILDDIR)/.kconfig_editor_%: $$($(2)_BUILDDIR)/.stamp_kconfig_fixup_done
+ $$($(2)_CONFIGURATOR_MAKE_ENV) $$($(2)_MAKE) -C $$($(2)_BUILDDIR) \
$$(PKG_KCONFIG_COMMON_OPTS) $$($(2)_KCONFIG_OPTS) $$(*)
- rm -f $$($(2)_DIR)/.stamp_{kconfig_fixup_done,configured,built}
- rm -f $$($(2)_DIR)/.stamp_{target,staging,images}_installed
+ rm -f $$($(2)_BUILDDIR)/.stamp_{kconfig_fixup_done,configured,built}
+ rm -f $$($(2)_BUILDDIR)/.stamp_{target,staging,images}_installed
$$($(2)_FIXUP_DOT_CONFIG)
# Saving back the configuration
#
-# Ideally, that should directly depend on $$($(2)_DIR)/.stamp_kconfig_fixup_done,
+# Ideally, that should directly depend on $$($(2)_BUILDDIR)/.stamp_kconfig_fixup_done,
# but that breaks the use-case in PR-8156 (from a clean tree):
# make menuconfig <- enable kernel, use an in-tree defconfig, save and exit
# make linux-menuconfig <- enable/disable whatever option, save and exit
@@ -262,7 +262,7 @@ $$($(2)_DIR)/.kconfig_editor_%: $$($(2)_DIR)/.stamp_kconfig_fixup_done
# Instead, we use a PHONY rule that will catch that situation.
#
$(1)-check-configuration-done:
- @if [ ! -f $$($(2)_DIR)/.stamp_kconfig_fixup_done ]; then \
+ @if [ ! -f $$($(2)_BUILDDIR)/.stamp_kconfig_fixup_done ]; then \
echo "$(1) is not yet configured"; \
exit 1; \
fi
@@ -316,7 +316,7 @@ endif # package enabled
.PHONY: \
$(1)-diff-config \
$(1)-check-configuration-done \
- $$($(2)_DIR)/.kconfig_editor_% \
+ $$($(2)_BUILDDIR)/.kconfig_editor_% \
$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS))
endef # inner-kconfig-package
diff --git a/package/pkg-luarocks.mk b/package/pkg-luarocks.mk
index fd798558785c..abcd525fcf8a 100644
--- a/package/pkg-luarocks.mk
+++ b/package/pkg-luarocks.mk
@@ -96,10 +96,10 @@ $(2)_EXTRACT_DEPENDENCIES += host-luarocks
#
ifndef $(2)_EXTRACT_CMDS
define $(2)_EXTRACT_CMDS
- mkdir -p $$($(2)_DIR)/luarocks-extract
- cd $$($(2)_DIR)/luarocks-extract && \
+ mkdir -p $$($(2)_SRCDIR)/luarocks-extract
+ cd $$($(2)_SRCDIR)/luarocks-extract && \
$$(LUAROCKS_RUN_CMD) unpack --force $$($(2)_DL_DIR)/$$($(2)_SOURCE)
- mv $$($(2)_DIR)/luarocks-extract/*/* $$($(2)_DIR)
+ mv $$($(2)_SRCDIR)/luarocks-extract/*/* $$($(2)_SRCDIR)
endef
endif
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 04/23] boot/boot-wrapper-aarch64: needs LINUX_BUILDDIR
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (2 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 03/23] package: fix <pkg>_SRCDIR and <pkg>_BUILDDIR values Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 05/23] boot/mxs-bootlets: needs (BAREBOX, LINUX, UBOOT)_BUILDDIR Florian Fainelli via buildroot
` (18 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Eric Le Bihan, Jérôme Pouiller,
Florian Fainelli, Gary Bisson, Romain Naour, Bernd Kuhls,
Thomas Perale, Maxime Chevallier, Refik Tuzakli, Francois Perrad,
Thomas Petazzoni, Arnout Vandecappelle, Petr Vorel,
Spenser Gilliland, Giulio Benetti, Pascal de Bruijn,
Luca Ceresoli, Yann E. MORIN, Mahyar Koshkouei
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
In preparation for the split between the source and build directories,
make boot-wrapper-aarch64 look in the correct location.
boot-wrapper-aarch64 needs access to the kerenl build directory:
$ ./configure --help
--with-kernel-dir specify the root Linux kernel build directory
Make it so.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
(cherry picked from commit f22ee04de55cf7a41368a7be905b15df240aa8ad)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk b/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk
index 75be23f24333..f9f8e3cf49d1 100644
--- a/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk
+++ b/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk
@@ -19,7 +19,7 @@ BOOT_WRAPPER_AARCH64_AUTORECONF = YES
BOOT_WRAPPER_AARCH64_DTB = $(LINUX_DIR)/arch/arm64/boot/dts/$(basename $(call qstrip,$(BR2_TARGET_BOOT_WRAPPER_AARCH64_DTS))).dtb
BOOT_WRAPPER_AARCH64_CONF_OPTS = \
- --with-kernel-dir=$(LINUX_DIR) \
+ --with-kernel-dir=$(LINUX_BUILDDIR) \
--with-dtb=$(BOOT_WRAPPER_AARCH64_DTB) \
--with-cmdline=$(BR2_TARGET_BOOT_WRAPPER_AARCH64_BOOTARGS)
@@ -39,9 +39,9 @@ endif
# AC_CHECK_FILE tests, which are always disabled in cross-compilation
# situations.
BOOT_WRAPPER_AARCH64_CONF_ENV = \
- $(call AUTOCONF_AC_CHECK_FILE_VAL,$(LINUX_DIR))=yes \
- $(call AUTOCONF_AC_CHECK_FILE_VAL,$(LINUX_DIR)$(BOOT_WRAPPER_AARCH64_DTB))=yes \
- $(call AUTOCONF_AC_CHECK_FILE_VAL,$(LINUX_DIR)/arch/arm64/boot/Image)=yes
+ $(call AUTOCONF_AC_CHECK_FILE_VAL,$(LINUX_BUILDDIR))=yes \
+ $(call AUTOCONF_AC_CHECK_FILE_VAL,$(LINUX_BUILDDIR)$(BOOT_WRAPPER_AARCH64_DTB))=yes \
+ $(call AUTOCONF_AC_CHECK_FILE_VAL,$(LINUX_BUILDDIR)/arch/arm64/boot/Image)=yes
define BOOT_WRAPPER_AARCH64_INSTALL_IMAGES_CMDS
cp $(@D)/linux-system.axf $(BINARIES_DIR)
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 05/23] boot/mxs-bootlets: needs (BAREBOX, LINUX, UBOOT)_BUILDDIR
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (3 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 04/23] boot/boot-wrapper-aarch64: needs LINUX_BUILDDIR Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 06/23] linux/extensions: point to proper _SRCDIR and @D Florian Fainelli via buildroot
` (17 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Gary Bisson, Thomas Petazzoni, Petr Vorel, Spenser Gilliland,
Florian Fainelli, Maxime Chevallier, Francois Perrad,
Arnout Vandecappelle, Luca Ceresoli, Thomas Perale, Eric Le Bihan,
Mahyar Koshkouei, Yann E. MORIN, Romain Naour, Pascal de Bruijn,
Thomas Petazzoni, Jérôme Pouiller, Bernd Kuhls,
Maxime Ripard, Refik Tuzakli, Giulio Benetti
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
In preparation for the split between the source and build directories,
make mxs-bootlets look in the correct locations.
mxs-bootlets wants to access the generated images, so it must look in
the build directory of each package.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
(cherry picked from commit 23a452e42840d5536dc1a24cae859da608003e29)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
boot/mxs-bootlets/mxs-bootlets.mk | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/boot/mxs-bootlets/mxs-bootlets.mk b/boot/mxs-bootlets/mxs-bootlets.mk
index adc22767f7e3..e2dc14e90ac0 100644
--- a/boot/mxs-bootlets/mxs-bootlets.mk
+++ b/boot/mxs-bootlets/mxs-bootlets.mk
@@ -56,7 +56,7 @@ endif
ifeq ($(BR2_TARGET_MXS_BOOTLETS_BAREBOX),y)
define MXS_BOOTLETS_SED_BAREBOX
- sed -i 's,[^ *]barebox.*;,\tbarebox="$(BAREBOX_DIR)/barebox";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
+ sed -i 's,[^ *]barebox.*;,\tbarebox="$(BAREBOX_BUILDDIR)/barebox";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
endef
endif
@@ -67,13 +67,13 @@ define MXS_BOOTLETS_BUILD_LINUX_PREP
endef
define MXS_BOOTLETS_SED_LINUX
sed -i 's,[^ *]linux_prep.*;,\tlinux_prep="$(@D)/linux_prep/output-target/linux_prep";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
- sed -i 's,[^ *]zImage.*;,\tzImage="$(LINUX_DIR)/arch/arm/boot/zImage";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
+ sed -i 's,[^ *]zImage.*;,\tzImage="$(LINUX_BUILDDIR)/arch/arm/boot/zImage";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
endef
endif
ifeq ($(BR2_TARGET_MXS_BOOTLETS_UBOOT),y)
define MXS_BOOTLETS_SED_UBOOT
- sed -i 's,[^ *]u_boot.*;,\tu_boot="$(UBOOT_DIR)/u-boot";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
+ sed -i 's,[^ *]u_boot.*;,\tu_boot="$(UBOOT_BUILDDIR)/u-boot";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
endef
endif
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 06/23] linux/extensions: point to proper _SRCDIR and @D
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (4 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 05/23] boot/mxs-bootlets: needs (BAREBOX, LINUX, UBOOT)_BUILDDIR Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 07/23] linux/linux: LINUX_VERSION_PROBED should run from build directory Florian Fainelli via buildroot
` (16 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Gary Bisson, Thomas Petazzoni, Petr Vorel, Spenser Gilliland,
Mahyar Koshkouei, Florian Fainelli, Maxime Chevallier,
Francois Perrad, Arnout Vandecappelle, Luca Ceresoli,
Thomas Perale, Eric Le Bihan, David Lechner, Yann E. MORIN,
Giulio Benetti, Pascal de Bruijn, Thomas Petazzoni,
Jérôme Pouiller, Bernd Kuhls, Refik Tuzakli,
Romain Naour
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
In preparation for the split between the source and build directories,
make the linux extensions look in the correct locations.
The patches or scripts are located in the source direcotries of the
extensions, so look there.
Also, the externsions are run as part of the various infra hooks, so
they have access to @D, so use that instead of LINUX_DIR.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc Christian Stewart <christian@paral.in>
Cc: David Lechner <david@lechnology.com>
(cherry picked from commit 301dfb34380dfaeb5c32e71758aa1c3706140301)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
linux/linux-ext-rtai.mk | 8 ++++----
linux/linux-ext-xenomai.mk | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/linux/linux-ext-rtai.mk b/linux/linux-ext-rtai.mk
index 50f79f8d5047..d7f55cf55f41 100644
--- a/linux/linux-ext-rtai.mk
+++ b/linux/linux-ext-rtai.mk
@@ -18,10 +18,10 @@ endif
# Prepare kernel patch
define RTAI_PREPARE_KERNEL
- kver=`$(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelversion` ; \
- if test -f $(RTAI_DIR)/base/arch/$(RTAI_ARCH)/patches/hal-linux-$${kver}-*patch ; then \
- $(APPLY_PATCHES) $(LINUX_DIR) \
- $(RTAI_DIR)/base/arch/$(RTAI_ARCH)/patches/ \
+ kver=`$(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) --no-print-directory -s kernelversion` ; \
+ if test -f $(RTAI_SRCDIR)/base/arch/$(RTAI_ARCH)/patches/hal-linux-$${kver}-*patch ; then \
+ $(APPLY_PATCHES) $(@D) \
+ $(RTAI_SRCDIR)/base/arch/$(RTAI_ARCH)/patches/ \
hal-linux-$${kver}-*patch ; \
else \
echo "No RTAI patch for your kernel version" ; \
diff --git a/linux/linux-ext-xenomai.mk b/linux/linux-ext-xenomai.mk
index 5ec6891bbf20..0ebb771d8940 100644
--- a/linux/linux-ext-xenomai.mk
+++ b/linux/linux-ext-xenomai.mk
@@ -27,8 +27,8 @@ endif
# Prepare kernel patch
define XENOMAI_PREPARE_KERNEL
- $(XENOMAI_DIR)/scripts/prepare-kernel.sh \
- --linux=$(LINUX_DIR) \
+ $(XENOMAI_SRCDIR)/scripts/prepare-kernel.sh \
+ --linux=$(@D) \
--arch=$(KERNEL_ARCH) \
$(XENOMAI_ADEOS_OPTS) \
--verbose
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 07/23] linux/linux: LINUX_VERSION_PROBED should run from build directory
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (5 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 06/23] linux/extensions: point to proper _SRCDIR and @D Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 08/23] package: use <pkg>_SRCSUBDIR where <pkg>_SRCDIR used to include _SUBDIR Florian Fainelli via buildroot
` (15 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Eric Le Bihan, Jérôme Pouiller,
Florian Fainelli, Gary Bisson, Romain Naour, Bernd Kuhls,
Thomas Perale, Maxime Chevallier, Refik Tuzakli, Francois Perrad,
Thomas Petazzoni, Arnout Vandecappelle, Petr Vorel,
Spenser Gilliland, Giulio Benetti, Pascal de Bruijn,
Luca Ceresoli, Yann E. MORIN, Mahyar Koshkouei
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
LINUX_VERSION_PROBED would be constructed from some configuration
options, like CONFIG_LOCALVERSION, so it needs to run from the build
directory, where Linux' .config is.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
(cherry picked from commit 0323ef5ceb5b5968eb9f6f00cbe26cf089a4d252)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
linux/linux.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/linux/linux.mk b/linux/linux.mk
index 75294cff1842..a90e09afe906 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -197,7 +197,7 @@ endif
# Get the real Linux version, which tells us where kernel modules are
# going to be installed in the target filesystem.
# Filter out 'w' from MAKEFLAGS, to workaround a bug in make 4.1 (#13141)
-LINUX_VERSION_PROBED = `MAKEFLAGS='$(filter-out w,$(MAKEFLAGS))' $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease 2>/dev/null`
+LINUX_VERSION_PROBED = `MAKEFLAGS='$(filter-out w,$(MAKEFLAGS))' $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_BUILDDIR) --no-print-directory -s kernelrelease 2>/dev/null`
LINUX_DTS_NAME += $(call qstrip,$(BR2_LINUX_KERNEL_INTREE_DTS_NAME))
LINUX_DTSO_NAMES += $(call qstrip,$(BR2_LINUX_KERNEL_INTREE_DTSO_NAMES))
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 08/23] package: use <pkg>_SRCSUBDIR where <pkg>_SRCDIR used to include _SUBDIR
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (6 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 07/23] linux/linux: LINUX_VERSION_PROBED should run from build directory Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 09/23] linux: build out of tree Florian Fainelli via buildroot
` (14 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Eric Le Bihan, Gary Bisson, Jérôme Pouiller,
Florian Fainelli, Bernd Kuhls, Thomas Perale, Maxime Chevallier,
Refik Tuzakli, Francois Perrad, Thomas Petazzoni,
Arnout Vandecappelle, Petr Vorel, Spenser Gilliland,
Giulio Benetti, Pascal de Bruijn, Luca Ceresoli, Romain Naour,
Mahyar Koshkouei
With <pkg>_SRCDIR no longer including <pkg>_SUBDIR, convert the
infrastructures and packages that relied on the old meaning (cargo,
hare, luarocks, meson, perl, waf, gcc-final) to <pkg>_SRCSUBDIR.
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/gcc/gcc-final/gcc-final.mk | 2 +-
package/pkg-cargo.mk | 8 ++++----
package/pkg-hare.mk | 8 ++++----
package/pkg-luarocks.mk | 4 ++--
package/pkg-meson.mk | 26 +++++++++++++-------------
package/pkg-perl.mk | 12 ++++++------
package/pkg-waf.mk | 8 ++++----
7 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index 97a64ae2fabf..570636a81dfe 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -51,7 +51,7 @@ HOST_GCC_FINAL_PRE_CONFIGURE_HOOKS += HOST_GCC_CONFIGURE_SYMLINK
# So we must completely override the generic commands and provide our own.
#
define HOST_GCC_FINAL_CONFIGURE_CMDS
- (cd $(HOST_GCC_FINAL_SRCDIR) && rm -rf config.cache; \
+ (cd $(HOST_GCC_FINAL_SRCSUBDIR) && rm -rf config.cache; \
$(HOST_CONFIGURE_OPTS) \
CFLAGS="$(HOST_CFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \
diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
index 47a6353f2592..aae6eb9b61aa 100644
--- a/package/pkg-cargo.mk
+++ b/package/pkg-cargo.mk
@@ -234,7 +234,7 @@ endif
ifndef $(2)_BUILD_CMDS
ifeq ($(4),target)
define $(2)_BUILD_CMDS
- cd $$($$(PKG)_SRCDIR) && \
+ cd $$($$(PKG)_SRCSUBDIR) && \
$$(TARGET_MAKE_ENV) \
$$(TARGET_CONFIGURE_OPTS) \
$$(PKG_CARGO_ENV) \
@@ -248,7 +248,7 @@ define $(2)_BUILD_CMDS
endef
else # ifeq ($(4),target)
define $(2)_BUILD_CMDS
- cd $$($$(PKG)_SRCDIR) && \
+ cd $$($$(PKG)_SRCSUBDIR) && \
$$(HOST_MAKE_ENV) \
$$(HOST_CONFIGURE_OPTS) \
$$(HOST_PKG_CARGO_ENV) \
@@ -269,7 +269,7 @@ endif # ifndef $(2)_BUILD_CMDS
#
ifndef $(2)_INSTALL_TARGET_CMDS
define $(2)_INSTALL_TARGET_CMDS
- cd $$($$(PKG)_SRCDIR) && \
+ cd $$($$(PKG)_SRCSUBDIR) && \
$$(TARGET_MAKE_ENV) \
$$(TARGET_CONFIGURE_OPTS) \
$$(PKG_CARGO_ENV) \
@@ -289,7 +289,7 @@ endif
ifndef $(2)_INSTALL_CMDS
define $(2)_INSTALL_CMDS
- cd $$($$(PKG)_SRCDIR) && \
+ cd $$($$(PKG)_SRCSUBDIR) && \
$$(HOST_MAKE_ENV) \
$$(HOST_CONFIGURE_OPTS) \
$$(HOST_PKG_CARGO_ENV) \
diff --git a/package/pkg-hare.mk b/package/pkg-hare.mk
index 15dc769311a8..a263b4d42ef3 100644
--- a/package/pkg-hare.mk
+++ b/package/pkg-hare.mk
@@ -48,10 +48,10 @@ ifndef $(2)_BUILD_CMDS
# https://harelang.org/documentation/usage/project-structure.html#makefiles
# but in real world, the target "all" is not always the default one
define $(2)_BUILD_CMDS
- if grep "^all:" $$($(2)_SRCDIR)Makefile > /dev/null; then \
+ if grep "^all:" $$($(2)_SRCSUBDIR)Makefile > /dev/null; then \
target=all ; \
fi ; \
- $(MAKE) -C $$($(2)_SRCDIR) HARE="$$(HARE_RUN_CMD)" HAREFLAGS="$$(HARE_ARCH_OPT) $$(HARE_LIBDIR_OPT)" $${target}
+ $(MAKE) -C $$($(2)_SRCSUBDIR) HARE="$$(HARE_RUN_CMD)" HAREFLAGS="$$(HARE_ARCH_OPT) $$(HARE_LIBDIR_OPT)" $${target}
endef
endif
@@ -61,7 +61,7 @@ endif
#
ifndef $(2)_INSTALL_STAGING_CMDS
define $(2)_INSTALL_STAGING_CMDS
- $(MAKE) -C $$($(2)_SRCDIR) PREFIX=/usr DESTDIR="$$(STAGING_DIR)" install
+ $(MAKE) -C $$($(2)_SRCSUBDIR) PREFIX=/usr DESTDIR="$$(STAGING_DIR)" install
endef
endif
@@ -71,7 +71,7 @@ endif
#
ifndef $(2)_INSTALL_TARGET_CMDS
define $(2)_INSTALL_TARGET_CMDS
- $(MAKE) -C $$($(2)_SRCDIR) PREFIX=/usr DESTDIR="$$(TARGET_DIR)" install
+ $(MAKE) -C $$($(2)_SRCSUBDIR) PREFIX=/usr DESTDIR="$$(TARGET_DIR)" install
endef
endif
diff --git a/package/pkg-luarocks.mk b/package/pkg-luarocks.mk
index abcd525fcf8a..9c12ed627b60 100644
--- a/package/pkg-luarocks.mk
+++ b/package/pkg-luarocks.mk
@@ -108,7 +108,7 @@ endif
#
ifndef $(2)_INSTALL_TARGET_CMDS
define $(2)_INSTALL_TARGET_CMDS
- cd $$($(2)_SRCDIR) && \
+ cd $$($(2)_SRCSUBDIR) && \
LUAROCKS_CONFIG=$$(LUAROCKS_CONFIG_FILE) \
$$(LUAROCKS_RUN_CMD) make --keep --deps-mode none \
--tree "$$(TARGET_DIR)/usr" \
@@ -125,7 +125,7 @@ endif
ifndef $(2)_INSTALL_CMDS
define $(2)_INSTALL_CMDS
- cd $$($(2)_SRCDIR) && \
+ cd $$($(2)_SRCSUBDIR) && \
LUAROCKS_CONFIG=$$(HOST_LUAROCKS_CONFIG_FILE) \
$$(LUAROCKS_RUN_CMD) make --keep --deps-mode none \
DEPS_DIR="$$(HOST_DIR)" \
diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index f2efbae2eb72..350f597b7018 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -147,12 +147,12 @@ $(2)_CXXFLAGS ?= $$(TARGET_CXXFLAGS)
#
#
define $(2)_CONFIGURE_CMDS
- rm -rf $$($$(PKG)_SRCDIR)/buildroot-build
- mkdir -p $$($$(PKG)_SRCDIR)/buildroot-build
+ rm -rf $$($$(PKG)_SRCSUBDIR)/buildroot-build
+ mkdir -p $$($$(PKG)_SRCSUBDIR)/buildroot-build
sed -e "/^\[binaries\]$$$$/s:$$$$:$$(foreach x,$$($(2)_MESON_EXTRA_BINARIES),\n$$(x)):" \
-e "/^\[properties\]$$$$/s:$$$$:$$(foreach x,$$($(2)_MESON_EXTRA_PROPERTIES),\n$$(x)):" \
$$(call PKG_MESON_CROSSCONFIG_SED,$(2)_CFLAGS,$(2)_CXXFLAGS,$(2)_LDFLAGS,$(2)_FCFLAGS) \
- > $$($$(PKG)_SRCDIR)/buildroot-build/cross-compilation.conf
+ > $$($$(PKG)_SRCSUBDIR)/buildroot-build/cross-compilation.conf
PATH=$$(BR_PATH) \
CC_FOR_BUILD="$$(HOSTCC)" \
CXX_FOR_BUILD="$$(HOSTCXX)" \
@@ -162,21 +162,21 @@ define $(2)_CONFIGURE_CMDS
--libdir=lib \
--default-library=$(PKG_MESON_DEFAULT_LIBRARY) \
--buildtype=$(if $(BR2_ENABLE_RUNTIME_DEBUG),debug,release) \
- --cross-file=$$($$(PKG)_SRCDIR)/buildroot-build/cross-compilation.conf \
+ --cross-file=$$($$(PKG)_SRCSUBDIR)/buildroot-build/cross-compilation.conf \
-Db_pie=false \
-Db_staticpic=$(if $(BR2_m68k_cf),false,true) \
-Dstrip=false \
-Dbuild.pkg_config_path=$$(HOST_DIR)/lib/pkgconfig \
-Dbuild.cmake_prefix_path=$$(HOST_DIR)/lib/cmake \
$$($$(PKG)_CONF_OPTS) \
- $$($$(PKG)_SRCDIR) $$($$(PKG)_SRCDIR)/buildroot-build
+ $$($$(PKG)_SRCSUBDIR) $$($$(PKG)_SRCSUBDIR)/buildroot-build
endef
else
# Configure package for host
define $(2)_CONFIGURE_CMDS
- rm -rf $$($$(PKG)_SRCDIR)/buildroot-build
- mkdir -p $$($$(PKG)_SRCDIR)/buildroot-build
+ rm -rf $$($$(PKG)_SRCSUBDIR)/buildroot-build
+ mkdir -p $$($$(PKG)_SRCSUBDIR)/buildroot-build
$$(HOST_CONFIGURE_OPTS) \
$$($$(PKG)_CONF_ENV) $$(MESON) setup \
--prefix=$$(HOST_DIR) \
@@ -188,7 +188,7 @@ define $(2)_CONFIGURE_CMDS
--wrap-mode=nodownload \
-Dstrip=true \
$$($$(PKG)_CONF_OPTS) \
- $$($$(PKG)_SRCDIR) $$($$(PKG)_SRCDIR)/buildroot-build
+ $$($$(PKG)_SRCSUBDIR) $$($$(PKG)_SRCSUBDIR)/buildroot-build
endef
endif
endif
@@ -203,12 +203,12 @@ ifndef $(2)_BUILD_CMDS
ifeq ($(4),target)
define $(2)_BUILD_CMDS
$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
- $$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/buildroot-build
+ $$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCSUBDIR)/buildroot-build
endef
else
define $(2)_BUILD_CMDS
$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
- $$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/buildroot-build
+ $$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCSUBDIR)/buildroot-build
endef
endif
endif
@@ -220,7 +220,7 @@ endif
ifndef $(2)_INSTALL_CMDS
define $(2)_INSTALL_CMDS
$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
- $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/buildroot-build install
+ $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCSUBDIR)/buildroot-build install
endef
endif
@@ -231,7 +231,7 @@ endif
ifndef $(2)_INSTALL_STAGING_CMDS
define $(2)_INSTALL_STAGING_CMDS
$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
- $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/buildroot-build install
+ $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCSUBDIR)/buildroot-build install
endef
endif
@@ -242,7 +242,7 @@ endif
ifndef $(2)_INSTALL_TARGET_CMDS
define $(2)_INSTALL_TARGET_CMDS
$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
- $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/buildroot-build install
+ $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCSUBDIR)/buildroot-build install
endef
endif
diff --git a/package/pkg-perl.mk b/package/pkg-perl.mk
index 1ecf31eff9ca..1fbfb00e3796 100644
--- a/package/pkg-perl.mk
+++ b/package/pkg-perl.mk
@@ -67,7 +67,7 @@ ifeq ($(4),target)
# Configure package for target
define $(2)_CONFIGURE_CMDS
- cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] && [ $$($(2)_PREFER_INSTALLER) != "EUMM" ] ; then \
+ cd $$($$(PKG)_SRCSUBDIR) && if [ -f Build.PL ] && [ $$($(2)_PREFER_INSTALLER) != "EUMM" ] ; then \
$$($(2)_CONF_ENV) \
PERL_MM_USE_DEFAULT=1 \
$$(PERL_RUN) Build.PL \
@@ -118,7 +118,7 @@ else
# Configure package for host
define $(2)_CONFIGURE_CMDS
- cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] && [ $$($(2)_PREFER_INSTALLER) != "EUMM" ] ; then \
+ cd $$($$(PKG)_SRCSUBDIR) && if [ -f Build.PL ] && [ $$($(2)_PREFER_INSTALLER) != "EUMM" ] ; then \
$$($(2)_CONF_ENV) \
PERL_MM_USE_DEFAULT=1 \
$$(PERL_RUN) Build.PL \
@@ -144,7 +144,7 @@ ifeq ($(4),target)
# Build package for target
define $(2)_BUILD_CMDS
- cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] && [ $$($(2)_PREFER_INSTALLER) != "EUMM" ] ; then \
+ cd $$($$(PKG)_SRCSUBDIR) && if [ -f Build.PL ] && [ $$($(2)_PREFER_INSTALLER) != "EUMM" ] ; then \
$$(PERL_RUN) Build $$($(2)_BUILD_OPTS) build; \
else \
$$(MAKE1) \
@@ -156,7 +156,7 @@ else
# Build package for host
define $(2)_BUILD_CMDS
- cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] && [ $$($(2)_PREFER_INSTALLER) != "EUMM" ] ; then \
+ cd $$($$(PKG)_SRCSUBDIR) && if [ -f Build.PL ] && [ $$($(2)_PREFER_INSTALLER) != "EUMM" ] ; then \
$$(PERL_RUN) Build $$($(2)_BUILD_OPTS) build; \
else \
$$(MAKE1) $$($(2)_BUILD_OPTS) pure_all; \
@@ -171,7 +171,7 @@ endif
#
ifndef $(2)_INSTALL_CMDS
define $(2)_INSTALL_CMDS
- cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] && [ $$($(2)_PREFER_INSTALLER) != "EUMM" ] ; then \
+ cd $$($$(PKG)_SRCSUBDIR) && if [ -f Build.PL ] && [ $$($(2)_PREFER_INSTALLER) != "EUMM" ] ; then \
$$(PERL_RUN) Build $$($(2)_INSTALL_TARGET_OPTS) install; \
else \
$$(MAKE1) $$($(2)_INSTALL_TARGET_OPTS) pure_install; \
@@ -185,7 +185,7 @@ endif
#
ifndef $(2)_INSTALL_TARGET_CMDS
define $(2)_INSTALL_TARGET_CMDS
- cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] && [ $$($(2)_PREFER_INSTALLER) != "EUMM" ] ; then \
+ cd $$($$(PKG)_SRCSUBDIR) && if [ -f Build.PL ] && [ $$($(2)_PREFER_INSTALLER) != "EUMM" ] ; then \
$$(PERL_RUN) Build $$($(2)_INSTALL_TARGET_OPTS) install; \
else \
$$(MAKE1) $$($(2)_INSTALL_TARGET_OPTS) pure_install; \
diff --git a/package/pkg-waf.mk b/package/pkg-waf.mk
index 0529bb6ddaf2..c41d7314a132 100644
--- a/package/pkg-waf.mk
+++ b/package/pkg-waf.mk
@@ -65,7 +65,7 @@ endif
#
ifndef $(2)_CONFIGURE_CMDS
define $(2)_CONFIGURE_CMDS
- cd $$($$(PKG)_SRCDIR) && \
+ cd $$($$(PKG)_SRCSUBDIR) && \
$$(TARGET_CONFIGURE_OPTS) \
$$($(2)_CONF_ENV) \
$$(HOST_DIR)/bin/python3 $$($(2)_WAF) configure \
@@ -82,7 +82,7 @@ endif
#
ifndef $(2)_BUILD_CMDS
define $(2)_BUILD_CMDS
- cd $$($$(PKG)_SRCDIR) && \
+ cd $$($$(PKG)_SRCSUBDIR) && \
$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$(HOST_DIR)/bin/python3 $$($(2)_WAF) \
build $$(WAF_OPTS) $$($(2)_BUILD_OPTS) \
$$($(2)_WAF_OPTS)
@@ -95,7 +95,7 @@ endif
#
ifndef $(2)_INSTALL_STAGING_CMDS
define $(2)_INSTALL_STAGING_CMDS
- cd $$($$(PKG)_SRCDIR) && \
+ cd $$($$(PKG)_SRCSUBDIR) && \
$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$(HOST_DIR)/bin/python3 $$($(2)_WAF) \
install --destdir=$$(STAGING_DIR) \
$$($(2)_INSTALL_STAGING_OPTS) \
@@ -109,7 +109,7 @@ endif
#
ifndef $(2)_INSTALL_TARGET_CMDS
define $(2)_INSTALL_TARGET_CMDS
- cd $$($$(PKG)_SRCDIR) && \
+ cd $$($$(PKG)_SRCSUBDIR) && \
$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$(HOST_DIR)/bin/python3 $$($(2)_WAF) \
install --destdir=$$(TARGET_DIR) \
$$($(2)_INSTALL_TARGET_OPTS) \
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 09/23] linux: build out of tree
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (7 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 08/23] package: use <pkg>_SRCSUBDIR where <pkg>_SRCDIR used to include _SUBDIR Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 10/23] packages: sync host and target patch hooks Florian Fainelli via buildroot
` (13 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Eric Le Bihan, Gary Bisson, Jérôme Pouiller,
Florian Fainelli, Bernd Kuhls, Thomas Perale, Maxime Chevallier,
Refik Tuzakli, Francois Perrad, Thomas Petazzoni,
Arnout Vandecappelle, Petr Vorel, Spenser Gilliland,
Giulio Benetti, Pascal de Bruijn, Luca Ceresoli, Romain Naour,
Mahyar Koshkouei
Introduce <pkg>_SUPPORTS_OUT_OF_TREE. A package that sets it is always
built out of tree:
- <pkg>_SRCDIR is $(SRC_DIR)/<basename>, i.e. output/source/..., where
the sources are extracted and patched, while <pkg>_BUILDDIR remains
in $(BUILD_DIR) and only contains generated files. Other packages
keep extracting in $(BUILD_DIR), so they are not affected;
- when <pkg>_OVERRIDE_SRCDIR is set, <pkg>_SRCDIR is the overridden
directory, used in place: nothing is rsynced into $(BUILD_DIR), only
the pre/post rsync hooks still run, and the source-related stamp
files (rsynced, patched, ...) live in the build directory so that
nothing is created in the user's tree;
- kconfig packages start from the source directory with O=<builddir>,
which makes kbuild generate its wrapper Makefile in the build
directory, so that all the existing -C $(LINUX_DIR) invocations keep
working unmodified;
- <pkg>-dirclean and 'make clean' also remove the extracted sources.
Enable it for the Linux kernel. When the sources are overridden, the
source tree must be clean (no in-tree .config, include/config,
arch/*/include/generated).
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
Makefile | 4 ++--
linux/linux.mk | 5 +++++
package/pkg-generic.mk | 46 ++++++++++++++++++++++++++++++------------
package/pkg-kconfig.mk | 6 +++++-
4 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/Makefile b/Makefile
index c1f12a4bfc38..7aa43126540c 100644
--- a/Makefile
+++ b/Makefile
@@ -211,7 +211,7 @@ endif
# Avoids doing the $(or...) everytime
BR_GRAPH_OUT := $(or $(BR2_GRAPH_OUT),pdf)
-SRC_DIR := $(BASE_DIR)/build
+SRC_DIR := $(BASE_DIR)/source
BUILD_DIR := $(BASE_DIR)/build
BINARIES_DIR := $(BASE_DIR)/images
BASE_TARGET_DIR := $(BASE_DIR)/target
@@ -1133,7 +1133,7 @@ show-vars:
.PHONY: clean
clean:
rm -rf $(BASE_TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) $(HOST_DIR_SYMLINK) \
- $(BUILD_DIR) $(BASE_DIR)/staging \
+ $(BUILD_DIR) $(SRC_DIR) $(BASE_DIR)/staging \
$(LEGAL_INFO_DIR) $(GRAPHS_DIR) $(PER_PACKAGE_DIR) $(O)/pkg-stats.*
.PHONY: distclean
diff --git a/linux/linux.mk b/linux/linux.mk
index a90e09afe906..5734d78aa9a2 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -6,6 +6,11 @@
LINUX_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
LINUX_LICENSE = GPL-2.0
+
+# The kernel is always built out of tree: the sources are in $(LINUX_SRCDIR)
+# and the kernel is built in $(LINUX_BUILDDIR) with O=. When
+# LINUX_OVERRIDE_SRCDIR is set, the sources are not rsynced.
+LINUX_SUPPORTS_OUT_OF_TREE = YES
LINUX_LICENSE_FILES = $(call qstrip,$(BR2_LINUX_KERNEL_LICENSE_FILES))
LINUX_CPE_ID_VENDOR = linux
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 138fe9ccef4f..0f4bf73fa064 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -171,7 +171,7 @@ endef
################################################################################
# Retrieve the archive
-$(SRC_DIR)/%/.stamp_downloaded:
+$(BUILD_DIR)/%/.stamp_downloaded $(SRC_DIR)/%/.stamp_downloaded:
@$(call step_start,download)
$(call prepare-per-package-directory,$($(PKG)_FINAL_DOWNLOAD_DEPENDENCIES))
$(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
@@ -196,7 +196,7 @@ $(SRC_DIR)/%/.stamp_downloaded:
$(Q)touch $@
# Retrieve actual source archive, e.g. for prebuilt external toolchains
-$(SRC_DIR)/%/.stamp_actual_downloaded:
+$(BUILD_DIR)/%/.stamp_actual_downloaded $(SRC_DIR)/%/.stamp_actual_downloaded:
@$(call step_start,actual-download)
$(call DOWNLOAD,$($(PKG)_ACTUAL_SOURCE_SITE)/$($(PKG)_ACTUAL_SOURCE_TARBALL))
$(Q)mkdir -p $(@D)
@@ -204,7 +204,7 @@ $(SRC_DIR)/%/.stamp_actual_downloaded:
$(Q)touch $@
# Unpack the archive
-$(SRC_DIR)/%/.stamp_extracted:
+$(BUILD_DIR)/%/.stamp_extracted $(SRC_DIR)/%/.stamp_extracted:
@$(call step_start,extract)
@$(call MESSAGE,"Extracting")
$(call prepare-per-package-directory,$($(PKG)_FINAL_EXTRACT_DEPENDENCIES))
@@ -219,19 +219,19 @@ $(SRC_DIR)/%/.stamp_extracted:
# Rsync the source directory if the <pkg>_OVERRIDE_SRCDIR feature is
# used.
-$(SRC_DIR)/%/.stamp_rsynced:
+$(BUILD_DIR)/%/.stamp_rsynced $(SRC_DIR)/%/.stamp_rsynced:
@$(call step_start,rsync)
- @$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
+ @$(call MESSAGE,"$(if $($(PKG)_OUT_OF_TREE),Using out-of-tree source dir,Syncing from source dir) $(SRCDIR)")
@mkdir -p $(@D)
$(foreach hook,$($(PKG)_PRE_RSYNC_HOOKS),$(call $(hook))$(sep))
@test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
- rsync -au --chmod=u=rwX,go=rX $($(PKG)_OVERRIDE_SRCDIR_RSYNC_EXCLUSIONS) $(RSYNC_VCS_EXCLUSIONS) $(call qstrip,$(SRCDIR))/ $(@D)
+ $(if $($(PKG)_OUT_OF_TREE),,rsync -au --chmod=u=rwX,go=rX $($(PKG)_OVERRIDE_SRCDIR_RSYNC_EXCLUSIONS) $(RSYNC_VCS_EXCLUSIONS) $(call qstrip,$(SRCDIR))/ $(@D))
$(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
@$(call step_end,rsync)
$(Q)touch $@
# Patch
-$(SRC_DIR)/%/.stamp_patched:
+$(BUILD_DIR)/%/.stamp_patched $(SRC_DIR)/%/.stamp_patched:
@$(call step_start,patch)
@$(call MESSAGE,"Patching")
$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
@@ -390,6 +390,7 @@ $(BUILD_DIR)/%/.stamp_installed:
$(BUILD_DIR)/%/.stamp_dircleaned:
$(if $(BR2_PER_PACKAGE_DIRECTORIES),rm -Rf $(PER_PACKAGE_DIR)/$(NAME))
rm -Rf $(@D)
+ $(if $(filter $(SRC_DIR)/%,$($(PKG)_SRCDIR)),rm -Rf $($(PKG)_SRCDIR))
################################################################################
# virt-provides-single -- check that provider-pkg is the declared provider for
@@ -559,13 +560,32 @@ ifndef $(2)_STRIP_COMPONENTS
endif
$(2)_SRCDIR = $$($(2)_DIR)
-$(2)_BUILDDIR = $$($(2)_DIR)
+$(2)_BUILDDIR ?= $$($(2)_DIR)
$(2)_SRCSUBDIR = $$($(2)_SRCDIR)/$$($(2)_SUBDIR)
ifneq ($$($(2)_OVERRIDE_SRCDIR),)
$(2)_VERSION = custom
endif
+# Packages that set <pkg>_SUPPORTS_OUT_OF_TREE = YES are always built out of
+# tree: the sources live in $(SRC_DIR), and only the build directory lives in
+# $(BUILD_DIR). When <pkg>_OVERRIDE_SRCDIR is set, the sources are used
+# where they are (no rsync). The source-related stamp files must then not be
+# created in the (user-owned) source directory, so they live in the build
+# directory.
+# Out-of-tree builds are disabled by default. A package infrastructure may
+# set a different default before calling this macro.
+$(3)_SUPPORTS_OUT_OF_TREE ?= NO
+$(2)_STAMP_SRCDIR = $$($(2)_SRCDIR)
+ifeq ($$($(3)_SUPPORTS_OUT_OF_TREE),YES)
+$(2)_OUT_OF_TREE = YES
+$(2)_SRCDIR = $$(SRC_DIR)/$$($(2)_BASENAME)
+ifneq ($$($(2)_OVERRIDE_SRCDIR),)
+$(2)_SRCDIR = $$(abspath $$(call qstrip,$$($(2)_OVERRIDE_SRCDIR)))
+$(2)_STAMP_SRCDIR = $$($(2)_BUILDDIR)
+endif
+endif
+
ifndef $(2)_SOURCE
ifdef $(3)_SOURCE
$(2)_SOURCE = $$($(3)_SOURCE)
@@ -844,11 +864,11 @@ $(2)_TARGET_INSTALL_IMAGES = $$($(2)_BUILDDIR)/.stamp_images_installed
$(2)_TARGET_INSTALL_HOST = $$($(2)_BUILDDIR)/.stamp_host_installed
$(2)_TARGET_BUILD = $$($(2)_BUILDDIR)/.stamp_built
$(2)_TARGET_CONFIGURE = $$($(2)_BUILDDIR)/.stamp_configured
-$(2)_TARGET_RSYNC = $$($(2)_SRCDIR)/.stamp_rsynced
-$(2)_TARGET_PATCH = $$($(2)_SRCDIR)/.stamp_patched
-$(2)_TARGET_EXTRACT = $$($(2)_SRCDIR)/.stamp_extracted
-$(2)_TARGET_SOURCE = $$($(2)_SRCDIR)/.stamp_downloaded
-$(2)_TARGET_ACTUAL_SOURCE = $$($(2)_SRCDIR)/.stamp_actual_downloaded
+$(2)_TARGET_RSYNC = $$($(2)_STAMP_SRCDIR)/.stamp_rsynced
+$(2)_TARGET_PATCH = $$($(2)_STAMP_SRCDIR)/.stamp_patched
+$(2)_TARGET_EXTRACT = $$($(2)_STAMP_SRCDIR)/.stamp_extracted
+$(2)_TARGET_SOURCE = $$($(2)_STAMP_SRCDIR)/.stamp_downloaded
+$(2)_TARGET_ACTUAL_SOURCE = $$($(2)_STAMP_SRCDIR)/.stamp_actual_downloaded
$(2)_TARGET_DIRCLEAN = $$($(2)_BUILDDIR)/.stamp_dircleaned
# default extract command
diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk
index 8a63d55be033..5e46c62c58e6 100644
--- a/package/pkg-kconfig.mk
+++ b/package/pkg-kconfig.mk
@@ -147,8 +147,12 @@ $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES): | $(1)-patch
fi; \
done
+# For an out-of-tree build, the first kconfig run is what creates the
+# wrapper Makefile in the build directory, so it must be started from
+# the source directory.
$(2)_KCONFIG_MAKE = \
- $$($(2)_MAKE_ENV) $$($(2)_MAKE) -C $$($(2)_BUILDDIR) \
+ $$($(2)_MAKE_ENV) $$($(2)_MAKE) \
+ $$(if $$($(2)_OUT_OF_TREE),-C $$($(2)_SRCDIR) O=$$($(2)_BUILDDIR),-C $$($(2)_BUILDDIR)) \
$$(PKG_KCONFIG_COMMON_OPTS) $$($(2)_KCONFIG_OPTS)
# The specified source configuration file and any additional configuration file
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 10/23] packages: sync host and target patch hooks
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (8 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 09/23] linux: build out of tree Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 11/23] omniorb: avoid target-only patch hook Florian Fainelli via buildroot
` (12 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Eric Le Bihan, Jérôme Pouiller,
Florian Fainelli, Gary Bisson, Romain Naour, Bernd Kuhls,
Thomas Perale, Maxime Chevallier, Refik Tuzakli, Francois Perrad,
Thomas Petazzoni, Arnout Vandecappelle, Petr Vorel,
Spenser Gilliland, Giulio Benetti, Pascal de Bruijn,
Luca Ceresoli, Yann E. MORIN, Mahyar Koshkouei
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
In preparation for the introduction of out-of-tree package build, it
is important that we don't do different things in the patch hooks for
the target and host variant of a given package, because the source
tree will be shared between the target and host builds.
For the gawk, icu, python and python3 packages touched by this patch,
there is no problem in running the target-only post-patch hook that
already exists to the host variant, so we simply do that.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
(cherry picked from commit 7d6a8f1ace39bbc96a1deab5c5c41d6c16ebf36a)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/icu/icu.mk | 1 +
1 file changed, 1 insertion(+)
diff --git a/package/icu/icu.mk b/package/icu/icu.mk
index 9b97011f5587..d17b610aeea4 100644
--- a/package/icu/icu.mk
+++ b/package/icu/icu.mk
@@ -67,6 +67,7 @@ define ICU_COPY_CUSTOM_DATA
cp $(ICU_CUSTOM_DATA_PATH) $(@D)/source/data/in/
endef
ICU_POST_PATCH_HOOKS += ICU_COPY_CUSTOM_DATA
+HOST_ICU_POST_PATCH_HOOKS += ICU_COPY_CUSTOM_DATA
endif
define ICU_REMOVE_DEV_FILES
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 11/23] omniorb: avoid target-only patch hook
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (9 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 10/23] packages: sync host and target patch hooks Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 12/23] lua: rework post-patch hook usage Florian Fainelli via buildroot
` (11 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Gary Bisson, Thomas Petazzoni, Petr Vorel, Spenser Gilliland,
Florian Fainelli, Maxime Chevallier, Francois Perrad,
Arnout Vandecappelle, Luca Ceresoli, Thomas Perale, Eric Le Bihan,
Mahyar Koshkouei, Yann E. MORIN, Matt Weber, Giulio Benetti,
Pascal de Bruijn, Thomas Petazzoni, Jérôme Pouiller,
Bernd Kuhls, Refik Tuzakli, Romain Naour
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
In preparation for the introduction of out-of-tree package build, it
is important that we don't do different things in the patch hooks for
the target and host variant of a given package, because the source
tree will be shared between the target and host builds.
The omniorb package was doing exactly this: when
BR2_PACKAGE_OMNIORB_WITH_APPS was enabled, it was patching the source
code, but only for the target package.
We replace this solution by adding a patch to OmniORB, which allows to
conditionally enable or disabled the compilation of the apps and
services, which is then used by BR2_PACKAGE_OMNIORB_WITH_APPS in a
post configure hook.
Cc: Matt Weber <mlweber1@rockwellcollins.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[yann.morin.1998@free.fr: renumber patch]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
(cherry picked from commit c5fe01e3c525babdc6ad1939fb3f98eae91f7c9f)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
.../omniorb/0002-optional-appl-services.patch | 29 +++++++++++++++++++
package/omniorb/omniorb.mk | 26 ++++++++---------
2 files changed, 42 insertions(+), 13 deletions(-)
create mode 100644 package/omniorb/0002-optional-appl-services.patch
diff --git a/package/omniorb/0002-optional-appl-services.patch b/package/omniorb/0002-optional-appl-services.patch
new file mode 100644
index 000000000000..9e3177465e27
--- /dev/null
+++ b/package/omniorb/0002-optional-appl-services.patch
@@ -0,0 +1,29 @@
+Add support for EmbeddedSystemWithApps
+
+The EmbeddedSystem option allows to disable building a lot of things
+from omniorb: tools, apps, services, python bindings, and more.
+
+However, there are situations where we want to disable all of these
+things, except apps and services. Therefore, as a quick workaround,
+this patch adds support for a EmbeddedSystemWithApps, which when
+defined, will build apps and services even if EmbeddedSystem is
+defined.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Upstream: N/A (Buildroot specific)
+
+Index: b/src/dir.mk
+===================================================================
+--- a/src/dir.mk
++++ b/src/dir.mk
+@@ -16,6 +16,10 @@
+ SUBDIRS += appl services
+ endif
+
++ifdef EmbeddedSystemWithApps
++SUBDIRS += appl services
++endif
++
+ all::
+ @echo
+ @echo 'No "all" rule here. If you want to build and export everything'
diff --git a/package/omniorb/omniorb.mk b/package/omniorb/omniorb.mk
index b61c7c3537bc..866d8d76b085 100644
--- a/package/omniorb/omniorb.mk
+++ b/package/omniorb/omniorb.mk
@@ -34,19 +34,6 @@ ifeq ($(BR2_PACKAGE_ZLIB),y)
OMNIORB_DEPENDENCIES += zlib
endif
-# The EmbeddedSystem define (set below in OMNIORB_ADJUST_TOOLDIR)
-# enables building of just the lib and disables building of
-# tools/apps/services. In some cases the apps/services are still
-# required. The tools however are host related and should never
-# be required on target.
-define OMNIORB_ENABLE_EXTRA_APPS
- $(SED) 's:SUBDIRS += lib:SUBDIRS += lib appl services:g' $(@D)/src/dir.mk
-endef
-
-ifeq ($(BR2_PACKAGE_OMNIORB_WITH_APPS),y)
-OMNIORB_POST_PATCH_HOOKS += OMNIORB_ENABLE_EXTRA_APPS
-endif
-
ifeq ($(BR2_STATIC_LIBS),y)
define OMNIORB_DISABLE_SHARED
echo "BuildSharedLibrary =" >> $(@D)/mk/beforeauto.mk
@@ -67,5 +54,18 @@ define OMNIORB_ADJUST_TOOLDIR
endef
OMNIORB_POST_CONFIGURE_HOOKS += OMNIORB_ADJUST_TOOLDIR
+ifeq ($(BR2_PACKAGE_OMNIORB_WITH_APPS),y)
+# The EmbeddedSystem define (set above in OMNIORB_ADJUST_TOOLDIR)
+# enables building of just the lib and disables building of
+# tools/apps/services. In some cases the apps/services are still
+# required. The tools however are host related and should never
+# be required on target.
+define OMNIORB_ENABLE_EXTRA_APPS
+ echo "EmbeddedSystemWithApps=1" >> $(@D)/mk/beforeauto.mk
+endef
+
+OMNIORB_POST_CONFIGURE_HOOKS += OMNIORB_ENABLE_EXTRA_APPS
+endif
+
$(eval $(autotools-package))
$(eval $(host-autotools-package))
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 12/23] lua: rework post-patch hook usage
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (10 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 11/23] omniorb: avoid target-only patch hook Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 13/23] infra: host packages inherit the target extra downloads Florian Fainelli via buildroot
` (10 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Gary Bisson, Thomas Petazzoni, Petr Vorel, Spenser Gilliland,
Francois Perrad, Florian Fainelli, Maxime Chevallier,
Francois Perrad, Arnout Vandecappelle, Luca Ceresoli,
Thomas Perale, Eric Le Bihan, Mahyar Koshkouei, Yann E. MORIN,
Romain Naour, Pascal de Bruijn, Thomas Petazzoni,
Jérôme Pouiller, Bernd Kuhls, Refik Tuzakli,
Giulio Benetti
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
In preparation for the introduction of out-of-tree package build, it
is important that we don't do different things in the patch hooks for
the target and host variant of a given package, because the source
tree will be shared between the target and host builds.
For lua, the post patch hook was modifying luaconf.h before the build
to get a 32 bits Lua build. However, passing just -DLUA_32BITS like we
do for other Lua compile time options is not sufficient since
LUA_32BITS should also be defined in the installed luaconf.h so that
other packages linking against lua get this defined as well. So, this
patch changes the post-patch hook to passing -DLUA_32BITS in
LUA_CFLAGS *and* changing the installed luaconf.h in a
post-install-staging hook.
The host variant also modified luaconf.h, to set LUA_ROOT to the host
directory. Since the host and target variants share the same sources,
this can not be done in a hook for the host variant only. Instead, the
Buildroot patch that sets LUA_ROOT now allows it to be overridden on the
compiler command line, which the host variant does with its CFLAGS, and
the installed host luaconf.h is adjusted in a post-install hook.
Cc: Francois Perrad <fperrad@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
(cherry picked from commit 827ed461ba2b00acfebcbd01e53d93a148594833)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/lua/5.1.5/0001-root-path.patch | 24 +++++++++---------------
package/lua/5.3.6/0001-root-path.patch | 15 +++++++++++----
package/lua/5.4.9/0001-root-path.patch | 11 +++++++++--
package/lua/lua.mk | 18 ++++++++++++++----
4 files changed, 43 insertions(+), 25 deletions(-)
diff --git a/package/lua/5.1.5/0001-root-path.patch b/package/lua/5.1.5/0001-root-path.patch
index 41de4ba2b938..81c5eefa3d90 100644
--- a/package/lua/5.1.5/0001-root-path.patch
+++ b/package/lua/5.1.5/0001-root-path.patch
@@ -1,31 +1,25 @@
-Adjust installation location to /usr.
+Adjust installation location to /usr, and allow LUA_ROOT to be overridden
+from the compiler command line.
+
+The host variant needs a different LUA_ROOT than the target variant. As
+both variants share the same sources, it can not be set by modifying
+luaconf.h, so it is passed in the CFLAGS instead.
Upstream: N/A specific for Buildroot build
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
-Index: b/etc/lua.pc
-===================================================================
---- a/etc/lua.pc
-+++ b/etc/lua.pc
-@@ -8,7 +8,7 @@
- R= 5.1.5
-
- # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
--prefix= /usr/local
-+prefix= /usr
- INSTALL_BIN= ${prefix}/bin
- INSTALL_INC= ${prefix}/include
- INSTALL_LIB= ${prefix}/lib
Index: b/src/luaconf.h
===================================================================
--- a/src/luaconf.h
+++ b/src/luaconf.h
-@@ -94,7 +94,7 @@
+@@ -94,7 +94,9 @@
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
#else
-#define LUA_ROOT "/usr/local/"
++#if !defined(LUA_ROOT)
+#define LUA_ROOT "/usr/"
++#endif
#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
#define LUA_PATH_DEFAULT \
diff --git a/package/lua/5.3.6/0001-root-path.patch b/package/lua/5.3.6/0001-root-path.patch
index b41df3ecb74c..f6273349be27 100644
--- a/package/lua/5.3.6/0001-root-path.patch
+++ b/package/lua/5.3.6/0001-root-path.patch
@@ -1,4 +1,9 @@
-Adjust installation location to /usr.
+Adjust installation location to /usr, and allow LUA_ROOT to be overridden
+from the compiler command line.
+
+The host variant needs a different LUA_ROOT than the target variant. As
+both variants share the same sources, it can not be set by modifying
+luaconf.h, so it is passed in the CFLAGS instead.
Upstream: N/A specific for Buildroot build
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
@@ -7,12 +12,14 @@ Index: b/src/luaconf.h
===================================================================
--- a/src/luaconf.h
+++ b/src/luaconf.h
-@@ -200,7 +200,7 @@
-
+@@ -200,7 +200,9 @@
+
#else /* }{ */
-
+
-#define LUA_ROOT "/usr/local/"
++#if !defined(LUA_ROOT)
+#define LUA_ROOT "/usr/"
++#endif
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
#define LUA_PATH_DEFAULT \
diff --git a/package/lua/5.4.9/0001-root-path.patch b/package/lua/5.4.9/0001-root-path.patch
index cec9066eee98..69d142a8f242 100644
--- a/package/lua/5.4.9/0001-root-path.patch
+++ b/package/lua/5.4.9/0001-root-path.patch
@@ -1,4 +1,9 @@
-Adjust installation location to /usr.
+Adjust installation location to /usr, and allow LUA_ROOT to be overridden
+from the compiler command line.
+
+The host variant needs a different LUA_ROOT than the target variant. As
+both variants share the same sources, it can not be set by modifying
+luaconf.h, so it is passed in the CFLAGS instead.
Upstream: N/A specific for Buildroot build
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
@@ -7,12 +12,14 @@ Index: b/src/luaconf.h
===================================================================
--- a/src/luaconf.h
+++ b/src/luaconf.h
-@@ -223,7 +223,7 @@
+@@ -223,7 +223,9 @@
#else /* }{ */
-#define LUA_ROOT "/usr/local/"
++#if !defined(LUA_ROOT)
+#define LUA_ROOT "/usr/"
++#endif
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
diff --git a/package/lua/lua.mk b/package/lua/lua.mk
index 6dbdc950021b..752b67b45333 100644
--- a/package/lua/lua.mk
+++ b/package/lua/lua.mk
@@ -66,19 +66,29 @@ endif
endif
ifeq ($(BR2_PACKAGE_LUA_32BITS),y)
+# We adjust the CFLAGS for the build of Lua itself, and then the
+# installed luaconf.h so that package using Lua also see LUA_32BITS
+# defined.
+LUA_CFLAGS += -DLUA_32BITS
define LUA_32BITS_LUACONF
- $(SED) 's/\/\* #define LUA_32BITS \*\//#define LUA_32BITS/' $(@D)/src/luaconf.h
+ $(SED) 's/\/\* #define LUA_32BITS \*\//#define LUA_32BITS/' \
+ $(STAGING_DIR)/usr/include/luaconf.h
endef
-LUA_POST_PATCH_HOOKS += LUA_32BITS_LUACONF
+LUA_POST_INSTALL_STAGING_HOOKS += LUA_32BITS_LUACONF
endif
+# The host and target variants share the same sources, so the sources can
+# not be modified for the host variant only. LUA_ROOT is overridden in the
+# CFLAGS when building host-lua, and in the installed luaconf.h.
define HOST_LUA_LUACONF
- $(SED) 's|#define LUA_ROOT.*|#define LUA_ROOT "$(HOST_DIR)/"|' $(@D)/src/luaconf.h
+ $(SED) 's|#define LUA_ROOT.*|#define LUA_ROOT "$(HOST_DIR)/"|' \
+ $(HOST_DIR)/include/luaconf.h
endef
-HOST_LUA_POST_PATCH_HOOKS += HOST_LUA_LUACONF
+HOST_LUA_POST_INSTALL_HOOKS += HOST_LUA_LUACONF
HOST_LUA_CFLAGS = -Wall -fPIC -DLUA_USE_DLOPEN -DLUA_USE_POSIX
+HOST_LUA_CFLAGS += -DLUA_ROOT='\"$(HOST_DIR)/\"'
ifeq ($(BR2_PACKAGE_LUA_5_3),y)
HOST_LUA_CFLAGS += -DLUA_COMPAT_5_2
endif
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 13/23] infra: host packages inherit the target extra downloads
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (11 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 12/23] lua: rework post-patch hook usage Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 14/23] package/libtool: use post-patch hooks Florian Fainelli via buildroot
` (9 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Eric Le Bihan, Jérôme Pouiller,
Florian Fainelli, Gary Bisson, Romain Naour, Bernd Kuhls,
Thomas Perale, Maxime Chevallier, Refik Tuzakli, Francois Perrad,
Thomas Petazzoni, Arnout Vandecappelle, Petr Vorel,
Spenser Gilliland, Giulio Benetti, Pascal de Bruijn,
Luca Ceresoli, Yann E. MORIN, Mahyar Koshkouei
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
Some packages need extra downloads, which are then extracted in their
source trees. Up until now, this was only used by target packages.
For example, perl will need perl-cross.
But with the upcoming merge of the host and target soruce trees, we
will also need those extra downloads for the host variants.
Update the three packages that already duplicated the host extra
downloads from the target ones.
There are three packages left that define host extra downloads, but
those packages do not have a target variant, so we can leave them
as-is.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
(cherry picked from commit 01540f0ee0cf07f77ef0dbf99d3d74f95b17f121)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/android-tools/android-tools.mk | 1 -
package/binutils/binutils.mk | 1 -
package/gdb/gdb.mk | 1 -
package/pkg-generic.mk | 6 ++++++
4 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/package/android-tools/android-tools.mk b/package/android-tools/android-tools.mk
index 20e26839f977..e30fce8ab7e3 100644
--- a/package/android-tools/android-tools.mk
+++ b/package/android-tools/android-tools.mk
@@ -8,7 +8,6 @@ ANDROID_TOOLS_SITE = https://launchpad.net/ubuntu/+archive/primary/+files
ANDROID_TOOLS_VERSION = 4.2.2+git20130218
ANDROID_TOOLS_SOURCE = android-tools_$(ANDROID_TOOLS_VERSION).orig.tar.xz
ANDROID_TOOLS_EXTRA_DOWNLOADS = android-tools_$(ANDROID_TOOLS_VERSION)-3ubuntu41.debian.tar.gz
-HOST_ANDROID_TOOLS_EXTRA_DOWNLOADS = $(ANDROID_TOOLS_EXTRA_DOWNLOADS)
ANDROID_TOOLS_LICENSE = Apache-2.0
ANDROID_TOOLS_LICENSE_FILES = debian/copyright
ANDROID_TOOLS_DEPENDENCIES = host-pkgconf
diff --git a/package/binutils/binutils.mk b/package/binutils/binutils.mk
index c6a6380be99e..4b376f393bbd 100644
--- a/package/binutils/binutils.mk
+++ b/package/binutils/binutils.mk
@@ -137,7 +137,6 @@ endef
BINUTILS_POST_EXTRACT_HOOKS += BINUTILS_XTENSA_OVERLAY_EXTRACT
BINUTILS_EXTRA_DOWNLOADS += $(ARCH_XTENSA_OVERLAY_URL)
HOST_BINUTILS_POST_EXTRACT_HOOKS += BINUTILS_XTENSA_OVERLAY_EXTRACT
-HOST_BINUTILS_EXTRA_DOWNLOADS += $(ARCH_XTENSA_OVERLAY_URL)
endif
# Hardlinks between binaries in different directories cause a problem
diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk
index cfec0585da9d..f33cc2ed7c57 100644
--- a/package/gdb/gdb.mk
+++ b/package/gdb/gdb.mk
@@ -39,7 +39,6 @@ endef
GDB_POST_EXTRACT_HOOKS += GDB_XTENSA_OVERLAY_EXTRACT
GDB_EXTRA_DOWNLOADS += $(ARCH_XTENSA_OVERLAY_URL)
HOST_GDB_POST_EXTRACT_HOOKS += GDB_XTENSA_OVERLAY_EXTRACT
-HOST_GDB_EXTRA_DOWNLOADS += $(ARCH_XTENSA_OVERLAY_URL)
endif
ifeq ($(GDB_FROM_GIT),y)
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 0f4bf73fa064..b9808bb624f7 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -608,6 +608,12 @@ ifndef $(2)_PATCH
endif
endif
+ifndef $(2)_EXTRA_DOWNLOADS
+ ifdef $(3)_EXTRA_DOWNLOADS
+ $(2)_EXTRA_DOWNLOADS = $$($(3)_EXTRA_DOWNLOADS)
+ endif
+endif
+
$(2)_MAIN_DOWNLOAD = \
$$(if $$($(2)_SOURCE),$$($(2)_SITE_METHOD)+$$($(2)_SITE)/$$($(2)_SOURCE))
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 14/23] package/libtool: use post-patch hooks
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (12 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 13/23] infra: host packages inherit the target extra downloads Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 15/23] package/libtool: also apply libtool-patch to host libtool Florian Fainelli via buildroot
` (8 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Eric Le Bihan, Jérôme Pouiller,
Florian Fainelli, Gary Bisson, Romain Naour, Bernd Kuhls,
Thomas Perale, Maxime Chevallier, Refik Tuzakli, Francois Perrad,
Thomas Petazzoni, Arnout Vandecappelle, Petr Vorel,
Spenser Gilliland, Giulio Benetti, Pascal de Bruijn,
Luca Ceresoli, Yann E. MORIN, Mahyar Koshkouei
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Run the autoreconf-avoidance tweaks from a post-patch hook, rather than
a pre-configure one, both for the target and host variants.
This will ease migrating to a shared host/target source tree.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[yann.morin.1998@free.fr: remove FIXME, actually do the migration]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
The hooks are still not the same, because we do not yet apply the
libtool patch on the host variant. This will be handled in a followup
patch
(cherry picked from commit b49cb508257ff7f075b4409101d98a589eb8d446)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/libtool/libtool.mk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/package/libtool/libtool.mk b/package/libtool/libtool.mk
index ecadc3e696f4..45441e1e4676 100644
--- a/package/libtool/libtool.mk
+++ b/package/libtool/libtool.mk
@@ -45,8 +45,8 @@ define LIBTOOL_AVOID_AUTORECONF_HOOK
find $(@D) -name configure -exec touch '{}' \;
find $(@D) -name Makefile.in -exec touch '{}' \;
endef
-LIBTOOL_PRE_CONFIGURE_HOOKS += LIBTOOL_AVOID_AUTORECONF_HOOK
-HOST_LIBTOOL_PRE_CONFIGURE_HOOKS += LIBTOOL_AVOID_AUTORECONF_HOOK
+LIBTOOL_POST_PATCH_HOOKS += LIBTOOL_AVOID_AUTORECONF_HOOK
+HOST_LIBTOOL_POST_PATCH_HOOKS += LIBTOOL_AVOID_AUTORECONF_HOOK
$(eval $(autotools-package))
$(eval $(host-autotools-package))
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 15/23] package/libtool: also apply libtool-patch to host libtool
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (13 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 14/23] package/libtool: use post-patch hooks Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 16/23] package/{ffmpeg, libvpx}: use $(@D) instead of $(pkg_SRCDIR) when possible Florian Fainelli via buildroot
` (7 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Eric Le Bihan, Jérôme Pouiller,
Florian Fainelli, Gary Bisson, Romain Naour, Bernd Kuhls,
Thomas Perale, Maxime Chevallier, Refik Tuzakli, Francois Perrad,
Thomas Petazzoni, Arnout Vandecappelle, Petr Vorel,
Spenser Gilliland, Giulio Benetti, Pascal de Bruijn,
Luca Ceresoli, Yann E. MORIN, Mahyar Koshkouei
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
Currently, we avoid applying our libtool patch to the host variant of
libtool. This is mostly historical.
However, this means that the host and target sources are not the same,
and this is an hindrance to out-of-tree build.
It turns out that we in fact can apply our hook. We just need to do like
for the target variant to avoid building the documentation.
However, that has a direct impact on the autotools package infra. When a
package is using libtool, and gets autoreconf-ed, the libtool-installed
ltmain.sh is copied to the package source tree. This lt-main.sh is what
our LIBTOOL_PATCH_HOOK hook would patch. But that lt-main.sh file is the
one that was already patched in, and installed by, the host-libtool
package.
So, we no longer need to apply the libtool patch to packages that get
autoreconf-ed, as they will automatically get the correct, patched
version now.
Note that for packages that we do not autoreconf, we still need to
use the libtool patch, as is currently done, to patch the lt-main.sh in
the package source
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
(cherry picked from commit 70fa1fb72eef8325263df640f7781710875f6ad3)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/libtool/libtool.mk | 1 -
package/pkg-autotools.mk | 4 ----
2 files changed, 5 deletions(-)
diff --git a/package/libtool/libtool.mk b/package/libtool/libtool.mk
index 45441e1e4676..98ca31d549a4 100644
--- a/package/libtool/libtool.mk
+++ b/package/libtool/libtool.mk
@@ -26,7 +26,6 @@ HOST_LIBTOOL_LICENSE = GPL-2.0+ (libtool), LGPL-2.1+ (libltdl)
HOST_LIBTOOL_LICENSE_FILES = COPYING $(LIBTOOL_SUBDIR)/COPYING.LIB
HOST_LIBTOOL_CONF_ENV = HELP2MAN=true MAKEINFO=true
-HOST_LIBTOOL_LIBTOOL_PATCH = NO
# We have a patch that affects libtool.m4, which triggers an autoreconf
# in the build step. Normally we would set AUTORECONF = YES, but this
diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
index 58b63317cb60..89894b9b6cfc 100644
--- a/package/pkg-autotools.mk
+++ b/package/pkg-autotools.mk
@@ -243,10 +243,6 @@ else
$(2)_AUTORECONF_ENV += AUTOPOINT=/bin/true
endif
$(2)_PRE_CONFIGURE_HOOKS += AUTORECONF_HOOK
-# default values are not evaluated yet, so don't rely on this defaulting to YES
-ifneq ($$($(2)_LIBTOOL_PATCH),NO)
-$(2)_PRE_CONFIGURE_HOOKS += LIBTOOL_PATCH_HOOK
-endif
$(2)_DEPENDENCIES += host-automake host-autoconf host-libtool
else # ! AUTORECONF = YES
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 16/23] package/{ffmpeg, libvpx}: use $(@D) instead of $(pkg_SRCDIR) when possible
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (14 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 15/23] package/libtool: also apply libtool-patch to host libtool Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 17/23] package/perl: apply the perl-cross even for the host variant Florian Fainelli via buildroot
` (6 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Eric Le Bihan, Jérôme Pouiller,
Florian Fainelli, Gary Bisson, Romain Naour, Bernd Kuhls,
Thomas Perale, Maxime Chevallier, Refik Tuzakli, Francois Perrad,
Thomas Petazzoni, Arnout Vandecappelle, Petr Vorel,
Spenser Gilliland, Giulio Benetti, Pascal de Bruijn,
Luca Ceresoli, Yann E. MORIN, Mahyar Koshkouei
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
$(@D) points to the package build directory, i.e
$(O)/build/<name>-<version>/. $(pkg_SRCDIR) is identical, except when
$(pkg_SUBDIR) is used, in which case $(pkg_SRCDIR) is
$(O)/build/<name>-<version>/$(pkg_SUBDIR).
When possible use $(@D), like we're doing in all packages. This will
facilitate future changes in the package infrastructure.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
(cherry picked from commit b1791fe7c10bc312328926b45108553dbc674254)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/ffmpeg/ffmpeg.mk | 2 +-
package/libvpx/libvpx.mk | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/package/ffmpeg/ffmpeg.mk b/package/ffmpeg/ffmpeg.mk
index 4ce129132d9e..a6815c15b6d1 100644
--- a/package/ffmpeg/ffmpeg.mk
+++ b/package/ffmpeg/ffmpeg.mk
@@ -604,7 +604,7 @@ FFMPEG_CONF_OPTS += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF))
# Override FFMPEG_CONFIGURE_CMDS: FFmpeg does not support --target and others
define FFMPEG_CONFIGURE_CMDS
- (cd $(FFMPEG_SRCDIR) && rm -rf config.cache && \
+ (cd $(@D) && rm -rf config.cache && \
$(TARGET_CONFIGURE_OPTS) \
$(TARGET_CONFIGURE_ARGS) \
$(FFMPEG_CONF_ENV) \
diff --git a/package/libvpx/libvpx.mk b/package/libvpx/libvpx.mk
index d6b84ffec37f..2523e7ca9931 100644
--- a/package/libvpx/libvpx.mk
+++ b/package/libvpx/libvpx.mk
@@ -30,7 +30,7 @@ endif
# This is not a true autotools package. It is based on the ffmpeg build system
define LIBVPX_CONFIGURE_CMDS
- (cd $(LIBVPX_SRCDIR) && rm -rf config.cache && \
+ (cd $(@D) && rm -rf config.cache && \
$(TARGET_CONFIGURE_OPTS) \
$(TARGET_CONFIGURE_ARGS) \
$(LIBVPX_CONF_ENV) \
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 17/23] package/perl: apply the perl-cross even for the host variant
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (15 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 16/23] package/{ffmpeg, libvpx}: use $(@D) instead of $(pkg_SRCDIR) when possible Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 18/23] infra/autotools: warn for package that autoreconf without libtool patch Florian Fainelli via buildroot
` (5 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Gary Bisson, Thomas Petazzoni, Petr Vorel, Spenser Gilliland,
Florian Fainelli, Maxime Chevallier, Francois Perrad,
Arnout Vandecappelle, Luca Ceresoli, Thomas Perale, Eric Le Bihan,
Mahyar Koshkouei, Yann E. MORIN, Francois Perrad, Giulio Benetti,
Pascal de Bruijn, Thomas Petazzoni, Jérôme Pouiller,
Bernd Kuhls, Refik Tuzakli, Romain Naour
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
Currently, ther host and target variants have diffeerent source tree,
because the target variant extracts perl-cross, while the host variant
does not.
This goes against having a single source tree for both, to ease
out-of-tree builds.
However, extracting the perl-cross archive has no impact of the standard
build; it only ever adds new files that are not used by the original,
native-only buildsystem.
So, we can extrat perl-cross for the host variant as well, by re-using
the same hook. We also need to apply the config.{sub,guess} hook.
Now that both variants extract perl-cross, the patch for perl-cross does
not need to be applied by a target-only hook anymore: move it back to
the package patch directory, so that it is applied for both variants, and
drop the PERL_POST_PATCH_HOOKS hook introduced for it. This reverts
8dea6e7c089c ("package/perl: apply perl-cross patch only on target perl").
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Francois Perrad <francois.perrad@gadz.org>
cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
(cherry picked from commit d2ad97e0eeff39fc89a58b589f19094824402756)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
...01-configure-keep-_GNU_SOURCE-in-build-flags.patch | 0
package/perl/perl.mk | 11 ++---------
2 files changed, 2 insertions(+), 9 deletions(-)
rename package/perl/{perl-cross => }/0001-configure-keep-_GNU_SOURCE-in-build-flags.patch (100%)
diff --git a/package/perl/perl-cross/0001-configure-keep-_GNU_SOURCE-in-build-flags.patch b/package/perl/0001-configure-keep-_GNU_SOURCE-in-build-flags.patch
similarity index 100%
rename from package/perl/perl-cross/0001-configure-keep-_GNU_SOURCE-in-build-flags.patch
rename to package/perl/0001-configure-keep-_GNU_SOURCE-in-build-flags.patch
diff --git a/package/perl/perl.mk b/package/perl/perl.mk
index 43820cfcc33a..0892299ed00a 100644
--- a/package/perl/perl.mk
+++ b/package/perl/perl.mk
@@ -31,21 +31,14 @@ define PERL_CROSS_EXTRACT
mv $(@D)/cnf/diffs/perl5-5.42.0 $(@D)/cnf/diffs/perl5-5.42.3
endef
PERL_POST_EXTRACT_HOOKS += PERL_CROSS_EXTRACT
-
-# We need to patch perl-cross, but perl-cross is extracted over the
-# target perl sources only (and not the host variant). So we apply the
-# patch only for the target case using a post patch hook.
-define PERL_CROSS_PATCH
- $(APPLY_PATCHES) $(@D) $(PERL_PKGDIR)/perl-cross \
- 0001-configure-keep-_GNU_SOURCE-in-build-flags.patch
-endef
-PERL_POST_PATCH_HOOKS += PERL_CROSS_PATCH
+HOST_PERL_POST_EXTRACT_HOOKS += PERL_CROSS_EXTRACT
# Even though perl is not an autotools-package, it uses config.sub and
# config.guess. Up-to-date versions of these files may be needed to build perl
# on newer host architectures, so we borrow the hook which updates them from the
# autotools infrastructure.
PERL_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK
+HOST_PERL_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK
ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
PERL_DEPENDENCIES += berkeleydb
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 18/23] infra/autotools: warn for package that autoreconf without libtool patch
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (16 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 17/23] package/perl: apply the perl-cross even for the host variant Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 19/23] packages: replace $(PKG)_DIR with @D where possible Florian Fainelli via buildroot
` (4 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Eric Le Bihan, Jérôme Pouiller,
Florian Fainelli, Gary Bisson, Romain Naour, Bernd Kuhls,
Thomas Perale, Maxime Chevallier, Refik Tuzakli, Francois Perrad,
Thomas Petazzoni, Arnout Vandecappelle, Petr Vorel,
Spenser Gilliland, Giulio Benetti, Pascal de Bruijn,
Luca Ceresoli, Yann E. MORIN, Mahyar Koshkouei
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
The libtool patch is now implicit because it gets installed for any
package that gets autoreconf-ed, so refusing the libtool patch in that
case is moot anyway.
Error out when this is the case.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
(cherry picked from commit 59aeba1caa1dba75962726904fe712aa6c3e9146)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/pkg-autotools.mk | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
index 89894b9b6cfc..8e1b1b6d40a4 100644
--- a/package/pkg-autotools.mk
+++ b/package/pkg-autotools.mk
@@ -120,6 +120,10 @@ endef
define inner-autotools-package
+ifeq ($$($(2)_AUTORECONF)-$$($(2)_LIBTOOL_PATCH),YES-NO)
+$$(error $(1) must be autoreconf-ed, but refuses the libtool patch)
+endif
+
ifndef $(2)_LIBTOOL_PATCH
ifdef $(3)_LIBTOOL_PATCH
$(2)_LIBTOOL_PATCH = $$($(3)_LIBTOOL_PATCH)
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 19/23] packages: replace $(PKG)_DIR with @D where possible
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (17 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 18/23] infra/autotools: warn for package that autoreconf without libtool patch Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 20/23] linux: support custom logo and devicetree files in out-of-tree builds Florian Fainelli via buildroot
` (3 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Eric Le Bihan, Jérôme Pouiller,
Florian Fainelli, Gary Bisson, Romain Naour, Bernd Kuhls,
Thomas Perale, Maxime Chevallier, Refik Tuzakli, Francois Perrad,
Thomas Petazzoni, Arnout Vandecappelle, Petr Vorel,
Spenser Gilliland, Giulio Benetti, Pascal de Bruijn,
Luca Ceresoli, Yann E. MORIN, Mahyar Koshkouei
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
Currently, packages that use $(FOO_DIR) (with FOO as the package name)
expect it to be unspecifically either the source or build directory,
with some packages even expecting that it is both. Because it currently
is both.
But when we introduce out-of-tree build and shared host-target source
trees, FOO_DIR will no longer exist, because it can no longer be both.
So, In preparation of that, replace all occurences of $(FOO_DIR) with
@(@D) which is always the dorectory that is the destination of the
current rule.
Note that in some cases, $(@D) is used as the source of a copy or a sed,
and expected to be from the source directory. This will have to be
carefully identified when source and build dirs are separated.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[yann.morin.1998@free.fr:
- reabse on master, convert new packages, drop old ones
- add a commit log
]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
(cherry picked from commit a7e38cf17ada495c3abc1f9bbb377c883a9b4c5a)
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/linux-backports/linux-backports.mk | 2 +-
package/ncftp/ncftp.mk | 2 +-
package/pciutils/pciutils.mk | 2 +-
package/php/php.mk | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/package/linux-backports/linux-backports.mk b/package/linux-backports/linux-backports.mk
index 8513a84487a8..e14cd4a1706b 100644
--- a/package/linux-backports/linux-backports.mk
+++ b/package/linux-backports/linux-backports.mk
@@ -33,7 +33,7 @@ LINUX_BACKPORTS_DEPENDENCIES = \
$(BR2_FLEX_HOST_DEPENDENCY)
ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG),y)
-LINUX_BACKPORTS_KCONFIG_FILE = $(LINUX_BACKPORTS_DIR)/defconfigs/$(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_DEFCONFIG))
+LINUX_BACKPORTS_KCONFIG_FILE = $(LINUX_BACKPORTS_SRCDIR)/defconfigs/$(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_DEFCONFIG))
else ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG),y)
LINUX_BACKPORTS_KCONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE))
endif
diff --git a/package/ncftp/ncftp.mk b/package/ncftp/ncftp.mk
index 4075449c53e1..1f33270adb92 100644
--- a/package/ncftp/ncftp.mk
+++ b/package/ncftp/ncftp.mk
@@ -37,7 +37,7 @@ NCFTP_DEPENDENCIES += ncurses
endif
define NCFTP_INSTALL_TARGET_CMDS
- $(INSTALL) -m 0755 $(addprefix $(NCFTP_DIR)/bin/, $(NCFTP_TARGET_BINS)) $(TARGET_DIR)/usr/bin
+ $(INSTALL) -m 0755 $(addprefix $(@D)/bin/, $(NCFTP_TARGET_BINS)) $(TARGET_DIR)/usr/bin
$(NCFTP_INSTALL_NCFTP_BATCH)
endef
diff --git a/package/pciutils/pciutils.mk b/package/pciutils/pciutils.mk
index ad32713d579f..52f92db78505 100644
--- a/package/pciutils/pciutils.mk
+++ b/package/pciutils/pciutils.mk
@@ -46,7 +46,7 @@ PCIUTILS_MAKE_OPTS += SHARED=yes
endif
define PCIUTILS_CONFIGURE_CMDS
- $(SED) 's/wget --no-timestamping/wget/' $(PCIUTILS_DIR)/update-pciids.sh
+ $(SED) 's/wget --no-timestamping/wget/' $(@D)/update-pciids.sh
endef
define PCIUTILS_BUILD_CMDS
diff --git a/package/php/php.mk b/package/php/php.mk
index 1bb25d086370..1dd979d7a2a4 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -343,7 +343,7 @@ PHP_POST_INSTALL_TARGET_HOOKS += PHP_EXTENSIONS_FIXUP
define PHP_INSTALL_FIXUP
rm -rf $(TARGET_DIR)/usr/lib/php/build
rm -f $(TARGET_DIR)/usr/bin/phpize
- $(INSTALL) -D -m 0755 $(PHP_DIR)/php.ini-production \
+ $(INSTALL) -D -m 0755 $(@D)/php.ini-production \
$(TARGET_DIR)/etc/php.ini
$(SED) 's%;date.timezone =.*%date.timezone = $(PHP_LOCALTIME)%' \
$(TARGET_DIR)/etc/php.ini
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 20/23] linux: support custom logo and devicetree files in out-of-tree builds
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (18 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 19/23] packages: replace $(PKG)_DIR with @D where possible Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 21/23] package/linux-tools: support an out-of-tree kernel build Florian Fainelli via buildroot
` (2 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Eric Le Bihan, Gary Bisson, Jérôme Pouiller,
Florian Fainelli, Bernd Kuhls, Thomas Perale, Maxime Chevallier,
Refik Tuzakli, Francois Perrad, Thomas Petazzoni,
Arnout Vandecappelle, Petr Vorel, Spenser Gilliland,
Giulio Benetti, Pascal de Bruijn, Luca Ceresoli, Romain Naour,
Mahyar Koshkouei
A custom logo and custom devicetree files are added to the kernel
sources, which must not be done in a source directory we do not own.
When either is configured for an out-of-tree build, build from a shadow
of the source directory instead: a tree of real directories containing
symlinks to the files (support/scripts/symlink-tree), where files can
be replaced or added without touching the original. Packages opt in by
setting <pkg>_OUT_OF_TREE_SRCDIR.
Custom files are copied with --remove-destination so that a symlink is
replaced rather than written through.
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
linux/linux.mk | 34 ++++++++++++++++-----
package/pkg-generic.mk | 5 +++-
support/scripts/symlink-tree | 58 ++++++++++++++++++++++++++++++++++++
3 files changed, 89 insertions(+), 8 deletions(-)
create mode 100755 support/scripts/symlink-tree
diff --git a/linux/linux.mk b/linux/linux.mk
index 5734d78aa9a2..37d143742435 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -227,7 +227,7 @@ LINUX_DTSO_NAMES += $(basename $(LINUX_DTSO_LIST))
define LINUX_COPY_CUSTOM_DTS_FILES
$(foreach d, $(LINUX_KERNEL_CUSTOM_DTS_DIR), \
@$(call MESSAGE,"Copying devicetree overlay $(d)")$(sep) \
- $(Q)$(call SYSTEM_RSYNC,$(d),$(LINUX_ARCH_PATH)/boot/dts/)$(sep))
+ $(Q)$(call SYSTEM_RSYNC,$(d),$(LINUX_SRC_ARCH_PATH)/boot/dts/)$(sep))
endef
endif
@@ -291,14 +291,18 @@ endif
# for bzImage, arch/i386 and arch/x86_64 do not exist when copying the
# defconfig file.
ifeq ($(KERNEL_ARCH),i386)
-LINUX_ARCH_PATH = $(LINUX_DIR)/arch/x86
+LINUX_ARCH_SUBDIR = arch/x86
else ifeq ($(KERNEL_ARCH),x86_64)
-LINUX_ARCH_PATH = $(LINUX_DIR)/arch/x86
+LINUX_ARCH_SUBDIR = arch/x86
else ifeq ($(KERNEL_ARCH),sparc64)
-LINUX_ARCH_PATH = $(LINUX_DIR)/arch/sparc
+LINUX_ARCH_SUBDIR = arch/sparc
else
-LINUX_ARCH_PATH = $(LINUX_DIR)/arch/$(KERNEL_ARCH)
+LINUX_ARCH_SUBDIR = arch/$(KERNEL_ARCH)
endif
+# Build products (images, dtbs) are in the build directory, but the sources
+# of the kernel, to which custom files are added, may be elsewhere.
+LINUX_ARCH_PATH = $(LINUX_DIR)/$(LINUX_ARCH_SUBDIR)
+LINUX_SRC_ARCH_PATH = $(LINUX_SRCDIR)/$(LINUX_ARCH_SUBDIR)
ifeq ($(BR2_LINUX_KERNEL_VMLINUX),y)
LINUX_IMAGE_PATH = $(LINUX_DIR)/$(LINUX_IMAGE_NAME)
@@ -356,13 +360,29 @@ LINUX_KERNEL_CUSTOM_LOGO_PATH = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_LOGO_PAT
ifneq ($(LINUX_KERNEL_CUSTOM_LOGO_PATH),)
LINUX_DEPENDENCIES += host-imagemagick
define LINUX_KERNEL_CUSTOM_LOGO_CONVERT
+ rm -f $(LINUX_SRCDIR)/drivers/video/logo/logo_linux_clut224.ppm
$(HOST_DIR)/bin/convert $(LINUX_KERNEL_CUSTOM_LOGO_PATH) \
-dither None -colors 224 -compress none \
- $(LINUX_DIR)/drivers/video/logo/logo_linux_clut224.ppm
+ $(LINUX_SRCDIR)/drivers/video/logo/logo_linux_clut224.ppm
endef
LINUX_PRE_BUILD_HOOKS += LINUX_KERNEL_CUSTOM_LOGO_CONVERT
endif
+# A custom logo or custom devicetree files are added to the kernel sources,
+# which we must not do in a source directory we do not own. In an out-of-tree
+# build, use a shadow of that directory instead: a tree of real directories
+# containing symlinks to the files, so that those can be replaced or added.
+ifneq ($(LINUX_OVERRIDE_SRCDIR),)
+ifneq ($(LINUX_KERNEL_CUSTOM_LOGO_PATH)$(LINUX_KERNEL_CUSTOM_DTS_DIR)$(LINUX_CUSTOM_DTS_PATH),)
+LINUX_OUT_OF_TREE_SRCDIR = $(BUILD_DIR)/linux-custom-src
+define LINUX_SHADOW_SRCDIR
+ @$(call MESSAGE,"Shadowing $(LINUX_OVERRIDE_SRCDIR) for custom files")
+ support/scripts/symlink-tree -F -l .git $(call qstrip,$(LINUX_OVERRIDE_SRCDIR)) $(LINUX_OUT_OF_TREE_SRCDIR)
+endef
+LINUX_PRE_RSYNC_HOOKS += LINUX_SHADOW_SRCDIR
+endif
+endif
+
ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y)
LINUX_KCONFIG_DEFCONFIG = $(call qstrip,$(BR2_LINUX_KERNEL_DEFCONFIG))_defconfig
else ifeq ($(BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG),y)
@@ -561,7 +581,7 @@ endif
define LINUX_BUILD_CMDS
$(call KCONFIG_DISABLE_OPT,CONFIG_GCC_PLUGINS)
$(foreach dts,$(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH)), \
- cp -f $(dts) $(LINUX_ARCH_PATH)/boot/dts/
+ cp -f --remove-destination $(dts) $(LINUX_SRC_ARCH_PATH)/boot/dts/
)
$(LINUX_COPY_CUSTOM_DTS_FILES)
$(LINUX_MAKE_ENV) $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) all
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index b9808bb624f7..14378deacd35 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -581,7 +581,10 @@ ifeq ($$($(3)_SUPPORTS_OUT_OF_TREE),YES)
$(2)_OUT_OF_TREE = YES
$(2)_SRCDIR = $$(SRC_DIR)/$$($(2)_BASENAME)
ifneq ($$($(2)_OVERRIDE_SRCDIR),)
-$(2)_SRCDIR = $$(abspath $$(call qstrip,$$($(2)_OVERRIDE_SRCDIR)))
+# A package may need to add files to its sources, which must not be done in
+# the overridden directory: it can then set <pkg>_OUT_OF_TREE_SRCDIR to
+# a shadow of the sources (see support/scripts/symlink-tree).
+$(2)_SRCDIR = $$(or $$($(3)_OUT_OF_TREE_SRCDIR),$$(abspath $$(call qstrip,$$($(2)_OVERRIDE_SRCDIR))))
$(2)_STAMP_SRCDIR = $$($(2)_BUILDDIR)
endif
endif
diff --git a/support/scripts/symlink-tree b/support/scripts/symlink-tree
new file mode 100755
index 000000000000..6c51022dddad
--- /dev/null
+++ b/support/scripts/symlink-tree
@@ -0,0 +1,58 @@
+#!/usr/bin/env bash
+
+# Create a "shadow" of a source tree: a tree of real directories whose
+# files are symlinks to the files of the original tree. Files can then be
+# added to, or replaced in, the shadow, and objects can be built inside it,
+# without ever modifying the original tree.
+#
+# Usage: symlink-tree [-F] [-f NAME]... [-l NAME]... SRC DST
+#
+# -F shadow every top-level entry of SRC (default: a single symlink
+# for each top-level entry)
+# -f NAME shadow the top-level directory NAME
+# -l NAME only symlink the top-level entry NAME, even with -F
+#
+# DST is wiped and re-created.
+
+set -e
+
+all=false
+farm=" "
+link=" "
+while getopts "Ff:l:" opt; do
+ case "${opt}" in
+ F) all=true ;;
+ f) farm="${farm}${OPTARG} " ;;
+ l) link="${link}${OPTARG} " ;;
+ *) exit 1 ;;
+ esac
+done
+shift $((OPTIND - 1))
+[ $# -eq 2 ] || { echo "usage: ${0##*/} [-F] [-f NAME]... [-l NAME]... SRC DST" >&2; exit 1; }
+
+src="$(readlink -f "${1}")"
+dst="${2}"
+
+# Refuse to wipe anything that does not look like a previous shadow, or
+# that could be (part of) the source tree.
+dst_abs="$(readlink -m "${dst}")"
+case "${src}/" in
+"${dst_abs}"/*) echo "${0##*/}: ${dst} contains the source tree" >&2; exit 1 ;;
+esac
+case "${dst_abs}/" in
+"${src}"/*) echo "${0##*/}: ${dst} is inside the source tree" >&2; exit 1 ;;
+esac
+
+rm -rf "${dst}"
+mkdir -p "${dst}"
+
+for path in "${src}"/* "${src}"/.[!.]* "${src}"/..?*; do
+ [ -e "${path}" ] || [ -L "${path}" ] || continue
+ name="${path##*/}"
+ if [ -d "${path}" ] && [ ! -L "${path}" ] && [[ "${link}" != *" ${name} "* ]] &&
+ { ${all} || [[ "${farm}" == *" ${name} "* ]]; }; then
+ cp -rs "${path}" "${dst}/"
+ else
+ ln -s "${path}" "${dst}/${name}"
+ fi
+done
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 21/23] package/linux-tools: support an out-of-tree kernel build
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (19 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 20/23] linux: support custom logo and devicetree files in out-of-tree builds Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 22/23] package: read kernel headers from LINUX_SRCDIR Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 23/23] docs/manual: document out-of-tree package builds and the new srcdir variables Florian Fainelli via buildroot
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Eric Le Bihan, Gary Bisson, Jérôme Pouiller,
Florian Fainelli, Bernd Kuhls, Thomas Perale, Maxime Chevallier,
Refik Tuzakli, Francois Perrad, Thomas Petazzoni,
Arnout Vandecappelle, Petr Vorel, Spenser Gilliland,
Giulio Benetti, Pascal de Bruijn, Luca Ceresoli, Romain Naour,
Mahyar Koshkouei
The kernel build directory no longer contains the kernel sources, so:
- check which tools the kernel provides against $(LINUX_SRCDIR)/tools
rather than $(LINUX_DIR)/tools;
- build the tools, which build in-tree, in a shadow of the kernel
sources so that the original sources are not modified. When the kernel
is built in-tree, nothing changes.
Also: stop python from writing bytecode next to the real perf scripts,
and make the selftests find the headers installed in the kernel build
directory, which fixes a cold-build failure. The host-built net ynl
selftests are excluded from the target architecture check.
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/linux-tools/linux-tool-cpupower.mk.in | 8 +++---
package/linux-tools/linux-tool-gpio.mk.in | 6 ++---
package/linux-tools/linux-tool-hv.mk.in | 6 ++---
package/linux-tools/linux-tool-iio.mk.in | 6 ++---
package/linux-tools/linux-tool-mm.mk.in | 10 +++----
package/linux-tools/linux-tool-pci.mk.in | 12 +++++----
package/linux-tools/linux-tool-perf.mk.in | 27 +++++++++++--------
package/linux-tools/linux-tool-rtla.mk.in | 10 +++----
.../linux-tools/linux-tool-selftests.mk.in | 15 ++++++-----
package/linux-tools/linux-tool-tmon.mk.in | 8 +++---
package/linux-tools/linux-tool-usbtools.mk.in | 6 ++---
package/linux-tools/linux-tools.mk | 20 +++++++++++++-
12 files changed, 81 insertions(+), 53 deletions(-)
diff --git a/package/linux-tools/linux-tool-cpupower.mk.in b/package/linux-tools/linux-tool-cpupower.mk.in
index 2a2d3e01dd5a..aca57ff02bcb 100644
--- a/package/linux-tools/linux-tool-cpupower.mk.in
+++ b/package/linux-tools/linux-tool-cpupower.mk.in
@@ -15,26 +15,26 @@ CPUPOWER_MAKE_OPTS = CROSS=$(TARGET_CROSS) \
DEBUG=false
define CPUPOWER_BUILD_CMDS
- $(Q)if test ! -f $(LINUX_DIR)/tools/power/cpupower/Makefile ; then \
+ $(Q)if test ! -f $(LINUX_TOOLS_KSRC)/power/cpupower/Makefile ; then \
echo "Your kernel version is too old and does not have the cpupower tool." ; \
echo "At least kernel 3.4 must be used." ; \
exit 1 ; \
fi
- $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_TOOLS_KDIR)/tools \
$(CPUPOWER_MAKE_OPTS) \
cpupower
endef
define CPUPOWER_INSTALL_STAGING_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_TOOLS_KDIR)/tools \
$(CPUPOWER_MAKE_OPTS) \
DESTDIR=$(STAGING_DIR) \
cpupower_install
endef
define CPUPOWER_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_TOOLS_KDIR)/tools \
$(CPUPOWER_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) \
cpupower_install
diff --git a/package/linux-tools/linux-tool-gpio.mk.in b/package/linux-tools/linux-tool-gpio.mk.in
index e825db1b1127..32e3343fc1aa 100644
--- a/package/linux-tools/linux-tool-gpio.mk.in
+++ b/package/linux-tools/linux-tool-gpio.mk.in
@@ -9,19 +9,19 @@ LINUX_TOOLS += gpio
GPIO_MAKE_OPTS = $(LINUX_MAKE_FLAGS) LDFLAGS="$(TARGET_LDFLAGS)"
define GPIO_BUILD_CMDS
- $(Q)if ! grep install $(LINUX_DIR)/tools/gpio/Makefile >/dev/null 2>&1 ; then \
+ $(Q)if ! grep install $(LINUX_TOOLS_KSRC)/gpio/Makefile >/dev/null 2>&1 ; then \
echo "Your kernel version is too old and does not have the gpio tools." ; \
echo "At least kernel 4.8 must be used." ; \
exit 1 ; \
fi
- $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools \
+ $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_TOOLS_KDIR)/tools \
$(GPIO_MAKE_OPTS) \
gpio
endef
define GPIO_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools \
+ $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_TOOLS_KDIR)/tools \
$(GPIO_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) \
gpio_install
diff --git a/package/linux-tools/linux-tool-hv.mk.in b/package/linux-tools/linux-tool-hv.mk.in
index e638fecfc63e..73c20e3ed542 100644
--- a/package/linux-tools/linux-tool-hv.mk.in
+++ b/package/linux-tools/linux-tool-hv.mk.in
@@ -20,13 +20,13 @@ HV_MAKE_OPTS = CC="$(TARGET_CC)" CFLAGS="$(filter-out -g%,$(TARGET_CFLAGS))"
define HV_BUILD_CMDS
$(Q)for prog in $(HV_PROGS_y); do \
- if test ! -f $(LINUX_DIR)/tools/hv/$${prog}.c ; then \
+ if test ! -f $(LINUX_TOOLS_KSRC)/hv/$${prog}.c ; then \
printf "Your kernel version is too old and does not have the HyperV %s tool." "$${prog}" ; \
exit 1 ; \
fi; \
done
- $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/hv \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_TOOLS_KDIR)/tools/hv \
$(HV_MAKE_OPTS) \
$(HV_PROGS_y)
endef
@@ -40,7 +40,7 @@ endif
define HV_INSTALL_TARGET_CMDS
$(foreach prog,$(HV_PROGS_y), \
- $(INSTALL) -m 0755 -D $(LINUX_DIR)/tools/hv/$(prog) \
+ $(INSTALL) -m 0755 -D $(LINUX_TOOLS_KDIR)/tools/hv/$(prog) \
$(TARGET_DIR)/usr/sbin/$(HV_$(prog))
)
$(HV_KVP_HELPER)
diff --git a/package/linux-tools/linux-tool-iio.mk.in b/package/linux-tools/linux-tool-iio.mk.in
index 27ab0ed7ed63..b975a548e473 100644
--- a/package/linux-tools/linux-tool-iio.mk.in
+++ b/package/linux-tools/linux-tool-iio.mk.in
@@ -9,19 +9,19 @@ LINUX_TOOLS += iio
IIO_MAKE_OPTS = $(LINUX_MAKE_FLAGS) LDFLAGS="$(TARGET_LDFLAGS)"
define IIO_BUILD_CMDS
- $(Q)if ! grep install $(LINUX_DIR)/tools/iio/Makefile >/dev/null 2>&1 ; then \
+ $(Q)if ! grep install $(LINUX_TOOLS_KSRC)/iio/Makefile >/dev/null 2>&1 ; then \
echo "Your kernel version is too old and does not have install section in the iio tools." ; \
echo "At least kernel 4.7 must be used." ; \
exit 1 ; \
fi
- $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/iio \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_TOOLS_KDIR)/tools/iio \
$(IIO_MAKE_OPTS)
endef
# DESTDIR used since kernel version 4.14
define IIO_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/iio \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_TOOLS_KDIR)/tools/iio \
$(IIO_MAKE_OPTS) \
INSTALL_ROOT=$(TARGET_DIR) \
DESTDIR=$(TARGET_DIR) \
diff --git a/package/linux-tools/linux-tool-mm.mk.in b/package/linux-tools/linux-tool-mm.mk.in
index b2ec090fc086..703d3681ae43 100644
--- a/package/linux-tools/linux-tool-mm.mk.in
+++ b/package/linux-tools/linux-tool-mm.mk.in
@@ -7,16 +7,16 @@
LINUX_TOOLS += mm
define MM_BUILD_CMDS
- $(Q)if test -f $(LINUX_DIR)/tools/vm/Makefile ; then \
+ $(Q)if test -f $(LINUX_TOOLS_KSRC)/vm/Makefile ; then \
MM_SUBDIR=vm; \
- elif test -f $(LINUX_DIR)/tools/mm/Makefile ; then \
+ elif test -f $(LINUX_TOOLS_KSRC)/mm/Makefile ; then \
MM_SUBDIR=mm; \
else \
echo "Your kernel version is too old and does not have the mm tool." ; \
echo "At least kernel 3.4 must be used." ; \
exit 1 ; \
fi ; \
- $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR)/tools \
+ $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_TOOLS_KDIR)/tools \
$(MM_MAKE_OPTS) $${MM_SUBDIR}
endef
@@ -24,12 +24,12 @@ endef
# exists, because that was checked at build time already; we just
# need to find which of the two: if not one, then the other.
define MM_INSTALL_TARGET_CMDS
- $(Q)if test -f $(LINUX_DIR)/tools/vm/Makefile ; then \
+ $(Q)if test -f $(LINUX_TOOLS_KSRC)/vm/Makefile ; then \
MM_SUBDIR=vm; \
else \
MM_SUBDIR=mm; \
fi ; \
- $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_TOOLS_KDIR)/tools \
$(LINUX_MAKE_FLAGS) \
INSTALL_ROOT=$(TARGET_DIR) \
DESTDIR=$(TARGET_DIR) \
diff --git a/package/linux-tools/linux-tool-pci.mk.in b/package/linux-tools/linux-tool-pci.mk.in
index 52d7639bb102..a6f6ef265643 100644
--- a/package/linux-tools/linux-tool-pci.mk.in
+++ b/package/linux-tools/linux-tool-pci.mk.in
@@ -7,11 +7,13 @@
LINUX_TOOLS += pci
# Linux 6.14 moved the PCI endpoint tests into Kselftests.
-PCI_SRCDIR = $(strip $(if $(wildcard $(LINUX_DIR)/tools/testing/selftests/pci_endpoint/Makefile),\
- $(LINUX_DIR)/tools/testing/selftests/pci_endpoint,$(LINUX_DIR)/tools/pci))
+PCI_SUBDIR = $(strip $(if $(wildcard $(LINUX_TOOLS_KSRC)/testing/selftests/pci_endpoint/Makefile),\
+ testing/selftests/pci_endpoint,pci))
+PCI_SRCDIR = $(LINUX_TOOLS_KSRC)/$(PCI_SUBDIR)
+PCI_BUILDDIR = $(LINUX_TOOLS_KDIR)/tools/$(PCI_SUBDIR)
PCI_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
- OUTPUT=$(PCI_SRCDIR)/ \
+ OUTPUT=$(PCI_BUILDDIR)/ \
LDFLAGS="$(TARGET_LDFLAGS)" \
LDLIBS="-lrt -lm"
@@ -22,12 +24,12 @@ define PCI_BUILD_CMDS
exit 1 ; \
fi
- $(TARGET_MAKE_ENV) $(MAKE) -C $(PCI_SRCDIR) \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(PCI_BUILDDIR) \
$(PCI_MAKE_OPTS)
endef
define PCI_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) -C $(PCI_SRCDIR) \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(PCI_BUILDDIR) \
$(PCI_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) \
INSTALL_PATH=$(TARGET_DIR)/usr/lib/kselftests/pci_endpoint \
diff --git a/package/linux-tools/linux-tool-perf.mk.in b/package/linux-tools/linux-tool-perf.mk.in
index 3271fd5683eb..348eb1a4240f 100644
--- a/package/linux-tools/linux-tool-perf.mk.in
+++ b/package/linux-tools/linux-tool-perf.mk.in
@@ -18,6 +18,11 @@ else
PERF_ARCH=$(NORMALIZED_ARCH)
endif
+# The python scripts run by the perf build are run through symlinks when
+# building out of tree: do not let python write its bytecode next to the
+# real script, in the kernel sources.
+PERF_MAKE_ENV = PYTHONDONTWRITEBYTECODE=1
+
PERF_MAKE_FLAGS = \
$(LINUX_MAKE_FLAGS) \
JOBS=$(PARALLEL_JOBS) \
@@ -147,25 +152,25 @@ endif
# For a POST_PATCH hook, tools/perf/Documentation/Makefile is not
# guaranteed to exist yet.
define PERF_DISABLE_DOCUMENTATION
- if [ -f $(LINUX_DIR)/tools/perf/Documentation/Makefile ]; then \
- printf "%%:\n\t@:\n" >$(LINUX_DIR)/tools/perf/Documentation/GNUmakefile; \
+ if [ -f $(LINUX_TOOLS_KDIR)/tools/perf/Documentation/Makefile ]; then \
+ printf "%%:\n\t@:\n" >$(LINUX_TOOLS_KDIR)/tools/perf/Documentation/GNUmakefile; \
fi
endef
LINUX_TOOLS_PRE_CONFIGURE_HOOKS += PERF_DISABLE_DOCUMENTATION
# O must be redefined here to overwrite the one used by Buildroot for
-# out of tree build. We build perf in $(LINUX_DIR)/tools/perf/ and not just
+# out of tree build. We build perf in $(LINUX_TOOLS_KDIR)/tools/perf/ and not just
# $(LINUX_DIR) so that it isn't built in the root directory of the kernel
# sources.
define PERF_BUILD_CMDS
- $(Q)if test ! -f $(LINUX_DIR)/tools/perf/Makefile ; then \
+ $(Q)if test ! -f $(LINUX_TOOLS_KSRC)/perf/Makefile ; then \
echo "Your kernel version is too old and does not have the perf tool." ; \
echo "At least kernel 2.6.31 must be used." ; \
exit 1 ; \
fi
$(Q)if test "$(BR2_PACKAGE_ELFUTILS)" = "" ; then \
- if ! grep -q NO_LIBELF $(LINUX_DIR)/tools/perf/Makefile* ; then \
- if ! test -r $(LINUX_DIR)/tools/perf/config/Makefile ; then \
+ if ! grep -q NO_LIBELF $(LINUX_TOOLS_KSRC)/perf/Makefile* ; then \
+ if ! test -r $(LINUX_TOOLS_KSRC)/perf/config/Makefile ; then \
echo "The perf tool in your kernel cannot be built without libelf." ; \
echo "Either upgrade your kernel to >= 3.7, or enable the elfutils package." ; \
exit 1 ; \
@@ -173,14 +178,14 @@ define PERF_BUILD_CMDS
fi \
fi
$(Q)if test "$(BR2_PACKAGE_LINUX_TOOLS_PERF_TUI)" = "y" ; then \
- if ! grep -q NO_SLANG $(LINUX_DIR)/tools/perf/Makefile* ; then \
+ if ! grep -q NO_SLANG $(LINUX_TOOLS_KSRC)/perf/Makefile* ; then \
echo "The perf tool in your kernel cannot be build with the TUI." ; \
echo "Either upgrade your kernel to >= 3.10, or disable the TUI." ; \
exit 1 ; \
fi \
fi
- $(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
- -C $(LINUX_DIR)/tools/perf O=$(LINUX_DIR)/tools/perf/
+ $(TARGET_MAKE_ENV) $(PERF_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
+ -C $(LINUX_TOOLS_KDIR)/tools/perf O=$(LINUX_TOOLS_KDIR)/tools/perf/
endef
# After installation, we remove the Perl and Python scripts from the
@@ -196,8 +201,8 @@ LINUX_TOOLS_BIN_ARCH_EXCLUDE += \
endif
define PERF_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
- -C $(LINUX_DIR)/tools/perf O=$(LINUX_DIR)/tools/perf/ install
+ $(TARGET_MAKE_ENV) $(PERF_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
+ -C $(LINUX_TOOLS_KDIR)/tools/perf O=$(LINUX_TOOLS_KDIR)/tools/perf/ install
$(PERF_INSTALL_REMOVE_SCRIPTS)
endef
diff --git a/package/linux-tools/linux-tool-rtla.mk.in b/package/linux-tools/linux-tool-rtla.mk.in
index d9bdcc3016e7..aef4343010c8 100644
--- a/package/linux-tools/linux-tool-rtla.mk.in
+++ b/package/linux-tools/linux-tool-rtla.mk.in
@@ -16,7 +16,7 @@ RTLA_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
define RTLA_DISABLE_STACK_PROTECTOR
- $(SED) 's/-fstack-protector.* //' $(LINUX_DIR)/tools/tracing/rtla/Makefile
+ $(SED) 's/-fstack-protector.* //' $(LINUX_TOOLS_KDIR)/tools/tracing/rtla/Makefile
endef
endif
@@ -27,14 +27,14 @@ define RTLA_LINUX_CONFIG_FIXUPS
endef
define RTLA_BUILD_CMDS
- $(Q)if ! grep install $(LINUX_DIR)/tools/tracing/rtla/Makefile >/dev/null 2>&1 ; then \
+ $(Q)if ! grep install $(LINUX_TOOLS_KSRC)/tracing/rtla/Makefile >/dev/null 2>&1 ; then \
echo "Your kernel version is too old and does not implement the rtla tool." ; \
echo "At least kernel 5.19 must be used." ; \
exit 1 ; \
fi
$(RTLA_DISABLE_STACK_PROTECTOR)
$(TARGET_MAKE_ENV) $(MAKE) $(RTLA_MAKE_OPTS) \
- -C $(LINUX_DIR)/tools/tracing rtla
+ -C $(LINUX_TOOLS_KDIR)/tools/tracing rtla
endef
# make rtla_install build and install by default documentation using rst2man
@@ -42,12 +42,12 @@ endef
# folder so let's simply install the resulting rtla binary and create symlinks
# like Linux does in its tools/tracing/rtla/Makefile
define RTLA_INSTALL_TARGET_CMDS
- $(INSTALL) -m 0755 -D $(LINUX_DIR)/tools/tracing/rtla/rtla $(TARGET_DIR)/usr/bin
+ $(INSTALL) -m 0755 -D $(LINUX_TOOLS_KDIR)/tools/tracing/rtla/rtla $(TARGET_DIR)/usr/bin
ln -sf rtla $(TARGET_DIR)/usr/bin/osnoise
ln -sf rtla $(TARGET_DIR)/usr/bin/timerlat
# Check if hwnoise is provided or not
- if grep -q hwnoise $(LINUX_DIR)/tools/tracing/rtla/Makefile; then \
+ if grep -q hwnoise $(LINUX_TOOLS_KSRC)/tracing/rtla/Makefile; then \
ln -sf rtla $(TARGET_DIR)/usr/bin/hwnoise ; \
fi
endef
diff --git a/package/linux-tools/linux-tool-selftests.mk.in b/package/linux-tools/linux-tool-selftests.mk.in
index 032a71e32000..4f25c4a922c1 100644
--- a/package/linux-tools/linux-tool-selftests.mk.in
+++ b/package/linux-tools/linux-tool-selftests.mk.in
@@ -27,11 +27,14 @@ SELFTESTS_MAKE_FLAGS = \
KHDR_DIR=$(LINUX_DIR)/usr/include \
KHDR_INCLUDES="-isystem $(LINUX_DIR)/usr/include"
+# The ynl library of the net selftests is built with the host compiler
LINUX_TOOLS_BIN_ARCH_EXCLUDE += \
- /usr/lib/kselftests/tc-testing/
+ /usr/lib/kselftests/tc-testing/ \
+ /usr/lib/kselftests/net/lib/ynl/ \
+ /usr/lib/kselftests/drivers/net/
# O must be redefined here to overwrite the one used by Buildroot for
-# out of tree build. We build the selftests in $(LINUX_DIR)/tools/selftests and
+# out of tree build. We build the selftests in $(LINUX_TOOLS_KDIR)/tools/selftests and
# not just $(LINUX_DIR) so that it isn't built in the root directory of the kernel
# sources.
#
@@ -43,12 +46,12 @@ LINUX_TOOLS_BIN_ARCH_EXCLUDE += \
define SELFTESTS_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR) $(SELFTESTS_MAKE_FLAGS) \
headers_install
- $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/testing/selftests \
- $(SELFTESTS_MAKE_FLAGS) O=$(LINUX_DIR)/tools/testing/selftests
+ $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_TOOLS_KDIR)/tools/testing/selftests \
+ $(SELFTESTS_MAKE_FLAGS) O=$(LINUX_TOOLS_KDIR)/tools/testing/selftests
endef
define SELFTESTS_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/testing/selftests \
- $(SELFTESTS_MAKE_FLAGS) O=$(LINUX_DIR)/tools/testing/selftests \
+ $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_TOOLS_KDIR)/tools/testing/selftests \
+ $(SELFTESTS_MAKE_FLAGS) O=$(LINUX_TOOLS_KDIR)/tools/testing/selftests \
INSTALL_PATH=$(TARGET_DIR)/usr/lib/kselftests install
endef
diff --git a/package/linux-tools/linux-tool-tmon.mk.in b/package/linux-tools/linux-tool-tmon.mk.in
index 56c328c51fd7..cb071f5fee12 100644
--- a/package/linux-tools/linux-tool-tmon.mk.in
+++ b/package/linux-tools/linux-tool-tmon.mk.in
@@ -14,24 +14,24 @@ TMON_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
define TMON_DISABLE_STACK_PROTECTOR
- $(SED) 's%-fstack-protector%%' $(LINUX_DIR)/tools/thermal/tmon/Makefile
+ $(SED) 's%-fstack-protector%%' $(LINUX_TOOLS_KDIR)/tools/thermal/tmon/Makefile
endef
endif
define TMON_BUILD_CMDS
- $(Q)if ! grep install $(LINUX_DIR)/tools/thermal/tmon/Makefile >/dev/null 2>&1 ; then \
+ $(Q)if ! grep install $(LINUX_TOOLS_KSRC)/thermal/tmon/Makefile >/dev/null 2>&1 ; then \
echo "Your kernel version is too old and does not have the tmon tool." ; \
echo "At least kernel 3.13 must be used." ; \
exit 1 ; \
fi
$(TMON_DISABLE_STACK_PROTECTOR)
- $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_TOOLS_KDIR)/tools \
$(TMON_MAKE_OPTS) \
tmon
endef
define TMON_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_TOOLS_KDIR)/tools \
$(TMON_MAKE_OPTS) \
INSTALL_ROOT=$(TARGET_DIR) \
tmon_install
diff --git a/package/linux-tools/linux-tool-usbtools.mk.in b/package/linux-tools/linux-tool-usbtools.mk.in
index 797758adce51..6e72fe6de79a 100644
--- a/package/linux-tools/linux-tool-usbtools.mk.in
+++ b/package/linux-tools/linux-tool-usbtools.mk.in
@@ -13,20 +13,20 @@ LINUX_TOOLS_USBTOOLS_LIST = \
$(if $(BR2_PACKAGE_LINUX_TOOLS_USBTOOLS_FFSTEST),ffs-test)
define USBTOOLS_BUILD_CMDS
- $(Q)if ! grep install $(LINUX_DIR)/tools/usb/Makefile >/dev/null 2>&1 ; then \
+ $(Q)if ! grep install $(LINUX_TOOLS_KSRC)/usb/Makefile >/dev/null 2>&1 ; then \
echo "Your kernel version is too old to build the USB tools." ; \
echo "At least kernel 5.9 must be used." ; \
exit 1 ; \
fi
- $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/usb \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_TOOLS_KDIR)/tools/usb \
ALL_TARGETS="$(LINUX_TOOLS_USBTOOLS_LIST)" \
$(USBTOOLS_MAKE_OPTS) \
all
endef
define USBTOOLS_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/usb \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_TOOLS_KDIR)/tools/usb \
ALL_TARGETS="$(LINUX_TOOLS_USBTOOLS_LIST)" \
$(USBTOOLS_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) \
diff --git a/package/linux-tools/linux-tools.mk b/package/linux-tools/linux-tools.mk
index 49e73a9ca4ec..c1b13af0dd4c 100644
--- a/package/linux-tools/linux-tools.mk
+++ b/package/linux-tools/linux-tools.mk
@@ -8,7 +8,25 @@
# Instead, we directly build in the sources of the linux package. We can do
# that, because we're not building in the same location and the same files.
#
-# So, all tools refer to $(LINUX_DIR) instead of $(@D).
+# So, all tools refer to $(LINUX_TOOLS_KDIR) to build, instead of $(@D).
+#
+# Which tools can be built, though, is checked against the kernel sources
+# in $(LINUX_SRCDIR), which is not $(LINUX_DIR), the kernel build directory,
+# when the kernel is built out of tree.
+#
+# The tools build in-tree, and we do not want to pollute the kernel sources
+# of an out-of-tree build. So in that case, we build in a shadow of the
+# kernel sources, which is a tree of real directories with symlinks to the
+# files.
+LINUX_TOOLS_KSRC = $(LINUX_SRCDIR)/tools
+LINUX_TOOLS_KDIR = $(if $(LINUX_OUT_OF_TREE),$(LINUX_TOOLS_BUILDDIR)/linux,$(LINUX_DIR))
+
+define LINUX_TOOLS_SHADOW_SOURCES
+ $(if $(LINUX_OUT_OF_TREE),\
+ support/scripts/symlink-tree -f tools $(LINUX_SRCDIR) $(LINUX_TOOLS_KDIR))
+endef
+# Must come first, before the hooks that tweak the kernel sources
+LINUX_TOOLS_PRE_CONFIGURE_HOOKS += LINUX_TOOLS_SHADOW_SOURCES
# Note: we need individual tools makefiles to be included *before* we build
# the list of build and install hooks below to guarantee that each tool has
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 22/23] package: read kernel headers from LINUX_SRCDIR
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (20 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 21/23] package/linux-tools: support an out-of-tree kernel build Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
2026-10-28 21:37 ` [Buildroot] [PATCH v2 23/23] docs/manual: document out-of-tree package builds and the new srcdir variables Florian Fainelli via buildroot
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Eric Le Bihan, Gary Bisson, Jérôme Pouiller,
Florian Fainelli, Bernd Kuhls, Thomas Perale, Maxime Chevallier,
Refik Tuzakli, Francois Perrad, Thomas Petazzoni,
Arnout Vandecappelle, Petr Vorel, Spenser Gilliland,
Giulio Benetti, Pascal de Bruijn, Luca Ceresoli, Romain Naour,
Mahyar Koshkouei
When the kernel is built out of tree, LINUX_DIR is the build directory and
does not contain the source headers.
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
package/a10disp/a10disp.mk | 2 +-
package/freescale-imx/imx-alsa-plugins/imx-alsa-plugins.mk | 2 +-
package/freescale-imx/imx-lib/imx-lib.mk | 2 +-
package/gstreamer1/gst1-imx/gst1-imx.mk | 2 +-
package/x11r7/xdriver_xf86-video-imx/xdriver_xf86-video-imx.mk | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package/a10disp/a10disp.mk b/package/a10disp/a10disp.mk
index c919202329c4..a7ba85fb5a42 100644
--- a/package/a10disp/a10disp.mk
+++ b/package/a10disp/a10disp.mk
@@ -12,7 +12,7 @@ A10DISP_LICENSE_FILES = a10disp.c
A10DISP_DEPENDENCIES = linux
define A10DISP_BUILD_CMDS
- cp -f $(LINUX_DIR)/include/video/sunxi_disp_ioctl.h $(@D)/
+ cp -f $(LINUX_SRCDIR)/include/video/sunxi_disp_ioctl.h $(@D)/
$(TARGET_CC) $(TARGET_CFLAGS) $(@D)/a10disp.c -o $(@D)/a10disp
endef
diff --git a/package/freescale-imx/imx-alsa-plugins/imx-alsa-plugins.mk b/package/freescale-imx/imx-alsa-plugins/imx-alsa-plugins.mk
index 912cc7c68bcb..e153738a5ef4 100644
--- a/package/freescale-imx/imx-alsa-plugins/imx-alsa-plugins.mk
+++ b/package/freescale-imx/imx-alsa-plugins/imx-alsa-plugins.mk
@@ -15,6 +15,6 @@ IMX_ALSA_PLUGINS_AUTORECONF = YES
# needs access to imx-specific kernel headers
IMX_ALSA_PLUGINS_DEPENDENCIES += linux
-IMX_ALSA_PLUGINS_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -idirafter $(LINUX_DIR)/include/uapi"
+IMX_ALSA_PLUGINS_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -idirafter $(LINUX_SRCDIR)/include/uapi"
$(eval $(autotools-package))
diff --git a/package/freescale-imx/imx-lib/imx-lib.mk b/package/freescale-imx/imx-lib/imx-lib.mk
index f06453e8a6be..3048deb96053 100644
--- a/package/freescale-imx/imx-lib/imx-lib.mk
+++ b/package/freescale-imx/imx-lib/imx-lib.mk
@@ -15,7 +15,7 @@ IMX_LIB_INSTALL_STAGING = YES
# imx-lib needs access to imx-specific kernel headers
IMX_LIB_DEPENDENCIES += linux
IMX_LIB_INCLUDE = \
- -idirafter $(LINUX_DIR)/include/uapi
+ -idirafter $(LINUX_SRCDIR)/include/uapi
IMX_LIB_MAKE_ENV = \
$(TARGET_MAKE_ENV) \
diff --git a/package/gstreamer1/gst1-imx/gst1-imx.mk b/package/gstreamer1/gst1-imx/gst1-imx.mk
index f091b4f9832b..ebeccc3bd66f 100644
--- a/package/gstreamer1/gst1-imx/gst1-imx.mk
+++ b/package/gstreamer1/gst1-imx/gst1-imx.mk
@@ -23,7 +23,7 @@ GST1_IMX_CONF_OPTS = --prefix="/usr"
ifeq ($(BR2_LINUX_KERNEL),y)
# IPU and PXP need access to imx-specific kernel headers
GST1_IMX_DEPENDENCIES += linux
-GST1_IMX_CONF_OPTS += --kernel-headers="$(LINUX_DIR)/include"
+GST1_IMX_CONF_OPTS += --kernel-headers="$(LINUX_SRCDIR)/include"
endif
ifeq ($(BR2_PACKAGE_IMX_CODEC),y)
diff --git a/package/x11r7/xdriver_xf86-video-imx/xdriver_xf86-video-imx.mk b/package/x11r7/xdriver_xf86-video-imx/xdriver_xf86-video-imx.mk
index b80c6b77335e..3f2602268d36 100644
--- a/package/x11r7/xdriver_xf86-video-imx/xdriver_xf86-video-imx.mk
+++ b/package/x11r7/xdriver_xf86-video-imx/xdriver_xf86-video-imx.mk
@@ -9,6 +9,6 @@ XDRIVER_XF86_VIDEO_IMX_SOURCE = xserver-xorg-video-imx-$(XDRIVER_XF86_VIDEO_IMX_
XDRIVER_XF86_VIDEO_IMX_SITE = $(FREESCALE_IMX_SITE)
XDRIVER_XF86_VIDEO_IMX_DEPENDENCIES = linux libz160 xserver_xorg-server \
xorgproto
-XDRIVER_XF86_VIDEO_IMX_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -I$(LINUX_DIR)/include"
+XDRIVER_XF86_VIDEO_IMX_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -I$(LINUX_SRCDIR)/include"
$(eval $(autotools-package))
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread* [Buildroot] [PATCH v2 23/23] docs/manual: document out-of-tree package builds and the new srcdir variables
2026-10-28 21:37 [Buildroot] [PATCH v2 00/23] Support building the Linux kernel out of tree Florian Fainelli via buildroot
` (21 preceding siblings ...)
2026-10-28 21:37 ` [Buildroot] [PATCH v2 22/23] package: read kernel headers from LINUX_SRCDIR Florian Fainelli via buildroot
@ 2026-10-28 21:37 ` Florian Fainelli via buildroot
22 siblings, 0 replies; 24+ messages in thread
From: Florian Fainelli via buildroot @ 2026-10-28 21:37 UTC (permalink / raw)
To: buildroot
Cc: Eric Le Bihan, Gary Bisson, Jérôme Pouiller,
Florian Fainelli, Bernd Kuhls, Thomas Perale, Maxime Chevallier,
Refik Tuzakli, Francois Perrad, Thomas Petazzoni,
Arnout Vandecappelle, Petr Vorel, Spenser Gilliland,
Giulio Benetti, Pascal de Bruijn, Luca Ceresoli, Romain Naour,
Mahyar Koshkouei
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
docs/manual/adding-packages-generic.adoc | 12 +++++++
docs/manual/using-buildroot-development.adoc | 38 ++++++++++++++++++++
2 files changed, 50 insertions(+)
diff --git a/docs/manual/adding-packages-generic.adoc b/docs/manual/adding-packages-generic.adoc
index e7547460fd50..5b020d78a214 100644
--- a/docs/manual/adding-packages-generic.adoc
+++ b/docs/manual/adding-packages-generic.adoc
@@ -666,6 +666,18 @@ In the action definitions, you can use the following variables:
* +$(@D)+, which contains the directory in which the package source
code has been uncompressed.
+* +$(LIBFOO_SRCDIR)+ is the directory containing the package sources,
+ +$(LIBFOO_SRCSUBDIR)+ is the same directory with +LIBFOO_SUBDIR+
+ appended, and +$(LIBFOO_BUILDDIR)+ is the directory in which the package
+ is built. By default, these all point to +$(@D)+, but they can differ:
+ build systems that build out of source set +$(LIBFOO_BUILDDIR)+ to a
+ sub-directory, and a package that supports being built out of tree has
+ its sources in +output/source/+, or in the directory given by
+ +LIBFOO_OVERRIDE_SRCDIR+ when it is set. A
+ recipe that only reads the package sources (for example to copy a header)
+ should use +$(LIBFOO_SRCDIR)+ rather than +$(@D)+, which is the build
+ directory. See xref:outoftree-build[] for more details.
+
* +$(LIBFOO_DL_DIR)+ contains the path to the directory where all the downloads
made by Buildroot for +libfoo+ are stored in.
diff --git a/docs/manual/using-buildroot-development.adoc b/docs/manual/using-buildroot-development.adoc
index 72628e0a6f99..de62c0a89ed4 100644
--- a/docs/manual/using-buildroot-development.adoc
+++ b/docs/manual/using-buildroot-development.adoc
@@ -119,3 +119,41 @@ cost of a slower speed, add these directories back:
----
LINUX_OVERRIDE_SRCDIR_RSYNC_EXCLUSIONS = --include .git
----
+
+[[outoftree-build]]
+===== Building out of tree
+
+A package can opt in to being built out of tree by setting
++LIBFOO_SUPPORTS_OUT_OF_TREE = YES+. Such a package is always built out of
+tree: its sources are extracted and patched in
++output/source/<package>-<version>+, and only the generated files, including
+the stamp files of the configure, build and install steps, are stored in
++output/build/<package>-<version>+. Other packages are not affected: their
+sources and generated files are both in +output/build/<package>-<version>+.
+
+When +LIBFOO_OVERRIDE_SRCDIR+ is set for such a package, Buildroot does not
+_rsync_ the sources to +output/build/<package>-custom/+. Instead, the
+package is built from the overridden directory, with all the generated
+files, including the stamp files, stored in
++output/build/<package>-custom/+. The overridden directory is therefore not
+modified by the build. The +<pkg>_PRE_RSYNC_HOOKS+ and
++<pkg>_POST_RSYNC_HOOKS+ hooks are still run, but +$(@D)+ then does not
+contain the sources: hooks should use +$(LIBFOO_SRCDIR)+ to access them.
+
+Currently the +linux+ package supports this. When the sources are overridden,
+the kernel source tree must be clean (no +.config+, +include/config+ or
++arch/*/include/generated+, as required by the kernel when using +O=+); run
++make mrproper+ in it if needed. The kernel is configured and built with
++O=+ pointing to +output/build/linux-<version>/+ (or
++output/build/linux-custom/+ when the sources are overridden).
+
+When a custom logo (+BR2_LINUX_KERNEL_CUSTOM_LOGO_PATH+) or custom device
+tree files (+BR2_LINUX_KERNEL_CUSTOM_DTS_PATH+) are used, or when
++linux-tools+ are enabled, Buildroot has to add files to, or build inside,
+the kernel sources. To avoid modifying the overridden directory, it then
+builds from a _shadow_ copy: a tree of real directories containing
+symbolic links to the files of the original tree, created by
++support/scripts/symlink-tree+.
+
+Packages that read files from the kernel sources, such as headers, must use
++$(LINUX_SRCDIR)+ and not +$(LINUX_DIR)+.
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 24+ messages in thread