Comments (9)
I have some small questions.
- Do we need a symbolic link in
src/bpf
tovmlinux.h
? - How does rust example link against
libbpf
?
from libbpf-bootstrap.
I like it overall, but I'd leave libbpf submodule at the top level still. It is not used from Rust, but I feel like it's a good idea to keep it at top level, because some other language might come up that will build libbpf from sources (e.g., Go + Cgo). In in general, it's libbpf-bootstrap, so libbpf should be more apparent ;)
As for Makefile in each example subdir. It's trivial to have a simlar makefile that will delegate to upper level Makefile for build and clean up, so yeah, cd examples/c/bootstrap && make
should just work, IMO.
from libbpf-bootstrap.
Do we need a symbolic link in src/bpf to vmlinux.h ?
Yeah, we could. Or we could just have src/bpf/xdp.bpf.c
do #include "../../../vmlinux/vmlinux.h"
.
How does rust example link against libbpf ?
libbpf-rs depends on libbpf-sys. libbpf-sys vendors (submodule) a specific libbpf version and builds/links to it at compile time: https://github.com/alexforster/libbpf-sys/blob/3c1c21e45c7ea74f6d0fe18ab99624d9ee14fc96/build.rs#L13-L23
from libbpf-bootstrap.
I like it overall, but I'd leave libbpf submodule at the top level still. It is not used from Rust, but I feel like it's a good idea to keep it at top level, because some other language might come up that will build libbpf from sources (e.g., Go + Cgo). In in general, it's libbpf-bootstrap, so libbpf should be more apparent ;)
Sure, sounds good.
As for Makefile in each example subdir. It's trivial to have a simlar makefile that will delegate to upper level Makefile for build and clean up, so yeah, cd examples/c/bootstrap && make should just work, IMO.
Ok, I'll look into that
I'll update the issue summary
from libbpf-bootstrap.
The kprobe program depends on vmlinux.h. If I want to compile the android bpf program, do I need to generate the vmlinux.h file corresponding to the android system? How should I organize them?
└── vmlinux
├── vmlinux_508.h
└── vmlinux.h -> vmlinux_508.h
Or this?
- vmlinux
- linux/vmlinux.h
- android/vmlinux.h
from libbpf-bootstrap.
Maybe:
└── vmlinux
├── Makefile
├── xmake.lua
├── vmlinux_508.h
└── vmlinux.h -> vmlinux_508.h
and then depending on if you use make
or xmake
vmlinux_508.h and vmlinux.h is overwritten. And if you retarget xmake to android, vmlinux*
gets overwritten
from libbpf-bootstrap.
No overwriting, please. See iovisor/bcc#3265 for how we dealt with it in libbpf-tools. Do you think that's feasible here as well?
from libbpf-bootstrap.
So only one vmlinux.h can support linux and android at same time? It seems great!
from libbpf-bootstrap.
Yes, it's just a source of type definitions, nothing more. And you don't even need vmlinux.h, you can define all the types on your own and mark them with __attribute__((preserve_access_index))
to make them CO-RE-compatible.
from libbpf-bootstrap.
Related Issues (20)
- error: unable to create target: 'No available targets are compatible with triple "bpf"' HOT 1
- Does libbpf-bootstrap support sk_msg/stream_parser & sk_msg/stream_parser hook ?
- example uprobe no output HOT 4
- (ARM64) Rust Example Tracecon Does Not Compile HOT 2
- [Android] Failed to find valid kernel BTF HOT 19
- How to read arbitrary len bytes using helper bpf_skb_load_bytes()? HOT 2
- To compile the Rust example in libbpf-bootstrap for use on the Android platform or arm64 , what should I do? HOT 1
- when compile the Rust example in libbpf-bootstrap for target arm64 ,why build.rs use vmlinux.h is x86 ? HOT 8
- unknown func bpf_kallsyms_lookup_name#179 HOT 1
- Can you please add a bpf_for() example? HOT 1
- minimal_ns doesn't compile HOT 1
- Compilation failed, missing a header file? HOT 6
- make failed under `examples/c` with `gimli = "^0.28"` HOT 10
- error: could not compile `gimli` (lib) HOT 2
- Make doesn't detect changes in the header files
- Compiling profile files in libbpf-bootstrap/examples/c/ HOT 6
- blazesym not giving function address for stacktrace HOT 14
- Is it possible to compile or run a BPF program that invokes task_struct in an environment without BTF support HOT 1
- I have the same github workflow, but my build keep failing since last month,Error: buildx failed with: ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y ... did not complete successfully: exit code: 100
- I can make minimal,but can't make bpftool,why? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libbpf-bootstrap.