diff --git a/.gitignore b/.gitignore index 0ddca556..b8377cf7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ CMakeCache.* CMakeFiles/* [Tt]esting/* +cmake-build-debug ebpf_code.h vm-exten.btf check @@ -18,6 +19,7 @@ index.html* ### VisualStudioCode ### .vscode/settings.json .vscode/runtime.json +.idea example/libffi/test test/man diff --git a/cmake/StandardSettings.cmake b/cmake/StandardSettings.cmake index 14c21e6c..9be48091 100644 --- a/cmake/StandardSettings.cmake +++ b/cmake/StandardSettings.cmake @@ -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) \ No newline at end of file +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) \ No newline at end of file diff --git a/cmake/frida.cmake b/cmake/frida.cmake index 0613b5ec..67419a2a 100644 --- a/cmake/frida.cmake +++ b/cmake/frida.cmake @@ -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() diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 7675adad..e6f770db 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -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)