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

Fix issue1 #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ libbpf:
@mkdir -p $(SYSROOT)
make -C lib/libbpf all

bpftools:
bpftools: libbpf
@mkdir -p $(SYSROOT)
make -C tools/bpftool all

Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@ EMF(ebpf-module-framework)是一个基eBPF的应用程序框架,主要用于

注:静态方式比如简单做成类似于C语言的.a即可。动态方式也可以在EMF当中使用dlopen之类的函数去读取动态eBPF模块当中对应的符号表(比如struct module符号,该符号位全局符号)。

## 构建

**依赖:**
- libelf
- zlib

```
$ git clone https://github.com/OpenCloudOS/EMF-ebpf-module-framework.git
```
**Ubuntu:**

下载依赖包
```
$ sudo apt-get install -y make clang zlib1g-dev llvm libelf-dev libbpf-dev libbpfcc-dev linux-tools-$(uname -r) linux-headers-$(uname -r)
```
编译
```
$ make -j$(nproc)
```

## EMF模块介绍
EMF支持两种加载模式:一、EMF模块静态链接;二、EMF模块动态加载。通常,在入口函数main启动后(core/emf.c),EMF框架会去主动查找静态模块,分别去执行静态模块的初始化函数和加载函数;然后EMF才会去读取动态模块,并处理动态模块的初始化和加载函数。所以这里有一个优先级的关系,即静态模块的优先级永远高于动态模块的优先级。

Expand Down
2 changes: 1 addition & 1 deletion tools/bpftool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ BPF_CFLAGS += -I$(or ,.) -Ikernel/ -I$(SYSROOT)/include \
SKELS_CFLAGS := -g -O2 -Wall -I$(or ,.) -I$(SYSROOT)/include -I$(TOPDIR)/include/uapi
BPF_LDFLAGS += $(EXTRA_LDFLAGS) -L$(SYSROOT)/lib

LIBS = -lelf -lz $(LIBBPF)
LIBS = $(LIBBPF) -lelf -lz
ifeq ($(USE_LIBCAP),y)
LIBS += -lcap
BPF_CFLAGS += -DUSE_LIBCAP
Expand Down