bmax121 / KernelPatch

Patching and hooking the Linux kernel with only a stripped Linux kernel image.
GNU General Public License v2.0
736 stars 128 forks source link

怎么编译kptool #135

Closed 1q23lyc45 closed 5 days ago

1q23lyc45 commented 1 month ago
┌──(root@kali)-[~/KernelPatch/tools]
└─# cmake -DCMAKE_BUILD_TYPE=Debug
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.

-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 13.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /sec/root/KernelPatch/tools

┌──(root@kali)-[~/KernelPatch/tools]
└─# make
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /sec/root/KernelPatch/tools
[  9%] Building C object CMakeFiles/kptools.dir/image.c.o
[ 18%] Building C object CMakeFiles/kptools.dir/kallsym.c.o
[ 27%] Building C object CMakeFiles/kptools.dir/kptools.c.o
/sec/root/KernelPatch/tools/kptools.c:20:10: fatal error: preset.h: No such file or directory
   20 | #include "preset.h"
      |          ^~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/kptools.dir/build.make:104: CMakeFiles/kptools.dir/kptools.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/kptools.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Jiang-Night commented 2 weeks ago

Copy the preset.h file from kernel/include to the kptools folder, or manually modify the makefile to include the preset.h file from kernel/include.

1q23lyc45 commented 5 days ago

Thanks!