commit | 61b9d9ccc29e1301a06476f0aa5b2e1ab705f10b | [log] [tgz] |
---|---|---|
author | Colin Cross <ccross@android.com> | Fri Apr 22 13:10:31 2022 -0700 |
committer | Colin Cross <ccross@android.com> | Fri Apr 22 13:16:32 2022 -0700 |
tree | e89666e108f62e9e4c9553d06e108ac370fe461d | |
parent | 7d7be8894e1bc7b2bbe3aeecdd05326cf540cb37 [diff] |
Hack around linux/compiler-gcc.h issue with musl There is an unfortunate interaction between the bionic uapi headers used by musl and the kernel headers distributed with bpftool. The bionic uapi headers include <linux/compiler_types.h>, which they expect to be resolved to their own copy of compiler_types.h that includes compiler.h. It instead resolves to the bpftool copy, which includes compiler-gcc.h directly, triggering an error if the _LINUX_COMPILER_H_ header guard is not already defined. Hack around it by always including linux/compiler.h from the command line. Bug: 190084016 Test: m USE_HOST_MUSL=true Change-Id: I4151ee13e21b9fcdc8a5c504163af280e1ddfbbe
This is a mirror of bpf-next Linux source tree's tools/bpf/bpftool
directory, plus its few dependencies from under kernel/bpf/
, and its supporting header files.
All the gory details of syncing can be found in scripts/sync-kernel.sh
script.
Some header files in this repo (include/linux/*.h
) are reduced versions of their counterpart files at bpf-next's tools/include/linux/*.h
to make compilation successful.
Please check out the manual pages for documentation about bpftool. A number of example invocations are also displayed in this blog post.
All general BPF questions, including kernel functionality, bpftool features and usage, should be sent to bpf@vger.kernel.org mailing list. You can subscribe to it here and search its archive here. Please search the archive before asking new questions. It very well might be that this was already addressed or answered before.
bpf@vger.kernel.org is monitored by many more people and they will happily try to help you with whatever issue you have. This repository's PRs and issues should be opened only for dealing with issues pertaining to specific way this bpftool mirror repo is set up and organized.
Required:
Optional:
This repository uses libbpf as a submodule. You can initialize it when cloning bpftool:
$ git clone --recurse-submodules https://github.com/libbpf/bpftool.git
Alternatively, if you have already cloned the repository, you can initialize the submodule by running the following command from within the repository:
$ git submodule update --init
To build bpftool:
$ cd src
$ make
To build and install bpftool on the system:
$ cd src # make install
Building bpftool in a separate directory is supported via the OUTPUT
variable:
$ mkdir /tmp/bpftool $ cd src $ OUTPUT=/tmp/bpftool make
Most of the output is suppressed by default, but detailed building logs can be displayed by passing V=1
:
$ cd src $ make V=1
The man pages for bpftool can be built with:
$ cd docs
$ make
They can be installed on the system with:
$ cd docs # make install
This work is dual-licensed under the GNU GPL v2.0 (only) license and the BSD 2-clause license. You can choose between one of them if you use this work.
SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)