Devcontainer for Aya-rs
Aya is an eBPF library for Rust, from Environment
section on aya-rs/book, bpf-linker
only works on linux x86_64 system
To simplify the development environment setup, we can use Devcontainer to build and run eBPF program in Rust.
for more details, please take a look at devcontainer.json
and Dockerfile
.
.
├── .devcontainer
│ ├── devcontainer.json
│ └── Dockerfile
- Open this repository in VSCode
- Install Dev Containers extension
- Open the command palette (Shift+Command+P)
- Select
Dev Containers: Reopen in Container
Generate ebpf app from aya-template
cargo generate https://github.com/aya-rs/aya-template
cd <your_app_path>
# build both ebpf and userspace app
cargo xtask build
bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h
aya-tool generate task_struct > vmlinux.rs
Tweaked from Kevin Sookocheff's blog post.