Skip to content

Commit

Permalink
runtime: Add cmake options to control build runtime interact with ker…
Browse files Browse the repository at this point in the history
…nel map (#256)

* hp77 | Add hash for macos for frida

* hp77 | add .idea and debug-files to gitignore

* hp77 | Add option feature for shared_maps

* hp77 | Fix failing CI tests
  • Loading branch information
hp77-creator authored Mar 24, 2024
1 parent 3a831ac commit c828a48
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
CMakeCache.*
CMakeFiles/*
[Tt]esting/*
cmake-build-debug
ebpf_code.h
vm-exten.btf
check
Expand All @@ -18,6 +19,7 @@ index.html*
### VisualStudioCode ###
.vscode/settings.json
.vscode/runtime.json
.idea

example/libffi/test
test/man
Expand Down
5 changes: 4 additions & 1 deletion cmake/StandardSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,7 @@ endif()
option(ENABLE_EBPF_VERIFIER "Whether to enable ebpf verifier" OFF)

# whether to build with bpftime daemon
option(BUILD_BPFTIME_DAEMON "Whether to build the bpftime daemon" ON)
option(BUILD_BPFTIME_DAEMON "Whether to build the bpftime daemon" ON)

# whether to build with shared bpf_map
option(BPFTIME_BUILD_KERNEL_BPF "Whether to build with bpf share maps" ON)
5 changes: 5 additions & 0 deletions cmake/frida.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ elseif(${FRIDA_OS_ARCH} MATCHES "linux-arm.*")
set(FRIDA_GUM_DEVKIT_SHA256 "6b5963eb740062aec6c22c46ec2944a68006f72d290f714fb747ffe75b448a60")
# Frida only has armhf builds..
set(FRIDA_OS_ARCH "linux-armhf")
elseif(${FRIDA_OS_ARCH} MATCHES "darwin-arm.*")
set(FRIDA_CORE_DEVKIT_SHA256 "50aea2d5dfff000ed1f1dc1fdb2db67a02e4c4f44e782fa311f8afa31df327b6")
set(FRIDA_GUM_DEVKIT_SHA256 "b40c08bebd6958d41d91b7819171a457448cccad5faf417c9b4901be54b6c633")
# for macos-arm m* chip series
set(FRIDA_OS_ARCH "macos-arm64e")
else()
message(FATAL_ERROR "Unsupported frida arch ${FRIDA_OS_ARCH}")
endif()
Expand Down
20 changes: 12 additions & 8 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,25 @@ set(sources
src/bpf_map/userspace/per_cpu_array_map.cpp
src/bpf_map/userspace/per_cpu_hash_map.cpp
src/bpf_map/userspace/prog_array.cpp

src/bpf_map/shared/array_map_kernel_user.cpp
src/bpf_map/shared/hash_map_kernel_user.cpp
src/bpf_map/shared/percpu_array_map_kernel_user.cpp
src/bpf_map/shared/perf_event_array_kernel_user.cpp

extension/extension_helper.cpp
)

if(BPFTIME_BUILD_KERNEL_BPF)
list(APPEND sources
src/bpf_map/shared/array_map_kernel_user.cpp
src/bpf_map/shared/hash_map_kernel_user.cpp
src/bpf_map/shared/percpu_array_map_kernel_user.cpp
src/bpf_map/shared/perf_event_array_kernel_user.cpp
)
endif()


set(headers
include/
)
message(INFO "Headers: ${headers}")
message(INFO " Headers: ${headers}")

message(INFO "Found the following sources: ${sources}")
message(INFO " Found the following sources: ${sources}")

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG)
Expand Down

0 comments on commit c828a48

Please sign in to comment.