libbpf-cargo 0.1.2

Cargo plugin to build bpf programs
libbpf-cargo-0.1.2 is not a library.
Visit the last successful build: libbpf-cargo-0.23.0

cargo libbpf

cargo libbpf is a cargo subcommand that helps develop and build eBPF (BPF) programs.

Configuration

libbpf-cargo provides the following configuration options:

[package.metadata.libbpf]
prog_dir = "src/other_bpf_dir"
target_dir = "other_target_dir"
  • prog_dir: path relative to package Cargo.toml to search for bpf progs
  • default: <manifest_directory>/src/bpf
  • target_dir: path relative to workspace target directory to place compiled bpf progs
  • default: <target_dir>/bpf

These configuration options should be placed in your project's Cargo.toml file.

build subcommand

cargo libbpf build compiles <NAME>.bpf.c C files into corresponding <NAME>.bpf.o ELF object files. Each object file may contain one or more BPF programs, maps, and associated metadata. The object file may then be handed over to libbpf-rs for loading and interaction.

cargo-libbpf-build enforces a few conventions:

  • source file names must be in the <NAME>.bpf.c format
  • object file names will be generated in <NAME>.bpf.o format
  • there may not be any two identical <NAME>.bpf.c file names in any two projects in a cargo workspace