Support building the Linux kernel out of tree
Subsystems (3)
v2 cover Support building the Linux kernel out of tree
Hello,
This series lets a package be built out of tree, i.e. with its sources in a directory separate from the build directory, and enables it for the Linux kernel.
For a large source tree such as the kernel, this matters for the LINUX_OVERRIDE_SRCDIR workflow: the rsync step is slow, doubles the disk usage, and leaves the developer's tree and the build directory out of sync. With this series the kernel is configured and built with O=output/build/linux-<version> (or linux-custom with an override), and the sources in the overridden directory are never written to.
A package opts in with <pkg>_SUPPORTS_OUT_OF_TREE = YES, and is then always built out of tree:
- without an override, the tarball is extracted and patched in output/source/<pkg>-<version>, and output/build/<pkg>-<version> only contains the generated files;
- with <pkg>_OVERRIDE_SRCDIR set, the overridden directory is used in place, with no rsync, and the build directory is output/build/<pkg>-custom.
Only linux opts in for now, all the other packages are unchanged.
Most of the groundwork comes from the out-of-tree work Thomas Petazzoni and Yann E. Morin did in 2015-2017, which was never merged. It has been rebased on current master, and extended to cover the custom logo, custom device tree files, and linux-tools. Their authorship is preserved.
Series overview
===============
Patches 1-8, infra preparation:
- introduce <pkg>_SRCDIR (where the sources are) and <pkg>_BUILDDIR (where the package is built, and where the stamp files live), both defaulting to <pkg>_DIR, so nothing changes for existing packages;
- fix up the users of LINUX_DIR that need the build directory (boot-wrapper-aarch64, mxs-bootlets, the linux extensions), and run the kernel version probing from the build directory;
- introduce <pkg>_SRCSUBDIR (<pkg>_SRCDIR/<pkg>_SUBDIR) and convert the infras (cargo, hare, luarocks, meson, perl, waf) and gcc-final to it.
Patch 9, the kernel:
- add <pkg>_SUPPORTS_OUT_OF_TREE, which defaults to NO so that an infrastructure can later change the default (e.g. autotools, with a per-package opt-out). A package that sets it has its sources in $(SRC_DIR) (output/source) and is built in $(BUILD_DIR), with kconfig called with -C $(SRCDIR) O=$(BUILDDIR). When <pkg>_OVERRIDE_SRCDIR is set, the rsync step is skipped and the stamp files go in the build directory. <pkg>-dirclean and make clean also remove the extracted sources;
- opt linux in, in the same patch. When the sources are overridden, Kbuild requires a clean source tree for O=: a tree with a stale .config, include/config or arch/*/include/generated is rejected by kbuild itself.
Patches 10-19, host/target consistency. When the sources are shared between the host and the target variant of a package, they must not be patched differently, so:
- sync the host and target patch hooks, and fix omniorb, lua and perl
which did different things between the two variants;
- have host packages inherit the extra downloads and apply the libtool
patch to host libtool; - warn about packages that autoreconf without the libtool patch;
- replace $(PKG)_DIR with $(@D) where this is possible.
Patches 20-21, the parts that write to the kernel sources:
- the custom logo (BR2_LINUX_KERNEL_CUSTOM_LOGO_PATH) and custom device tree files (BR2_LINUX_KERNEL_CUSTOM_DTS_PATH) are copied into the kernel sources. With an overridden source directory, linux is built from a "shadow" tree: real directories whose files are symbolic links to the original tree, created by the new support/scripts/symlink-tree. Files are replaced rather than written through the links, so the overridden tree is never modified;
- linux-tools checks which tools are available in $(LINUX_SRCDIR)/tools, and builds them in a shadow of that directory, because several of the kernel tools build in place, and some (mm, tmon) do not support OUTPUT/O= at all. This also covers the PCI endpoint selftests path.
Patches 22-23:
- packages that read kernel headers from the source tree use
$(LINUX_SRCDIR) instead of $(LINUX_DIR);
- document the feature and the new variables in the manual.
Things this series intentionally does not do
============================================
- Only linux opts in. The other packages still extract and build in output/build/<pkg>-<version>, and still rsync with an override. Other packages can opt in later, with the same variable.
- The "hooks sanity check" and "host inherits the target hooks" patches of the original series are not included: they do not work with the infras that register per-name hooks (e.g. golang).
- The Python 2 and asterisk patches of the original series are dropped:
those packages are gone or no longer need them.
Testing
=======
All of the following build with the series applied on top of master (1cfdb4efd539), from scratch (no build, host, staging or source directory):
- raspberrypi4_64_defconfig, stock, and with the Raspberry Pi kernel
sources overridden through LINUX_OVERRIDE_SRCDIR;
- qemu_x86_64 and qemu_arm_vexpress, stock, and with an overridden
kernel source directory; all four boot to a login prompt in QEMU;
- a wide package set on top of raspberrypi4_64_defconfig (autotools,
cmake, meson, perl, python, cargo, golang, waf, luarocks, hare,
kernel modules, asterisk, ffmpeg, libvpx, u-boot, and the linux-tools
gpio, iio, perf, pci, cpupower, rtla, tmon, mm, usbtools), both with
and without an override: the content of target/ is identical;
- a custom logo and a custom device tree file with a #include, both
without an override, and with an override where the overridden tree
is left unmodified;
- the same package set in the Buildroot CI docker image, offline;
- <pkg>-dirclean, -rebuild, -reconfigure, -legal-info, -source,
show-info and linux-rebuild-with-initramfs;- every patch of the series builds, tested on a small package set.
Known issues, not caused by this series and identical with and without it:
xtables-addons does not build with the Raspberry Pi 6.12 kernel, and some linux-tools selftests (mm) fail to link. I have not tested the selftests in the docker image, as the container has no python yaml.
Not tested: the other kernel extensions (rtai, xenomai), which are adapted but not built, and booting on real hardware.
Changes
=======
Changes since v1:
- patch 3: removed a leftover "WIP" note from the commit message;
- patch 9: as suggested by Thomas and Arnout, out-of-tree is no longer only used with <pkg>_OVERRIDE_SRCDIR: a package that sets <pkg>_SUPPORTS_OUT_OF_TREE is always built out of tree, with its sources extracted in output/source. SRC_DIR is now a separate directory, and dirclean and make clean remove it. Patches 20 and 23 are adapted accordingly;
- patch 12 (lua): the host variant also modified luaconf.h, to set LUA_ROOT, in a host-only post-patch hook. As suggested, this is no longer done on the shared sources: the Buildroot patch now lets LUA_ROOT be overridden, host-lua sets it in its CFLAGS, and the installed host luaconf.h is adjusted in a post-install hook;
- patch 17 (perl): as suggested, revert 8dea6e7c089c ("package/perl:
apply perl-cross patch only on target perl"): the perl-cross patch is a normal package patch again, applied to both variants, and the PERL_POST_PATCH_HOOKS hook is dropped;
- the subject no longer mentions LINUX_OVERRIDE_SRCDIR.
Regards,
Florian
Florian Fainelli (6):
package: use <pkg>_SRCSUBDIR where <pkg>_SRCDIR used to include
_SUBDIR
linux: build out of tree
linux: support custom logo and devicetree files in out-of-tree builds package/linux-tools: support an out-of-tree kernel build
package: read kernel headers from LINUX_SRCDIR docs/manual: document out-of-tree package builds and the new srcdir
variables
Thomas Petazzoni (7):
package: prepare removal of <pkg>_DIR
infra: introduce a global SRC_DIR variable
packages: sync host and target patch hooks
omniorb: avoid target-only patch hook
lua: rework post-patch hook usage
package/libtool: use post-patch hooks package/{ffmpeg,libvpx}: use $(@D) instead of $(pkg_SRCDIR) when
possible
Yann E. MORIN (10):
package: fix <pkg>_SRCDIR and <pkg>_BUILDDIR values boot/boot-wrapper-aarch64: needs LINUX_BUILDDIR boot/mxs-bootlets: needs (BAREBOX,LINUX,UBOOT)_BUILDDIR linux/extensions: point to proper _SRCDIR and @D linux/linux: LINUX_VERSION_PROBED should run from build directory
infra: host packages inherit the target extra downloads package/libtool: also apply libtool-patch to host libtool package/perl: apply the perl-cross even for the host variant infra/autotools: warn for package that autoreconf without libtool
patch
packages: replace $(PKG)_DIR with @D where possible
Makefile | 3 +-
.../boot-wrapper-aarch64.mk | 8 +-
boot/mxs-bootlets/mxs-bootlets.mk | 6 +-
docs/manual/adding-packages-generic.adoc | 12 +++
docs/manual/using-buildroot-development.adoc | 38 +++++++++
linux/linux-ext-rtai.mk | 8 +-
linux/linux-ext-xenomai.mk | 4 +-
linux/linux.mk | 41 ++++++++--
package/a10disp/a10disp.mk | 2 +-
package/android-tools/android-tools.mk | 1 -
package/binutils/binutils.mk | 1 -
package/ffmpeg/ffmpeg.mk | 2 +-
.../imx-alsa-plugins/imx-alsa-plugins.mk | 2 +-
package/freescale-imx/imx-lib/imx-lib.mk | 2 +-
package/gcc/gcc-final/gcc-final.mk | 2 +-
package/gdb/gdb.mk | 1 -
package/gstreamer1/gst1-imx/gst1-imx.mk | 2 +-
package/icu/icu.mk | 1 +
package/libtool/libtool.mk | 5 +-
package/libvpx/libvpx.mk | 2 +-
package/linux-backports/linux-backports.mk | 2 +-
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 ++++-
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 ++++-
package/ncftp/ncftp.mk | 2 +-
.../omniorb/0002-optional-appl-services.patch | 29 +++++++
package/omniorb/omniorb.mk | 26 +++----
package/pciutils/pciutils.mk | 2 +-
...gure-keep-_GNU_SOURCE-in-build-flags.patch | 0
package/perl/perl.mk | 11 +--
package/php/php.mk | 2 +-
package/pkg-autotools.mk | 28 +++----
package/pkg-cargo.mk | 8 +-
package/pkg-cmake.mk | 8 +-
package/pkg-generic.mk | 77 +++++++++++++------
package/pkg-hare.mk | 8 +-
package/pkg-kconfig.mk | 48 ++++++------
package/pkg-luarocks.mk | 10 +--
package/pkg-meson.mk | 26 +++----
package/pkg-perl.mk | 12 +--
package/pkg-waf.mk | 8 +-
.../xdriver_xf86-video-imx.mk | 2 +-
support/scripts/symlink-tree | 58 ++++++++++++++
56 files changed, 471 insertions(+), 241 deletions(-)
create mode 100644 package/omniorb/0002-optional-appl-services.patch
rename package/perl/{perl-cross => }/0001-configure-keep-_GNU_SOURCE-in-build-flags.patch (100%)
create mode 100755 support/scripts/symlink-treeSignature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 1/23 package: prepare removal of <pkg>_DIR
From: Thomas Petazzoni <[email protected]>
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.
[[email protected]:
- rebase on master
- change the location of the dirclean stamp
- expand commit log accordingly
]
--- package/pkg-generic.mk | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
package/pkg-generic.mk +19 -19
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 2/23 infra: introduce a global SRC_DIR variable
In reply to Florian Fainelli via buildrootFrom: Thomas Petazzoni <[email protected]>
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.
[[email protected]:
- rebase on master
- slightly expand commit log
]
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 3/23 package: fix <pkg>_SRCDIR and <pkg>_BUILDDIR values
In reply to Florian Fainelli via buildrootFrom: "Yann E. MORIN" <[email protected]>
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.
[[email protected]:
- 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
]
--- 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(-)
package/pkg-autotools.mk +10 -10
@@ -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
package/pkg-cmake.mk +4 -4
@@ -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 \
package/pkg-generic.mk +5 -4
@@ -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)
package/pkg-kconfig.mk +22 -22
114 lines not on this page · raw message
package/pkg-luarocks.mk +3 -3
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 4/23 boot/boot-wrapper-aarch64: needs LINUX_BUILDDIR
In reply to Florian Fainelli via buildrootFrom: "Yann E. MORIN" <[email protected]>
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 directoryMake it so.
--- boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk +4 -4
@@ -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)
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 5/23 boot/mxs-bootlets: needs (BAREBOX, LINUX, UBOOT)_BUILDDIR
In reply to Florian Fainelli via buildrootFrom: "Yann E. MORIN" <[email protected]>
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.
--- boot/mxs-bootlets/mxs-bootlets.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
boot/mxs-bootlets/mxs-bootlets.mk +3 -3
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 6/23 linux/extensions: point to proper _SRCDIR and @D
In reply to Florian Fainelli via buildrootFrom: "Yann E. MORIN" <[email protected]>
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.
Cc Christian Stewart <[email protected]>
--- linux/linux-ext-rtai.mk | 8 ++++---- linux/linux-ext-xenomai.mk | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
linux/linux-ext-rtai.mk +4 -4
@@ -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" ; \
linux/linux-ext-xenomai.mk +2 -2
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 7/23 linux/linux: LINUX_VERSION_PROBED should run from build directory
In reply to Florian Fainelli via buildrootFrom: "Yann E. MORIN" <[email protected]>
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.
--- linux/linux.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux/linux.mk +1 -1
@@ -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))
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 8/23 package: use <pkg>_SRCSUBDIR where <pkg>_SRCDIR used to include _SUBDIR
In reply to Florian Fainelli via buildrootWith <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.
--- 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(-)
package/gcc/gcc-final/gcc-final.mk +1 -1
@@ -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)" \
package/pkg-cargo.mk +4 -4
@@ -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) \
package/pkg-hare.mk +4 -4
@@ -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
package/pkg-luarocks.mk +2 -2
@@ -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)" \
package/pkg-meson.mk +13 -13
@@ -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
package/pkg-perl.mk +6 -6
@@ -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; \
package/pkg-waf.mk +4 -4
@@ -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) \
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 9/23 linux: build out of tree
In reply to Florian Fainelli via buildrootIntroduce <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).
--- Makefile | 4 ++-- linux/linux.mk | 5 +++++ package/pkg-generic.mk | 46 ++++++++++++++++++++++++++++++------------ package/pkg-kconfig.mk | 6 +++++- 4 files changed, 45 insertions(+), 16 deletions(-)
Makefile +2 -2
@@ -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
linux/linux.mk +5 -0
@@ -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
package/pkg-generic.mk +33 -13
103 lines not on this page · raw message
package/pkg-kconfig.mk +5 -1
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 10/23 packages: sync host and target patch hooks
In reply to Florian Fainelli via buildrootFrom: Thomas Petazzoni <[email protected]>
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.
--- package/icu/icu.mk | 1 + 1 file changed, 1 insertion(+)
package/icu/icu.mk +1 -0
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 11/23 omniorb: avoid target-only patch hook
In reply to Florian Fainelli via buildrootFrom: Thomas Petazzoni <[email protected]>
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.
--- .../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
package/omniorb/0002-optional-appl-services.patch new file +29 -0
@@ -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 <[email protected]> +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'
package/omniorb/omniorb.mk +13 -13
@@ -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))
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 12/23 lua: rework post-patch hook usage
In reply to Florian Fainelli via buildrootFrom: Thomas Petazzoni <[email protected]>
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.
--- 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(-)
package/lua/5.1.5/0001-root-path.patch +9 -15
@@ -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 <[email protected]> -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 \
package/lua/5.3.6/0001-root-path.patch +11 -4
@@ -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 <[email protected]>
@@ -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 \
package/lua/5.4.9/0001-root-path.patch +9 -2
@@ -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 <[email protected]>
@@ -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 "/"
package/lua/lua.mk +14 -4
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 13/23 infra: host packages inherit the target extra downloads
In reply to Florian Fainelli via buildrootFrom: "Yann E. MORIN" <[email protected]>
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.
--- 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(-)
package/android-tools/android-tools.mk +0 -1
@@ -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
package/binutils/binutils.mk +0 -1
@@ -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
package/gdb/gdb.mk +0 -1
@@ -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)
package/pkg-generic.mk +6 -0
@@ -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))
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 14/23 package/libtool: use post-patch hooks
In reply to Florian Fainelli via buildrootFrom: Thomas Petazzoni <[email protected]>
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.
---
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
--- package/libtool/libtool.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
package/libtool/libtool.mk +2 -2
@@ -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))
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 15/23 package/libtool: also apply libtool-patch to host libtool
In reply to Florian Fainelli via buildrootFrom: "Yann E. MORIN" <[email protected]>
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
--- package/libtool/libtool.mk | 1 - package/pkg-autotools.mk | 4 ---- 2 files changed, 5 deletions(-)
package/libtool/libtool.mk +0 -1
@@ -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
package/pkg-autotools.mk +0 -4
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 16/23 package/{ffmpeg, libvpx}: use $(@D) instead of $(pkg_SRCDIR) when possible
In reply to Florian Fainelli via buildrootFrom: Thomas Petazzoni <[email protected]>
$(@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.
--- package/ffmpeg/ffmpeg.mk | 2 +- package/libvpx/libvpx.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
package/ffmpeg/ffmpeg.mk +1 -1
@@ -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) \
package/libvpx/libvpx.mk +1 -1
@@ -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) \
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 17/23 package/perl: apply the perl-cross even for the host variant
In reply to Florian Fainelli via buildrootFrom: "Yann E. MORIN" <[email protected]>
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").
---
...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%)package/perl/0001-configure-keep-_GNU_SOURCE-in-build-flags.patch renamed from package/perl/perl-cross/0001-configure-keep-_GNU_SOURCE-in-build-flags.patch +0 -0
package/perl/perl.mk +2 -9
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 18/23 infra/autotools: warn for package that autoreconf without libtool patch
In reply to Florian Fainelli via buildrootFrom: "Yann E. MORIN" <[email protected]>
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.
--- package/pkg-autotools.mk | 4 ++++ 1 file changed, 4 insertions(+)
package/pkg-autotools.mk +4 -0
@@ -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)
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 19/23 packages: replace $(PKG)_DIR with @D where possible
In reply to Florian Fainelli via buildrootFrom: "Yann E. MORIN" <[email protected]>
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.
[[email protected]:
- reabse on master, convert new packages, drop old ones
- add a commit log
]
--- 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(-)
package/linux-backports/linux-backports.mk +1 -1
@@ -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
package/ncftp/ncftp.mk +1 -1
@@ -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
package/pciutils/pciutils.mk +1 -1
@@ -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
package/php/php.mk +1 -1
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 20/23 linux: support custom logo and devicetree files in out-of-tree builds
In reply to Florian Fainelli via buildrootA 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.
--- 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
linux/linux.mk +27 -7
@@ -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
package/pkg-generic.mk +4 -1
@@ -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
support/scripts/symlink-tree new file +58 -0
58 lines not on this page · raw message
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 21/23 package/linux-tools: support an out-of-tree kernel build
In reply to Florian Fainelli via buildrootThe 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.
--- 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(-)
package/linux-tools/linux-tool-cpupower.mk.in +4 -4
@@ -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
package/linux-tools/linux-tool-gpio.mk.in +3 -3
@@ -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
package/linux-tools/linux-tool-hv.mk.in +3 -3
@@ -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)
package/linux-tools/linux-tool-iio.mk.in +3 -3
@@ -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) \
package/linux-tools/linux-tool-mm.mk.in +5 -5
@@ -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) \
package/linux-tools/linux-tool-pci.mk.in +7 -5
@@ -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 \
package/linux-tools/linux-tool-perf.mk.in +16 -11
@@ -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
package/linux-tools/linux-tool-rtla.mk.in +5 -5
@@ -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
package/linux-tools/linux-tool-selftests.mk.in +9 -6
@@ -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
package/linux-tools/linux-tool-tmon.mk.in +4 -4
@@ -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
package/linux-tools/linux-tool-usbtools.mk.in +3 -3
@@ -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) \
package/linux-tools/linux-tools.mk +19 -1
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 22/23 package: read kernel headers from LINUX_SRCDIR
In reply to Florian Fainelli via buildrootWhen the kernel is built out of tree, LINUX_DIR is the build directory and does not contain the source headers.
--- 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(-)
package/a10disp/a10disp.mk +1 -1
@@ -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
package/freescale-imx/imx-alsa-plugins/imx-alsa-plugins.mk +1 -1
@@ -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))
package/freescale-imx/imx-lib/imx-lib.mk +1 -1
@@ -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) \
package/gstreamer1/gst1-imx/gst1-imx.mk +1 -1
@@ -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)
package/x11r7/xdriver_xf86-video-imx/xdriver_xf86-video-imx.mk +1 -1
@@ -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))
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 23/23 docs/manual: document out-of-tree package builds and the new srcdir variables
In reply to Florian Fainelli via buildroot--- docs/manual/adding-packages-generic.adoc | 12 +++++++ docs/manual/using-buildroot-development.adoc | 38 ++++++++++++++++++++ 2 files changed, 50 insertions(+)
docs/manual/adding-packages-generic.adoc +12 -0
@@ -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.
docs/manual/using-buildroot-development.adoc +38 -0
@@ -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)+.
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 23 lines · Florian Fainelli
Hello,
This series lets a package be built out of tree, i.e. with its sources in a directory separate from the build directory, and enables it for the Linux kernel.
For a large source tree such as the kernel, this matters for the
LINUX_OVERRIDE_SRCDIRworkflow: the rsync step is slow, doubles the disk usage, and leaves the developer's tree and the build directory out of sync. With this series the kernel is configured and built with O=output/build/linux-<version> (or linux-custom with an override), and the sources in the overridden directory are never written to.A package opts in with <pkg>_SUPPORTS_OUT_OF_TREE = YES, and is then always built out of tree:
- without an override, the tarball is extracted and patched in output/source/<pkg>-<version>, and output/build/<pkg>-<version> only contains the generated files;
- with <pkg>_OVERRIDE_SRCDIR set, the overridden directory is used in place, with no rsync, and the build directory is output/build/<pkg>-custom.
Only linux opts in for now, all the other packages are unchanged.
Quoted 4 lines
Most of the groundwork comes from the out-of-tree work Thomas Petazzoni and Yann E. Morin did in 2015-2017, which was never merged. It has been rebased on current master, and extended to cover the custom logo, custom device tree files, and linux-tools. Their authorship is preserved.
Any feedback on v2 and whether this is where we would like things to be heading? Thanks!
Signature · 5 lines
Florian _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot