Crates.io | build-bpf |
lib.rs | build-bpf |
version | 0.2.0 |
source | src |
created_at | 2024-08-18 20:20:59.849319 |
updated_at | 2024-08-24 18:38:21.662374 |
description | Tools for building ELFs and Skeletons for typical (e)BPF programs |
homepage | https://github.com/e-dant/build-bpf |
repository | https://github.com/e-dant/build-bpf |
max_upload_size | |
id | 1342953 |
size | 11,572 |
Tools for building ELFs and Skeletons for typical (e)BPF programs.
Usage for a project which wants to build BPF targets in src/bpf/*.bpf.c
.
// build.rs
fn main() {
build_bpf::guess_targets().for_each(|target| target.must_build());
}
To symlink the generated (Rust) Skeleton files, you can do something like this:
// build.rs
fn main() {
let ln_to = |target: &build_bpf::BuildBpf| {
format!(
"{}/src/skel_{}.rs",
std::env::var("CARGO_MANIFEST_DIR").unwrap(),
target.bpf_prog_name()
)
};
build_bpf::guess_targets().for_each(|target| {
target.must_build().must_sym_link_skel_to(&ln_to(&target));
});
}
Having the generated Skeleton files around can, instead of digging through target/...
, can be useful during development.