Skip to content
Merged
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 -B 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
69 changes: 69 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
.DEFAULT_GOAL := build

SHELL := /bin/bash
.SHELLFLAGS := -euo pipefail -c

BPF2GO_VERSION := v0.20.0

# Specifies a list of build flags
TAGS ?=

BPF_DIR := internal/ebpf
BPF_OUT := $(BPF_DIR)/bpf

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

BPF_FLAGS := \
-go-package bpf \
-output-dir $(BPF_OUT) \
-cc $(CLANG) \
-target bpfel,bpfeb \
Comment thread
rabbitstack marked this conversation as resolved.
-tags linux

# Production headers first; spike/c is only the vmlinux.h fallback.
BPF_CFLAGS := \
-I./$(BPF_DIR)/c \
-I./$(BPF_DIR)/c/common \
-I./$(BPF_DIR)/spike/c \
-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_OUT)/$(name)_bpfel.go \
$(BPF_OUT)/$(name)_bpfeb.go)

titlecase = $(shell printf '%s' '$(1)' | awk '{print toupper(substr($$0,1,1)) substr($$0,2)}')

.PHONY: ebpf
ebpf: $(BPF_TARGETS)
$(BPF_OUT)/%_bpfel.go $(BPF_OUT)/%_bpfeb.go &: $(BPF_DIR)/c/%.bpf.c
$(BPF2GO) $(BPF_FLAGS) -output-stem $* $(call titlecase,$*) $(BPF_DIR)/c/$*.bpf.c -- $(BPF_CFLAGS)

ifeq ($(strip $(TAGS)),)
BUILD_TAGS :=
else
BUILD_TAGS := -tags $(TAGS)
endif

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

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

.PHONY: test
test:
$(GO) test ./internal/ebpf ./internal/bootstrap ./pkg/event ./pkg/ps ./pkg/api ./pkg/util/signals ./pkg/filter ./pkg/rules

.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 not shown.
Loading
Loading