Build from Linux tree
Build bpftool from the Linux kernel repository
The source code for bpftool can be found in the Linux kernel repository, under
tools/bpf/bpftool. You can download the sources from the latest
Linux version from kernel.org, or you can clone the Git repository:
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
$ cd linux
Once you have downloaded the sources or cloned the repository, compile bpftool
by running make from bpftool’s directory:
$ cd tools/bpf/bpftool
$ make
The same options as for building from the GitHub mirror repository apply. For example, you can run make install to install bpftool on the system, or pass V=1 to the make invocation for a more verbose output.