mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-10-19 23:31:47 -09:00
bpftrace often needs very recent kernel headers, more recent than the runtime version actually needed. We already had a workaround in libbpf making sure that if the kernel headers are older than 6.1, we would install the libbpf provided headers instead. As we are about to update bpftrace to a newer version that uses BPF_TRACE_KPROBE_SESSION, which was introduced in Linux 6.10, we need to update this workaround accordingly and ensure that the libbpf header is installed if the kernel headers are older than 6.10. This is necessary for the update of bpftrace to 0.26.1. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Julien Olivain <ju.o@free.fr>
53 lines
1.8 KiB
Makefile
53 lines
1.8 KiB
Makefile
################################################################################
|
|
#
|
|
# libbpf
|
|
#
|
|
################################################################################
|
|
|
|
LIBBPF_VERSION = 1.6.2
|
|
LIBBPF_SITE = $(call github,libbpf,libbpf,v$(LIBBPF_VERSION))
|
|
LIBBPF_LICENSE = GPL-2.0, LGPL-2.1, BSD-2-Clause
|
|
LIBBPF_LICENSE_FILES = LICENSE LICENSE.BSD-2-Clause LICENSE.LGPL-2.1
|
|
LIBBPF_CPE_ID_VALID = YES
|
|
LIBBPF_DEPENDENCIES = host-bison host-flex host-pkgconf elfutils zlib
|
|
HOST_LIBBPF_DEPENDENCIES = host-bison host-flex host-pkgconf host-elfutils host-zlib
|
|
LIBBPF_INSTALL_STAGING = YES
|
|
|
|
define LIBBPF_BUILD_CMDS
|
|
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \
|
|
-C $(@D)/src
|
|
endef
|
|
|
|
# bpftrace uses BPF_TRACE_KPROBE_SESSION that was added since kernel 6.10
|
|
# so we need to update some uapi headers in STAGING_DIR if the toolchain
|
|
# is build with linux-headers < 6.1.0
|
|
# Otherwise bpftrace is broken due to out of date linux/bpf.h installed
|
|
# by the toolchain.
|
|
ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_6_10),)
|
|
LIBBPF_UPDATE_UAPI_HEADERS = install_uapi_headers UAPIDIR=/usr/include/bpf
|
|
|
|
define LIBBPF_FIX_STAGING_PC
|
|
$(SED) 's/-I$${includedir}/-I$${includedir}\/bpf -I$${includedir}/' $(STAGING_DIR)/usr/lib/pkgconfig/libbpf.pc
|
|
endef
|
|
LIBBPF_POST_INSTALL_STAGING_HOOKS += LIBBPF_FIX_STAGING_PC
|
|
endif
|
|
|
|
define LIBBPF_INSTALL_STAGING_CMDS
|
|
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \
|
|
-C $(@D)/src install $(LIBBPF_UPDATE_UAPI_HEADERS) \
|
|
DESTDIR=$(STAGING_DIR)
|
|
endef
|
|
|
|
define LIBBPF_INSTALL_TARGET_CMDS
|
|
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \
|
|
-C $(@D)/src install DESTDIR=$(TARGET_DIR)
|
|
endef
|
|
|
|
define HOST_LIBBPF_INSTALL_CMDS
|
|
$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) \
|
|
-C $(@D)/src install install_uapi_headers DESTDIR=$(HOST_DIR)
|
|
endef
|
|
|
|
$(eval $(generic-package))
|
|
$(eval $(host-generic-package))
|