@@ -145,6 +145,30 @@ endif
###############################################################################
comment "Legacy options removed in 2016.11"
+config BR2_LINUX_KERNEL_TOOL_CPUPOWER
+ bool "linux-tool cpupower"
+ depends on BR2_LINUX_KERNEL
+ select BR2_LEGACY
+ select BR2_PACKAGE_LINUX_TOOLS_CPUPOWER
+ help
+ Linux tool cpupower option was renamed.
+
+config BR2_LINUX_KERNEL_TOOL_PERF
+ bool "linux-tool perf"
+ depends on BR2_LINUX_KERNEL
+ select BR2_LEGACY
+ select BR2_PACKAGE_LINUX_TOOLS_PERF
+ help
+ Linux tool perf option was renamed.
+
+config BR2_LINUX_KERNEL_TOOL_SELFTESTS
+ bool "linux-tool selftests"
+ depends on BR2_LINUX_KERNEL
+ select BR2_LEGACY
+ select BR2_PACKAGE_LINUX_TOOLS_SELFTESTS
+ help
+ Linux tool selftests option was renamed.
+
config BR2_LINUX_KERNEL_CUSTOM_LOCAL
bool "Linux kernel local directory option removed"
help
@@ -400,7 +400,7 @@ config BR2_LINUX_KERNEL_INSTALL_TARGET
source "linux/Config.ext.in"
# Linux tools
-source "linux/Config.tools.in"
+source "package/linux-tools/Config.in"
endif # BR2_LINUX_KERNEL
@@ -396,7 +396,7 @@ define LINUX_INSTALL_TARGET_CMDS
$(LINUX_INSTALL_HOST_TOOLS)
endef
-# Include all our extensions and tools definitions.
+# Include all our extensions.
#
# Note: our package infrastructure uses the full-path of the last-scanned
# Makefile to determine what package we're currently defining, using the
@@ -407,7 +407,6 @@ endef
# the current Makefile, we are OK. But this is a hard requirement: files
# included here *must* be in the same directory!
include $(sort $(wildcard linux/linux-ext-*.mk))
-include $(sort $(wildcard linux/linux-tool-*.mk))
LINUX_PATCH_DEPENDENCIES += $(foreach ext,$(LINUX_EXTENSIONS),\
$(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),$(ext)))
@@ -416,27 +415,6 @@ LINUX_PRE_PATCH_HOOKS += $(foreach ext,$(LINUX_EXTENSIONS),\
$(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),\
$(call UPPERCASE,$(ext))_PREPARE_KERNEL))
-# Install Linux kernel tools in the staging directory since some tools
-# may install shared libraries and headers (e.g. cpupower). The kernel
-# image is NOT installed in the staging directory.
-LINUX_INSTALL_STAGING = YES
-
-LINUX_DEPENDENCIES += $(foreach tool,$(LINUX_TOOLS),\
- $(if $(BR2_LINUX_KERNEL_TOOL_$(call UPPERCASE,$(tool))),\
- $($(call UPPERCASE,$(tool))_DEPENDENCIES)))
-
-LINUX_POST_BUILD_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
- $(if $(BR2_LINUX_KERNEL_TOOL_$(call UPPERCASE,$(tool))),\
- $(call UPPERCASE,$(tool))_BUILD_CMDS))
-
-LINUX_POST_INSTALL_STAGING_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
- $(if $(BR2_LINUX_KERNEL_TOOL_$(call UPPERCASE,$(tool))),\
- $(call UPPERCASE,$(tool))_INSTALL_STAGING_CMDS))
-
-LINUX_POST_INSTALL_TARGET_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
- $(if $(BR2_LINUX_KERNEL_TOOL_$(call UPPERCASE,$(tool))),\
- $(call UPPERCASE,$(tool))_INSTALL_TARGET_CMDS))
-
# Checks to give errors that the user can understand
ifeq ($(BR_BUILDING),y)
similarity index 83%
rename from linux/Config.tools.in
rename to package/linux-tools/Config.in
@@ -1,9 +1,15 @@
menu "Linux Kernel Tools"
-config BR2_LINUX_KERNEL_TOOL_CPUPOWER
+# No prompt, this is sourced by linux/Config.in as this
+# is no real package and really belongs to the kernel.
+config BR2_PACKAGE_LINUX_TOOLS
+ bool
+
+config BR2_PACKAGE_LINUX_TOOLS_CPUPOWER
bool "cpupower"
depends on !BR2_bfin # pciutils
depends on BR2_USE_WCHAR || !BR2_NEEDS_GETTEXT # gettext
+ select BR2_PACKAGE_LINUX_TOOLS
select BR2_PACKAGE_PCIUTILS
select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT
help
@@ -14,8 +20,9 @@ comment "cpupower needs a toolchain w/ wchar"
depends on !BR2_bfin
depends on !BR2_USE_WCHAR && BR2_NEEDS_GETTEXT
-config BR2_LINUX_KERNEL_TOOL_PERF
+config BR2_PACKAGE_LINUX_TOOLS_PERF
bool "perf"
+ select BR2_PACKAGE_LINUX_TOOLS
help
perf (sometimes "Perf Events" or perf tools, originally
"Performance Counters for Linux") - is a performance
@@ -32,10 +39,11 @@ config BR2_LINUX_KERNEL_TOOL_PERF
https://perf.wiki.kernel.org/
-config BR2_LINUX_KERNEL_TOOL_SELFTESTS
+config BR2_PACKAGE_LINUX_TOOLS_SELFTESTS
bool"selftests"
depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # bash
depends on BR2_USE_MMU # bash
+ select BR2_PACKAGE_LINUX_TOOLS
select BR2_PACKAGE_BASH # runtime
select BR2_PACKAGE_POPT
select BR2_PACKAGE_LIBCAP_NG
similarity index 79%
rename from linux/linux-tool-cpupower.mk
rename to package/linux-tools/linux-tool-cpupower.mk
@@ -15,26 +15,26 @@ CPUPOWER_MAKE_OPTS = CROSS=$(TARGET_CROSS) \
DEBUG=false
define CPUPOWER_BUILD_CMDS
- $(Q)if test ! -f $(@D)/tools/power/cpupower/Makefile ; then \
+ $(Q)if test ! -f $(LINUX_DIR)/tools/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 $(@D)/tools \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
$(CPUPOWER_MAKE_OPTS) \
cpupower
endef
define CPUPOWER_INSTALL_STAGING_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
$(CPUPOWER_MAKE_OPTS) \
DESTDIR=$(STAGING_DIR) \
cpupower_install
endef
define CPUPOWER_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
$(CPUPOWER_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) \
cpupower_install
similarity index 84%
rename from linux/linux-tool-perf.mk
rename to package/linux-tools/linux-tool-perf.mk
@@ -95,25 +95,25 @@ endif
# We name it 'GNUmakefile' so that GNU make will use it instead of
# the existing 'Makefile'.
define PERF_DISABLE_DOCUMENTATION
- if [ -f $(@D)/tools/perf/Documentation/Makefile ]; then \
- printf "%%:\n\t@:\n" >$(@D)/tools/perf/Documentation/GNUmakefile; \
+ if [ -f $(LINUX_DIR)/tools/perf/Documentation/Makefile ]; then \
+ printf "%%:\n\t@:\n" >$(LINUX_DIR)/tools/perf/Documentation/GNUmakefile; \
fi
endef
LINUX_POST_PATCH_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 $(@D)/tools/perf/ and not just
-# $(@D) so that it isn't built in the root directory of the kernel
+# out of tree build. We build perf in $(LINUX_DIR)/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 $(@D)/tools/perf/Makefile ; then \
+ $(Q)if test ! -f $(LINUX_DIR)/tools/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 $(@D)/tools/perf/Makefile* ; then \
- if ! test -r $(@D)/tools/perf/config/Makefile ; then \
+ if ! grep -q NO_LIBELF $(LINUX_DIR)/tools/perf/Makefile* ; then \
+ if ! test -r $(LINUX_DIR)/tools/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 ; \
@@ -121,14 +121,14 @@ define PERF_BUILD_CMDS
fi \
fi
$(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
- -C $(@D)/tools/perf O=$(@D)/tools/perf/
+ -C $(LINUX_DIR)/tools/perf O=$(LINUX_DIR)/tools/perf/
endef
# After installation, we remove the Perl and Python scripts from the
# target.
define PERF_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
- -C $(@D)/tools/perf O=$(@D)/tools/perf/ install
+ -C $(LINUX_DIR)/tools/perf O=$(LINUX_DIR)/tools/perf/ install
$(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/
$(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/tests/
endef
similarity index 65%
rename from linux/linux-tool-selftests.mk
rename to package/linux-tools/linux-tool-selftests.mk
@@ -23,8 +23,8 @@ SELFTESTS_MAKE_FLAGS = \
ARCH=$(SELFTESTS_ARCH)
# O must be redefined here to overwrite the one used by Buildroot for
-# out of tree build. We build the selftests in $(@D)/tools/selftests and
-# not just $(@D) so that it isn't built in the root directory of the kernel
+# out of tree build. We build the selftests in $(LINUX_DIR)/tools/selftests and
+# not just $(LINUX_DIR) so that it isn't built in the root directory of the kernel
# sources.
#
# The headers_install step here is important as some kernel selftests use a
@@ -33,14 +33,14 @@ SELFTESTS_MAKE_FLAGS = \
# The headers_install target will install the kernel headers locally inside
# the Linux build dir
define SELFTESTS_BUILD_CMDS
- $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) $(SELFTESTS_MAKE_FLAGS) \
+ $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR) $(SELFTESTS_MAKE_FLAGS) \
headers_install
- $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D)/tools/testing/selftests \
- $(SELFTESTS_MAKE_FLAGS) O=$(@D)/tools/testing/selftests
+ $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/testing/selftests \
+ $(SELFTESTS_MAKE_FLAGS) O=$(LINUX_DIR)/tools/testing/selftests
endef
define SELFTESTS_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D)/tools/testing/selftests \
- $(SELFTESTS_MAKE_FLAGS) O=$(@D)/tools/testing/selftests \
+ $(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/testing/selftests \
+ $(SELFTESTS_MAKE_FLAGS) O=$(LINUX_DIR)/tools/testing/selftests \
INSTALL_PATH=$(TARGET_DIR)/usr/lib/kselftests install
endef
new file mode 100644
@@ -0,0 +1,48 @@
+################################################################################
+#
+# linux-tools
+#
+################################################################################
+
+# Vampirising sources from the kernel tree, so no source nor site specified.
+# 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).
+
+# We only need the kernel to be extracted, not actually built
+LINUX_TOOLS_PATCH_DEPENDENCIES = linux
+
+# Install Linux kernel tools in the staging directory since some tools
+# may install shared libraries and headers (e.g. cpupower).
+LINUX_TOOLS_INSTALL_STAGING = YES
+
+# Include all our tools definitions.
+#
+# Note: our package infrastructure uses the full-path of the last-scanned
+# Makefile to determine what package we're currently defining, using the
+# last directory component in the path. As such, including other Makefile,
+# like below, before we call one of the *-package macro is usally not
+# working.
+# However, since the files we include here are in the same directory as
+# the current Makefile, we are OK. But this is a hard requirement: files
+# included here *must* be in the same directory!
+include $(sort $(wildcard linux/linux-tools/linux-ext-*.mk))
+
+LINUX_TOOLS_DEPENDENCIES += $(foreach tool,$(LINUX_TOOLS),\
+ $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
+ $($(call UPPERCASE,$(tool))_DEPENDENCIES)))
+
+LINUX_TOOLS_POST_BUILD_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
+ $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
+ $(call UPPERCASE,$(tool))_BUILD_CMDS))
+
+LINUX_TOOLS_POST_INSTALL_STAGING_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
+ $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
+ $(call UPPERCASE,$(tool))_INSTALL_STAGING_CMDS))
+
+LINUX_TOOLS_POST_INSTALL_TARGET_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
+ $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
+ $(call UPPERCASE,$(tool))_INSTALL_TARGET_CMDS))
+
+$(eval $(generic-package))