From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yonghong Song Subject: Re: [RFC PATCH net-next] tools/bpftool: use version from the kernel source tree Date: Wed, 20 Dec 2017 12:26:30 -0800 Message-ID: <1fa179c1-4725-7e37-b5a9-5d7d8d36a37a@fb.com> References: <20171220201943.24440-1-guro@fb.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Cc: , , , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann To: Roman Gushchin , Return-path: In-Reply-To: <20171220201943.24440-1-guro@fb.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On 12/20/17 12:19 PM, Roman Gushchin wrote: > Bpftool determines it's own version based on the kernel > version, which is picked from the linux/version.h header. > > It's strange to use the version of the installed kernel > headers, and makes much more sense to use the version > of the actual source tree, where bpftool sources are. > > This patch adds $(srctree)/usr/include to the list > of include files, which causes bpftool to use the version > from the source tree. > > Example: > before: > > $ bpftool version > bpftool v4.14.6 > > after: > $ bpftool version > bpftool v4.15.0 > > Signed-off-by: Roman Gushchin > Cc: Jakub Kicinski > Cc: Alexei Starovoitov > Cc: Daniel Borkmann > --- > tools/bpf/bpftool/Makefile | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile > index 9c089cfa5f3f..6864d416c49e 100644 > --- a/tools/bpf/bpftool/Makefile > +++ b/tools/bpf/bpftool/Makefile > @@ -37,7 +37,9 @@ CC = gcc > > CFLAGS += -O2 > CFLAGS += -W -Wall -Wextra -Wno-unused-parameter -Wshadow > -CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/tools/include/uapi -I$(srctree)/tools/include -I$(srctree)/tools/lib/bpf -I$(srctree)/kernel/bpf/ > +CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/tools/include/uapi > +CFLAGS += -I$(srctree)/tools/include -I$(srctree)/tools/lib/bpf > +CFLAGS += -I$(srctree)/kernel/bpf/ -I$(srctree)/usr/include -I$(srctree)/usr/include may not work if build directory is not the same as the source directory. You probably should use -I$(objtree)/usr/include? > LIBS = -lelf -lbfd -lopcodes $(LIBBPF) > > INSTALL ?= install >