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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ all: $(TARGETs)

demo test: so
bpf: $(if $(filter 1,$(USE_SUBMODULE)),bpf.gitsubmodule)
observe filter policy so: bpf
observe filter policy: bpf tools
so: observe filter policy

$(TARGETs):
$(MAKE) -C $@
Expand Down
5 changes: 2 additions & 3 deletions filter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ $(BPF_PREPROCESS):

$(BUILD_DIR)/%.skel.h: $(BPF_DIR)/%.bpf.o $(BPF_PREPROCESS) | $(BUILD_DIR)
$(BPF_PREPROCESS) $< $(BUILD_DIR)/$*.bpf.o
bpftool gen skeleton $(BUILD_DIR)/$*.bpf.o > $(dir $@).tmp.$$$$.$(notdir $@) && \
python3 $(PROJ_ROOT)/script/patch_skel.py --obj-dir $(BUILD_DIR) $(dir $@).tmp.$$$$.$(notdir $@) && \
mv $(dir $@).tmp.$$$$.$(notdir $@) $@
bpftool gen skeleton $(BUILD_DIR)/$*.bpf.o > $@
python3 $(PROJ_ROOT)/script/patch_skel.py --obj-dir $(BUILD_DIR) $@

$(BUILD_DIR)/log.o: $(PROJ_ROOT)/so/log.cpp | $(BUILD_DIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
Expand Down
5 changes: 2 additions & 3 deletions observe/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ $(BPF_PREPROCESS):

$(BUILD_DIR)/%.skel.h: $(BPF_DIR)/%.bpf.o $(BPF_PREPROCESS) | $(BUILD_DIR)
$(BPF_PREPROCESS) $< $(BUILD_DIR)/$*.bpf.o
bpftool gen skeleton $(BUILD_DIR)/$*.bpf.o > $(dir $@).tmp.$$$$.$(notdir $@) && \
python3 $(PROJ_ROOT)/script/patch_skel.py --obj-dir $(BUILD_DIR) $(dir $@).tmp.$$$$.$(notdir $@) && \
mv $(dir $@).tmp.$$$$.$(notdir $@) $@
bpftool gen skeleton $(BUILD_DIR)/$*.bpf.o > $@
python3 $(PROJ_ROOT)/script/patch_skel.py --obj-dir $(BUILD_DIR) $@

clean:
rm -f $(BUILD_DIR)/*.o $(BUILD_DIR)/*.d $(TARGETs) $(BUILD_DIR)/.tmp.*.skel.h
Expand Down
5 changes: 2 additions & 3 deletions policy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ $(BPF_PREPROCESS):

$(BUILD_DIR)/%.skel.h: $(BPF_DIR)/%.bpf.o $(BPF_PREPROCESS) | $(BUILD_DIR)
$(BPF_PREPROCESS) $< $(BUILD_DIR)/$*.bpf.o
bpftool gen skeleton $(BUILD_DIR)/$*.bpf.o > $(dir $@).tmp.$$$$.$(notdir $@) && \
python3 $(PROJ_ROOT)/script/patch_skel.py --obj-dir $(BUILD_DIR) $(dir $@).tmp.$$$$.$(notdir $@) && \
mv $(dir $@).tmp.$$$$.$(notdir $@) $@
bpftool gen skeleton $(BUILD_DIR)/$*.bpf.o > $@
python3 $(PROJ_ROOT)/script/patch_skel.py $@

clean:
rm -f $(BUILD_DIR)/*.skel.h $(BUILD_DIR)/*.o $(BUILD_DIR)/*.d $(TARGETs) $(BUILD_DIR)/.tmp.*.skel.h
Expand Down
8 changes: 6 additions & 2 deletions script/gen-source-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ echo -e "${YELLOW}Collecting main repo source files...${NC}"
cd "${PROJECT_ROOT}"
git ls-files --cached | while IFS= read -r f; do
case "$f" in
bpf|bpf/*|googletest|googletest/*|test/*|tools/*|.gitmodules|*.spec)
# bpf/ handled separately; googletest/test/tools not needed for RPM
bpf|bpf/*|googletest|googletest/*|test/*|.gitmodules|*.spec)
# bpf/ handled separately; googletest/test not needed for RPM
continue
;;
*)
Expand Down Expand Up @@ -226,8 +226,12 @@ if [ -f bpf/build/include/vmlinux.h ]; then
VMLINUX_OVERRIDE="VMLINUX=bpf/build/include/vmlinux.h"
fi

# Build extern-prep once to avoid parallel build race across modules
make -C tools extern-prep

make %{?_smp_mflags} USE_SUBMODULE=0 \\
\${VMLINUX_OVERRIDE} \\
BPF_PREPROCESS=\$(pwd)/build/tools/extern-prep \\
KHEADERS_DIR="\${KHEADERS_DIR}" \\
bpf \\
observe BPF_DIR_PATCH=/usr/lib/dkapture \\
Expand Down
2 changes: 1 addition & 1 deletion script/patch_skel.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def patch_header(header_path: str, dry_run: bool = False, obj_dir: str | None =
# Infer the corresponding object file path and ensure it exists
if obj_dir:
stem = os.path.basename(header_path)[:-len('.skel.h')]
stem = re.sub(r'^\.tmp\.\d+\.', '', stem)
stem = re.sub(r'^\.tmp\.(\d+\.)?', '', stem)
obj_path = os.path.join(obj_dir, stem + '.bpf.o')
else:
obj_path = header_path[:-len('.skel.h')] + '.bpf.o'
Expand Down