lkml.org 
[lkml]   [2020]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC 1/2] perf: support build BPF skeletons with perf
On Wed, Nov 18, 2020 at 08:50:45PM -0800, Song Liu wrote:

SNIP

> diff --git a/tools/perf/util/bpf_skel/.gitignore b/tools/perf/util/bpf_skel/.gitignore
> new file mode 100644
> index 0000000000000..5263e9e6c5d83
> --- /dev/null
> +++ b/tools/perf/util/bpf_skel/.gitignore
> @@ -0,0 +1,3 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +.tmp
> +*.skel.h
> \ No newline at end of file
> diff --git a/tools/perf/util/bpf_skel/Makefile b/tools/perf/util/bpf_skel/Makefile
> new file mode 100644
> index 0000000000000..853bece088f4b
> --- /dev/null
> +++ b/tools/perf/util/bpf_skel/Makefile
> @@ -0,0 +1,71 @@
> +# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
> +SKEL_OUTPUT := $(abspath .)
> +TMP_OUTPUT := $(abspath .tmp)
> +CLANG ?= clang
> +LLC ?= llc
> +LLVM_STRIP ?= llvm-strip
> +DEFAULT_BPFTOOL := $(TMP_OUTPUT)/sbin/bpftool
> +BPFTOOL ?= $(DEFAULT_BPFTOOL)
> +LIBBPF_SRC := $(abspath ../../../lib/bpf)
> +BPFOBJ := $(TMP_OUTPUT)/libbpf.a
> +BPF_INCLUDE := $(TMP_OUTPUT)
> +INCLUDES := -I$(TMP_OUTPUT) -I$(BPF_INCLUDE) -I$(abspath ../../../lib) \
> + -I$(abspath ../../../include/uapi)
> +CFLAGS := -g -Wall
> +
> +# Try to detect best kernel BTF source
> +KERNEL_REL := $(shell uname -r)
> +VMLINUX_BTF_PATHS := /sys/kernel/btf/vmlinux /boot/vmlinux-$(KERNEL_REL)
> +VMLINUX_BTF_PATH := $(or $(VMLINUX_BTF),$(firstword \
> + $(wildcard $(VMLINUX_BTF_PATHS))))
> +ifeq ($(V),1)
> +Q =
> +msg =
> +else
> +Q = @
> +msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))";
> +MAKEFLAGS += --no-print-directory
> +submake_extras := feature_display=0
> +endif

some of the above should already be defined in the base Makefile.perf
we should use that, I think it'd fit better in the Makefile.perf itself

jirka

\
 
 \ /
  Last update: 2020-11-23 00:35    [W:0.227 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site