first commit: base 2024.08

Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
This commit is contained in:
tao89959
2025-02-12 17:59:29 +08:00
committed by maoxiaochuan
commit f3217a7708
14356 changed files with 572894 additions and 0 deletions
+259
View File
@@ -0,0 +1,259 @@
menu "Linux Kernel Tools"
# 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_STATIC_LIBS
select BR2_PACKAGE_LINUX_TOOLS
select BR2_PACKAGE_PCIUTILS
help
cpupower is a collection of tools to examine and tune power
saving related features of your processor.
comment "cpupower needs a toolchain w/ dynamic library"
depends on BR2_STATIC_LIBS
config BR2_PACKAGE_LINUX_TOOLS_GPIO
bool "gpio"
select BR2_PACKAGE_LINUX_TOOLS
help
gpio is a collection of tools to get information about,
control and monitor gpios present on system.
These tools use new gpio ABI which will deprecate sysfs gpio
interface in the future.
These tools are available only from kernel version 4.8.
config BR2_PACKAGE_LINUX_TOOLS_IIO
bool "iio"
select BR2_PACKAGE_LINUX_TOOLS
help
iio is a collection of tools to get information about,
control and monitor iio devices present on system.
These tools are available only from kernel version 4.7.
config BR2_PACKAGE_LINUX_TOOLS_MM
bool "mm"
select BR2_PACKAGE_LINUX_TOOLS
help
mm is a toolset for testing/monitoring/tracing vm/pages/slabs
objects.
- page_owner_sort: userspace helper to sort the output of
/sys/kernel/debug/page_owner, which helps to know who
allocates the page from kernel context
- slabinfo: the tool which gets reports about slabs, for
example show empty slabs, modify of slab debug options at
runtime, display all information about a slabcache
- page-types: a handy tool for querying page flags
These tools are available only from kernel version 3.4.
config BR2_PACKAGE_LINUX_TOOLS_PCI
bool "pci"
select BR2_PACKAGE_LINUX_TOOLS
help
pcitest is a tool for testing capabilities related to a
PCI Endpoint (only works with specific Endpoints).
These tools are available only from kernel version 4.20.
comment "perf needs a toolchain w/ dynamic library, threads"
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS
config BR2_PACKAGE_LINUX_TOOLS_PERF
bool "perf"
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on !BR2_STATIC_LIBS # dlfcn.h
depends on BR2_TOOLCHAIN_HAS_THREADS
select BR2_PACKAGE_LINUX_TOOLS
help
perf (sometimes "Perf Events" or perf tools, originally
"Performance Counters for Linux") - is a performance
analyzing tool in Linux, available from kernel version
2.6.31. User-space controlling utility, called 'perf' has
git-like interface with subcommands. It is capable of
statistical profiling of entire system (both kernel and user
code), single CPU or severals threads.
This will build and install the userspace 'perf'
command.
Your kernel must have CONFIG_PERF_EVENTS enabled to use perf
profiling. Buildroot automatically enables this in the kernel
configuration.
https://perf.wiki.kernel.org/
if BR2_PACKAGE_LINUX_TOOLS_PERF
config BR2_PACKAGE_LINUX_TOOLS_PERF_SCRIPTS
bool "enable installation of perf scripts"
help
Enable the installation of the perf scripts under
/usr/libexec/perf-core/ which is necessary for running "perf
tests"
config BR2_PACKAGE_LINUX_TOOLS_PERF_TUI
bool "enable perf TUI"
depends on BR2_USE_MMU # slang
select BR2_PACKAGE_SLANG
help
Enable the TUI interface for perf which requires a TTY and
enables zooming into DSOs and threads as well as other
features.
config BR2_PACKAGE_LINUX_TOOLS_PERF_NEEDS_HOST_PYTHON3
bool "perf need python3 to build"
select BR2_PACKAGE_HOST_PYTHON3
help
Starting with linux 6.0, parts of the perf source code
is generated by running a python3 script.
endif
config BR2_PACKAGE_LINUX_TOOLS_RTLA
bool "rtla"
depends on BR2_TOOLCHAIN_HAS_THREADS # libtracefs
depends on !BR2_STATIC_LIBS # libtracefs
select BR2_PACKAGE_LINUX_TOOLS
select BR2_PACKAGE_LIBTRACEFS
help
These tracers allow performing latency analysis, for which the
rtla tool provides wrapper commands to visualize and extract
latency traces and reports.
rtla includes three tracers, which have been introduced in
different kernel versions:
- Linux 5.19 introduced the osnoise and timerlat tracers,
- Linux 6.3 introduced the hwnoise tracer
osnoise and timerlat are always installed, while hwnoise is
installed if your kernel is recent enough.
Note: rtla in kernels before 5.19 had additional dependencies,
not available in Buildroot, so only rtla in kernels 5.19
onwards is actually supported in Buildroot.
comment "rtla needs a toolchain w/ threads, dynamic library"
depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
config BR2_PACKAGE_LINUX_TOOLS_SELFTESTS
bool"selftests"
depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # bash
depends on BR2_USE_MMU # bash
depends on !BR2_STATIC_LIBS
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_14 # util-linux schedutils
select BR2_PACKAGE_LINUX_TOOLS
select BR2_PACKAGE_BASH # runtime
select BR2_PACKAGE_NCURSES
select BR2_PACKAGE_NCURSES_TARGET_PROGS # runtime (tput)
select BR2_PACKAGE_KMOD
select BR2_PACKAGE_KMOD_TOOLS # runtime (modprobe -n)
select BR2_PACKAGE_POPT
select BR2_PACKAGE_LIBCAP_NG
select BR2_PACKAGE_UTIL_LINUX
select BR2_PACKAGE_UTIL_LINUX_SCHEDUTILS # runtime (taskset)
select BR2_PACKAGE_OPENSSL if BR2_x86_64
help
Build and install (to /usr/lib/kselftests) kernel selftests.
Use of this option implies you know the process of using and
compiling the kernel selftests. The Makefile to build and
install these is very noisy and may appear to cause your
build to fail for strange reasons.
This is very much a use at your risk option and may not work
for every setup or every architecture.
comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS and a toolchain w/ dynamic library and headers >= 3.14"
depends on BR2_USE_MMU
depends on !BR2_PACKAGE_BUSYBOX_SHOW_OTHERS || \
BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_14
config BR2_PACKAGE_LINUX_TOOLS_USBTOOLS
bool "USB test programs"
select BR2_PACKAGE_LINUX_TOOLS
help
Build and install the USB test tools.
These tools exist since Linux 2.6.35, but Buildroot can build
them only with kernel versions 5.9 and later.
if BR2_PACKAGE_LINUX_TOOLS_USBTOOLS
config BR2_PACKAGE_LINUX_TOOLS_USBTOOLS_TESTUSB
bool "testusb"
help
testusb issues ioctls to perform the tests implemented by the
kernel driver. It can generate a variety of transfer
patterns.
See http://www.linux-usb.org/usbtest/
config BR2_PACKAGE_LINUX_TOOLS_USBTOOLS_FFSTEST
bool "ffs-test"
help
User mode filesystem api for usb composite function
endif
config BR2_PACKAGE_LINUX_TOOLS_TMON
bool "tmon"
depends on BR2_TOOLCHAIN_HAS_THREADS
select BR2_PACKAGE_LINUX_TOOLS
select BR2_PACKAGE_NCURSES
help
tmon is a terminal-based tool (using curses) that allows the
user to access thermal information about the system.
comment "tmon needs a toolchain w/ threads"
depends on !BR2_TOOLCHAIN_HAS_THREADS
config BR2_PACKAGE_LINUX_TOOLS_HV
bool "hv"
depends on BR2_i386 || BR2_x86_64
select BR2_PACKAGE_LINUX_TOOLS
select BR2_PACKAGE_LINUX_TOOLS_HV_KVP_DAEMON if !BR2_PACKAGE_LINUX_TOOLS_HV_HAS_ONE
help
Microsoft HyperV integration services
Relevant kernel configuration options: CONFIG_HYPERV,
CONFIG_HYPERV_UTILS.
if BR2_PACKAGE_LINUX_TOOLS_HV
config BR2_PACKAGE_LINUX_TOOLS_HV_HAS_ONE
bool
config BR2_PACKAGE_LINUX_TOOLS_HV_KVP_DAEMON
bool "hypervkvpd (hv_kvp_daemon)"
help
HyperV uses hypervkvpd (Key/Value Pair daemon) to retrieve
status information from your virtualized guest OS
config BR2_PACKAGE_LINUX_TOOLS_HV_FCOPY_DAEMON
bool "hypervfcopyd (hv_fcopy_daemon)"
select BR2_PACKAGE_LINUX_TOOLS_HV_HAS_ONE
help
HyperV uses hypervfcopyd (File Copy daemon) to easily transfer
files to and from your virtualized guest OS
config BR2_PACKAGE_LINUX_TOOLS_HV_VSS_DAEMON
bool "hypervvssd (hv_vss_daemon)"
select BR2_PACKAGE_LINUX_TOOLS_HV_HAS_ONE
help
HyperV uses hypervvssd (Volume Snapshot Service daemon) to
freeze your filesystems during snapshots and backups
endif # BR2_PACKAGE_LINUX_TOOLS_HV
endmenu
+70
View File
@@ -0,0 +1,70 @@
#!/bin/sh
PROGS="@PROGS@"
PIDDIR="/var/run"
DAEMON="hyperv"
# shellcheck source=/dev/null
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
# only continue if we are in a HyperV platform
[ -e "/sys/bus/vmbus" ] || exit 0
start_one() {
printf 'Starting %s: ' "$1"
# shellcheck disable=SC2086 # we need the word splitting
start-stop-daemon -b -m -S -q -p "$PIDDIR/$1.pid" -x "/usr/sbin/$1" -- -n
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return $status
}
start() {
# shellcheck disable=SC2086 # we need the word splitting
for prog in ${PROGS}; do
start_one "${prog}" || ret=$?
done
return "$ret"
}
stop_one() {
printf 'Stopping %s: ' "$1"
start-stop-daemon -K -q -p "$PIDDIR/$1.pid"
status=$?
if [ "$status" -eq 0 ]; then
rm -f "$PIDDIR/$1.pid"
echo "OK"
else
echo "FAIL"
fi
return $status
}
stop() {
# shellcheck disable=SC2086 # we need the word splitting
for prog in ${PROGS}; do
stop_one "${prog}" || ret=$?
done
return "$ret"
}
restart() {
stop
sleep 1
start
}
case "$1" in
start|stop|restart)
"$1";;
reload)
# Restart, since there is no true "reload" feature.
restart;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
+11
View File
@@ -0,0 +1,11 @@
[Unit]
Description=HyperV FCopy daemon
After=syslog.target
ConditionVirtualization=microsoft
[Service]
Type=simple
ExecStart=/usr/sbin/hypervfcopyd -n
[Install]
WantedBy=multi-user.target
+11
View File
@@ -0,0 +1,11 @@
[Unit]
Description=HyperV KVP daemon
After=syslog.target
ConditionVirtualization=microsoft
[Service]
Type=simple
ExecStart=/usr/sbin/hypervkvpd -n
[Install]
WantedBy=multi-user.target
+11
View File
@@ -0,0 +1,11 @@
[Unit]
Description=HyperV VSS daemon
After=syslog.target
ConditionVirtualization=microsoft
[Service]
Type=simple
ExecStart=/usr/sbin/hypervvssd -n
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,41 @@
################################################################################
#
# cpupower
#
################################################################################
LINUX_TOOLS += cpupower
CPUPOWER_DEPENDENCIES = pciutils $(TARGET_NLS_DEPENDENCIES)
CPUPOWER_MAKE_OPTS = CROSS=$(TARGET_CROSS) \
CPUFREQ_BENCH=false \
NLS=false \
LDFLAGS=$(TARGET_NLS_LIBS) \
DEBUG=false
define CPUPOWER_BUILD_CMDS
$(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 $(LINUX_DIR)/tools \
$(CPUPOWER_MAKE_OPTS) \
cpupower
endef
define CPUPOWER_INSTALL_STAGING_CMDS
$(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 $(LINUX_DIR)/tools \
$(CPUPOWER_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) \
cpupower_install
endef
+28
View File
@@ -0,0 +1,28 @@
################################################################################
#
# gpio
#
################################################################################
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 \
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 \
$(GPIO_MAKE_OPTS) \
gpio
endef
define GPIO_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools \
$(GPIO_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) \
gpio_install
endef
+61
View File
@@ -0,0 +1,61 @@
################################################################################
#
# hv_fcopy_daemon
#
################################################################################
LINUX_TOOLS += hv
# The programs to build, as known by the kernel:
HV_PROGS_$(BR2_PACKAGE_LINUX_TOOLS_HV_KVP_DAEMON) += hv_kvp_daemon
HV_PROGS_$(BR2_PACKAGE_LINUX_TOOLS_HV_FCOPY_DAEMON) += hv_fcopy_daemon
HV_PROGS_$(BR2_PACKAGE_LINUX_TOOLS_HV_VSS_DAEMON) += hv_vss_daemon
# Give each tools the name most distros install them as:
HV_hv_kvp_daemon = hypervkvpd
HV_hv_fcopy_daemon = hypervfcopyd
HV_hv_vss_daemon = hypervvssd
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 \
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 \
$(HV_MAKE_OPTS) \
$(HV_PROGS_y)
endef
ifeq ($(BR2_PACKAGE_LINUX_TOOLS_HV_KVP_DAEMON),y)
define HV_KVP_HELPER
@mkdir -p $(TARGET_DIR)/usr/libexec/hypervkvpd
$(Q)ln -sf /bin/true $(TARGET_DIR)/usr/libexec/hypervkvpd/hv_set_ifconfig
endef
endif
define HV_INSTALL_TARGET_CMDS
$(foreach prog,$(HV_PROGS_y), \
$(INSTALL) -m 0755 -D $(LINUX_DIR)/tools/hv/$(prog) \
$(TARGET_DIR)/usr/sbin/$(HV_$(prog))
)
$(HV_KVP_HELPER)
endef
define HV_INSTALL_INIT_SYSTEMD
$(foreach prog,$(HV_PROGS_y), \
$(INSTALL) -m 0644 -D package/linux-tools/$(HV_$(prog)).service \
$(TARGET_DIR)/usr/lib/systemd/system/$(HV_$(prog)).service
)
endef
define HV_INSTALL_INIT_SYSV
$(INSTALL) -m 0755 -D package/linux-tools/S10hyperv \
$(TARGET_DIR)/etc/init.d/S10hyperv
$(SED) 's/@PROGS@/$(foreach prog,$(HV_PROGS_y),$(HV_$(prog)))/' \
$(TARGET_DIR)/etc/init.d/S10hyperv
endef
+29
View File
@@ -0,0 +1,29 @@
################################################################################
#
# iio
#
################################################################################
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 \
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 \
$(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 \
$(IIO_MAKE_OPTS) \
INSTALL_ROOT=$(TARGET_DIR) \
DESTDIR=$(TARGET_DIR) \
install
endef
+37
View File
@@ -0,0 +1,37 @@
################################################################################
#
# mm
#
################################################################################
LINUX_TOOLS += mm
define MM_BUILD_CMDS
$(Q)if test -f $(LINUX_DIR)/tools/vm/Makefile ; then \
MM_SUBDIR=vm; \
elif test -f $(LINUX_DIR)/tools/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 \
$(MM_MAKE_OPTS) $${MM_SUBDIR}
endef
# For install no need to recheck both cases: we know at least one
# 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 \
MM_SUBDIR=vm; \
else \
MM_SUBDIR=mm; \
fi ; \
$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
$(LINUX_MAKE_FLAGS) \
INSTALL_ROOT=$(TARGET_DIR) \
DESTDIR=$(TARGET_DIR) \
$${MM_SUBDIR}_install
endef
+27
View File
@@ -0,0 +1,27 @@
################################################################################
#
# pci
#
################################################################################
LINUX_TOOLS += pci
PCI_MAKE_OPTS = $(LINUX_MAKE_FLAGS) LDFLAGS="$(TARGET_LDFLAGS)"
define PCI_BUILD_CMDS
$(Q)if ! grep install $(LINUX_DIR)/tools/pci/Makefile >/dev/null 2>&1 ; then \
echo "Your kernel version is too old and does not have install section in the pci tools." ; \
echo "At least kernel 4.20 must be used." ; \
exit 1 ; \
fi
$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/pci \
$(PCI_MAKE_OPTS)
endef
define PCI_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/pci \
$(PCI_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) \
install
endef
+194
View File
@@ -0,0 +1,194 @@
################################################################################
#
# perf
#
################################################################################
LINUX_TOOLS += perf
PERF_DEPENDENCIES = host-flex host-bison
ifeq ($(BR2_PACKAGE_LINUX_TOOLS_PERF_NEEDS_HOST_PYTHON3),y)
PERF_DEPENDENCIES += host-python3
endif
ifeq ($(NORMALIZED_ARCH),x86_64)
PERF_ARCH=x86
else
PERF_ARCH=$(NORMALIZED_ARCH)
endif
PERF_MAKE_FLAGS = \
$(LINUX_MAKE_FLAGS) \
JOBS=$(PARALLEL_JOBS) \
ARCH=$(PERF_ARCH) \
DESTDIR=$(TARGET_DIR) \
prefix=/usr \
NO_GTK2=1 \
NO_LIBPERL=1 \
NO_LIBPYTHON=1 \
NO_LIBBIONIC=1 \
NO_LIBTRACEEVENT=1
# We need to pass an argument to ld for setting the emulation when
# building for MIPS architecture, otherwise the default one will always
# be used and the compilation for most variants will fail.
ifeq ($(BR2_mips),y)
PERF_MAKE_FLAGS += LD="$(TARGET_LD) -m elf32btsmip"
else ifeq ($(BR2_mipsel),y)
PERF_MAKE_FLAGS += LD="$(TARGET_LD) -m elf32ltsmip"
else ifeq ($(BR2_mips64),y)
ifeq ($(BR2_MIPS_NABI32),y)
PERF_MAKE_FLAGS += LD="$(TARGET_LD) -m elf32btsmipn32"
else
PERF_MAKE_FLAGS += LD="$(TARGET_LD) -m elf64btsmip"
endif
else ifeq ($(BR2_mips64el),y)
ifeq ($(BR2_MIPS_NABI32),y)
PERF_MAKE_FLAGS += LD="$(TARGET_LD) -m elf32ltsmipn32"
else
PERF_MAKE_FLAGS += LD="$(TARGET_LD) -m elf64ltsmip"
endif
endif
# The call to backtrace() function fails for ARC, because for some
# reason the unwinder from libgcc returns early. Thus the usage of
# backtrace() should be disabled in perf explicitly: at build time
# backtrace() appears to be available, but it fails at runtime: the
# backtrace will contain only several functions from the top of stack,
# instead of the complete backtrace.
ifeq ($(BR2_arc),y)
PERF_MAKE_FLAGS += NO_BACKTRACE=1
endif
ifeq ($(BR2_PACKAGE_LINUX_TOOLS_PERF_TUI),y)
PERF_DEPENDENCIES += slang
else
PERF_MAKE_FLAGS += NO_NEWT=1 NO_SLANG=1
endif
ifeq ($(BR2_PACKAGE_AUDIT),y)
PERF_DEPENDENCIES += audit
else
PERF_MAKE_FLAGS += NO_LIBAUDIT=1
endif
ifeq ($(BR2_PACKAGE_ZSTD),y)
PERF_DEPENDENCIES += zstd
endif
ifeq ($(BR2_PACKAGE_LIBUNWIND),y)
PERF_DEPENDENCIES += libunwind
else
PERF_MAKE_FLAGS += NO_LIBUNWIND=1
endif
ifeq ($(BR2_PACKAGE_NUMACTL),y)
PERF_DEPENDENCIES += numactl
else
PERF_MAKE_FLAGS += NO_LIBNUMA=1
endif
ifeq ($(BR2_PACKAGE_ELFUTILS),y)
PERF_DEPENDENCIES += elfutils
else
PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1
endif
ifeq ($(BR2_PACKAGE_BINUTILS),y)
PERF_DEPENDENCIES += binutils
else
PERF_MAKE_FLAGS += NO_DEMANGLE=1
endif
ifeq ($(BR2_PACKAGE_OPENSSL),y)
PERF_DEPENDENCIES += openssl
else
PERF_MAKE_FLAGS += NO_LIBCRYPTO=1
endif
ifeq ($(BR2_PACKAGE_ZLIB),y)
PERF_DEPENDENCIES += zlib
else
PERF_MAKE_FLAGS += NO_ZLIB=1
endif
# lzma is provided by xz
ifeq ($(BR2_PACKAGE_XZ),y)
PERF_DEPENDENCIES += xz
else
PERF_MAKE_FLAGS += NO_LZMA=1
endif
ifeq ($(BR2_PACKAGE_OPENCSD),y)
PERF_DEPENDENCIES += opencsd
PERF_MAKE_FLAGS += CORESIGHT=1
# There is no "else CORESIGHT=0" case, because "perf" Makefile uses
# bare "ifdef CORESIGHT" constructs.
endif
# We really do not want to build the perf documentation, because it
# has stringent requirement on the documentation generation tools,
# like xmlto and asciidoc), which may be lagging behind on some
# distributions.
# We name it 'GNUmakefile' so that GNU make will use it instead of
# the existing 'Makefile'.
define PERF_DISABLE_DOCUMENTATION
if [ -f $(LINUX_DIR)/tools/perf/Documentation/Makefile ]; then \
printf "%%:\n\t@:\n" >$(LINUX_DIR)/tools/perf/Documentation/GNUmakefile; \
fi
endef
LINUX_TOOLS_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 $(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 $(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 $(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 ; \
fi \
fi \
fi
$(Q)if test "$(BR2_PACKAGE_LINUX_TOOLS_PERF_TUI)" = "y" ; then \
if ! grep -q NO_SLANG $(LINUX_DIR)/tools/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/
endef
# After installation, we remove the Perl and Python scripts from the
# target unless BR2_PACKAGE_LINUX_TOOLS_PERF_SCRIPTS is enabled
ifeq ($(BR2_PACKAGE_LINUX_TOOLS_PERF_SCRIPTS),)
define PERF_INSTALL_REMOVE_SCRIPTS
$(RM) -r $(TARGET_DIR)/usr/libexec/perf-core/scripts/
$(RM) -r $(TARGET_DIR)/usr/libexec/perf-core/tests/
endef
LINUX_TOOLS_BIN_ARCH_EXCLUDE += \
/usr/libexec/perf-core/tests/pe-file.exe \
/usr/libexec/perf-core/tests/pe-file.exe.debug
endif
define PERF_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
-C $(LINUX_DIR)/tools/perf O=$(LINUX_DIR)/tools/perf/ install
$(PERF_INSTALL_REMOVE_SCRIPTS)
endef
define PERF_LINUX_CONFIG_FIXUPS
$(call KCONFIG_ENABLE_OPT,CONFIG_PERF_EVENTS)
endef
+52
View File
@@ -0,0 +1,52 @@
################################################################################
#
# rtla
#
################################################################################
LINUX_TOOLS += rtla
RTLA_DEPENDENCIES = host-pkgconf libtracefs
RTLA_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
CC=$(TARGET_CC) \
EXTRA_CFLAGS="-D_GNU_SOURCE" \
LDFLAGS="$(TARGET_LDFLAGS)" \
PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig
ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
define RTLA_DISABLE_STACK_PROTECTOR
$(SED) 's/-fstack-protector.* //' $(LINUX_DIR)/tools/tracing/rtla/Makefile
endef
endif
define RTLA_LINUX_CONFIG_FIXUPS
$(call KCONFIG_ENABLE_OPT,CONFIG_FTRACE)
$(call KCONFIG_ENABLE_OPT,CONFIG_TIMERLAT_TRACER)
$(call KCONFIG_ENABLE_OPT,CONFIG_HIST_TRIGGERS)
endef
define RTLA_BUILD_CMDS
$(Q)if ! grep install $(LINUX_DIR)/tools/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
endef
# make rtla_install build and install by default documentation using rst2man
# but it's not available in Buildroot and we don't want manual files in target
# 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
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 \
ln -sf rtla $(TARGET_DIR)/usr/bin/hwnoise ; \
fi
endef
@@ -0,0 +1,50 @@
################################################################################
#
# selftests
#
################################################################################
LINUX_TOOLS += selftests
ifeq ($(NORMALIZED_ARCH),x86_64)
SELFTESTS_ARCH=x86
else
ifeq ($(NORMALIZED_ARCH),i386)
SELFTESTS_ARCH=x86
else
SELFTESTS_ARCH=$(NORMALIZED_ARCH)
endif
endif
SELFTESTS_DEPENDENCIES = \
libcap-ng \
popt \
$(if $(BR2_PACKAGE_OPENSSL),openssl)
SELFTESTS_MAKE_FLAGS = \
$(LINUX_MAKE_FLAGS) \
ARCH=$(SELFTESTS_ARCH) \
KHDR_DIR=$(LINUX_DIR)/usr/include
# 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
# 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
# hardcoded CFLAGS to find kernel headers e.g:
# CFLAGS += -I../../../../usr/include/
# The headers_install target will install the kernel headers locally inside
# the Linux build dir
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
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 \
INSTALL_PATH=$(TARGET_DIR)/usr/lib/kselftests install
endef
+38
View File
@@ -0,0 +1,38 @@
################################################################################
#
# tmon
#
################################################################################
LINUX_TOOLS += tmon
TMON_DEPENDENCIES = host-pkgconf ncurses
TMON_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
CC=$(TARGET_CC) \
LDFLAGS="$(TARGET_LDFLAGS)" \
PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig
ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
define TMON_DISABLE_STACK_PROTECTOR
$(SED) 's%-fstack-protector%%' $(LINUX_DIR)/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 \
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 \
$(TMON_MAKE_OPTS) \
tmon
endef
define TMON_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
$(TMON_MAKE_OPTS) \
INSTALL_ROOT=$(TARGET_DIR) \
tmon_install
endef
@@ -0,0 +1,34 @@
################################################################################
#
# usbtools
#
################################################################################
LINUX_TOOLS += usbtools
USBTOOLS_MAKE_OPTS = $(LINUX_MAKE_FLAGS) LDFLAGS="$(TARGET_LDFLAGS)"
LINUX_TOOLS_USBTOOLS_LIST = \
$(if $(BR2_PACKAGE_LINUX_TOOLS_USBTOOLS_TESTUSB),testusb) \
$(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 \
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 \
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 \
ALL_TARGETS="$(LINUX_TOOLS_USBTOOLS_LIST)" \
$(USBTOOLS_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) \
install
endef
+74
View File
@@ -0,0 +1,74 @@
################################################################################
#
# 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).
# 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
# a chance to register itself once, and only once. Therefore, the makefiles
# are named linux-tool-*.mk.in, so they won't be picked up by the top-level
# Makefile, but can be included here, guaranteeing the single inclusion and
# the proper ordering.
include $(sort $(wildcard package/linux-tools/*.mk.in))
# 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
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))
define LINUX_TOOLS_LINUX_CONFIG_FIXUPS
$(foreach tool,$(LINUX_TOOLS),\
$(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
$($(call UPPERCASE,$(tool))_LINUX_CONFIG_FIXUPS))
)
endef
define LINUX_TOOLS_INSTALL_INIT_SYSTEMD
$(foreach tool,$(LINUX_TOOLS),\
$(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
$($(call UPPERCASE,$(tool))_INSTALL_INIT_SYSTEMD))
)
endef
define LINUX_TOOLS_INSTALL_INIT_SYSV
$(foreach tool,$(LINUX_TOOLS),\
$(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
$($(call UPPERCASE,$(tool))_INSTALL_INIT_SYSV))
)
endef
define LINUX_TOOLS_INSTALL_INIT_OPENRC
$(foreach tool,$(LINUX_TOOLS),\
$(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
$(or $($(call UPPERCASE,$(tool))_INSTALL_INIT_OPENRC),\
$($(call UPPERCASE,$(tool))_INSTALL_INIT_SYSV)))
)
endef
$(eval $(generic-package))