Skip to content
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
5 changes: 2 additions & 3 deletions .github/workflows/linux-port.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ jobs:
clang --version
- name: Check generation drift
run: |
chmod +x internal/ebpf/generate.sh
./internal/ebpf/generate.sh
git diff --exit-code -- internal/ebpf
make ebpf
git diff --exit-code -- internal/ebpf/bpf
- name: Unit tests
run: go test ./internal/ebpf ./internal/bootstrap ./pkg/event ./pkg/ps ./pkg/api ./pkg/util/signals
- name: Privileged process source
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmd/fibratus/fibratus.exe
cmd/fibratus/fibratus.syso
cmd/fibratus/fibratus

cmd/systray/fibratus-systray.exe
cmd/systray/fibratus-systray.syso
Expand Down
58 changes: 58 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.DEFAULT_GOAL := build

SHELL=bash -o pipefail -e

BPF2GO_VERSION := v0.20.0

# Specifies a list of build flags
TAGS ?= ""

BPF_DIR := internal/ebpf

BPF_FLAGS := \
-go-package bpf \
-output-dir $(BPF_DIR)/bpf \
-cc clang \
-target bpfel,bpfeb \
-tags linux

BPF_CFLAGS := \
-I./$(BPF_DIR)/spike/c \
-I./$(BPF_DIR)/c \
-I./$(BPF_DIR)/c/common \
-O2 \
-g \
-D__TARGET_ARCH_x86

# Find all eBPF sources.
BPF_SOURCES := $(wildcard $(BPF_DIR)/c/*.bpf.c)
BPF_NAMES := $(patsubst $(BPF_DIR)/c/%.bpf.c,%,$(BPF_SOURCES))
BPF_TARGETS := $(foreach name,$(BPF_NAMES), \
$(BPF_DIR)/$(name)_bpfel.go \
$(BPF_DIR)/$(name)_bpfeb.go)

CLANG ?= clang
GO ?= go
GOFMT ?= gofmt
BPF2GO ?= go run github.com/cilium/ebpf/cmd/bpf2go@$(BPF2GO_VERSION)

.PHONY: ebpf
ebpf: $(BPF_TARGETS)
$(BPF_DIR)/%_bpfel.go $(BPF_DIR)/%_bpfeb.go &: $(BPF_DIR)/c/%.bpf.c
$(BPF2GO) $(BPF_FLAGS) -output-stem $* $(shell echo $* | sed 's/^./\U&/') $(BPF_DIR)/c/$*.bpf.c -- $(BPF_CFLAGS)

.PHONY: build
build:
$(GO) build -tags $(TAGS) -o ./cmd/fibratus/fibratus ./cmd/fibratus/

.PHONY: fmt
fmt:
$(GOFMT) -e -s -l -w pkg cmd

.PHONY: test
test:
$(GO) test ./...

.PHONY: clean
clean:
rm -f cmd/fibratus/fibratus
84 changes: 42 additions & 42 deletions internal/ebpf/clone_bpfeb.go → internal/ebpf/bpf/clone_bpfeb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added internal/ebpf/bpf/clone_bpfeb.o
Binary file not shown.
Loading
Loading