1bpftool 2======= 3 4This is a mirror of [bpf-next Linux source tree's 5`tools/bpf/bpftool`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/bpf/bpftool) 6directory, plus its few dependencies from under `kernel/bpf/`, and its 7supporting header files. 8 9All the gory details of syncing can be found in `scripts/sync-kernel.sh` 10script. 11 12Some header files in this repo (`include/linux/*.h`) are reduced versions of 13their counterpart files at 14[bpf-next](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/)'s 15`tools/include/linux/*.h` to make compilation successful. 16 17BPF/bpftool usage and questions 18------------------------------- 19 20Please check out [the manual pages](docs) for documentation about bpftool. A 21number of example invocations are also displayed in [this blog 22post](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/bpf/bpftool). 23 24All general BPF questions, including kernel functionality, bpftool features and 25usage, should be sent to bpf@vger.kernel.org mailing list. You can subscribe to 26it [here](http://vger.kernel.org/vger-lists.html#bpf) and search its archive 27[here](https://lore.kernel.org/bpf/). Please search the archive before asking 28new questions. It very well might be that this was already addressed or 29answered before. 30 31bpf@vger.kernel.org is monitored by many more people and they will happily try 32to help you with whatever issue you have. This repository's PRs and issues 33should be opened only for dealing with issues pertaining to specific way this 34bpftool mirror repo is set up and organized. 35 36Dependencies 37------------ 38 39Required: 40 41- libelf 42- zlib 43 44Optional: 45 46- libbfd (for dumping JIT-compiled program instructions) 47- libcap (for better feature probing) 48- kernel BTF information (for profiling programs or showing PIDs of processes 49 referencing BPF objects) 50- clang/LLVM (idem) 51 52Build 53[![build](https://github.com/libbpf/bpftool/actions/workflows/build.yaml/badge.svg)](https://github.com/libbpf/bpftool/actions/workflows/build.yaml) 54----- 55 56### Initialize libbpf submodule 57 58This repository uses libbpf as a submodule. You can initialize it when cloning 59bpftool: 60 61```console 62$ git clone --recurse-submodules https://github.com/libbpf/bpftool.git 63``` 64 65Alternatively, if you have already cloned the repository, you can initialize 66the submodule by running the following command from within the repository: 67 68```console 69$ git submodule update --init 70``` 71 72### Build bpftool 73 74To build bpftool: 75 76```console 77$ cd src 78$ make 79``` 80 81To build and install bpftool on the system: 82 83```console 84$ cd src 85# make install 86``` 87 88Building bpftool in a separate directory is supported via the `OUTPUT` variable: 89 90```console 91$ mkdir /tmp/bpftool 92$ cd src 93$ OUTPUT=/tmp/bpftool make 94``` 95 96Most of the output is suppressed by default, but detailed building logs can be 97displayed by passing `V=1`: 98 99```console 100$ cd src 101$ make V=1 102``` 103 104### Build bpftool's man pages 105 106The man pages for bpftool can be built with: 107 108```console 109$ cd docs 110$ make 111``` 112 113They can be installed on the system with: 114 115```console 116$ cd docs 117# make install 118``` 119 120License 121------- 122 123This work is dual-licensed under the GNU GPL v2.0 (only) license and the 124BSD 2-clause license. You can choose between one of them if you use this work. 125 126`SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)` 127