Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.33 KB

README.md

File metadata and controls

44 lines (29 loc) · 1.33 KB

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

How to Use

  • 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

Generate vmlinux.h/rs

bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h

aya-tool generate task_struct > vmlinux.rs

Credits

Tweaked from Kevin Sookocheff's blog post.