Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add vmlinux for kernel 5.15 for arm & amd #26

Merged
merged 10 commits into from
Aug 2, 2023
13 changes: 13 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,16 @@ mount | grep -i debugfs
cat /sys/kernel/debug/tracing/trace_pipe
# look around sys/kernel/debug
```

## Generating vmlinux.h files

`vmlinux.h` files contain all the linux types and structs to interop with a linux OS, e.g. the raw Socket class.

We need a version for each supported architecture (eg arm & amd) and it's generated from a real linux distro.

Steps to generate `vmlinux.h` files:

- Start a ubuntu VM (not docker, use virtualbox, multipass, ec2, etc)
- Install additional linux commands so libbpf can work - `apt install linux-tools-$(uname -r)`
- Use libbpf to generate the vmlinux.h file - `bpftool btf dump file /sys/kernel/btf/vmlinux format c`
- Check in output vmlinux.h, note which architecture in file format - eg `bpf/headers/vmlinux-arm64.h`
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ IMG_NAME ?= hny/ebpf-agent
IMG_TAG ?= local

.PHONY: generate
generate: export CFLAGS := $(BPF_HEADERS)
generate: export CFLAGS := $(BPF_HEADERS) -DBPF_NO_PRESERVE_ACCESS_INDEX
generate:
go generate ./...

Expand Down
Loading