Compile Linux Kernel Module - Cannot build simple kernel module
I'm trying to compile a kernel module driver but I get the following errors: (the operation generate some files, but not a ".ko" file)
Code:
make -C /lib/modules/5.16.0-kali7-amd64/build M=/home/z3r0/Scrivania/kernel_modules/start_stop modules Code:
/bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found Code:
make -C /lib/modules/5.16.0-kali7-amd64/build M=/home/z3r0/Scrivania/All/Programming/C++/Exercises_Linux/kernel_modules/hello_world modules The file is really simple (hello_world.c): Code:
#include <linux/module.h> Code:
obj-m = foo.o |
probably:
Code:
ERROR: Kernel configuration is invalid. |
Already Tryed
Quote:
Hello, Thank you for ur answer but as I said in my request I already tryed these commands and I get the error I wrote on the question above :/ Code:
When I try to execute "make oldconfig && make prepare" (in the directory /usr/src/linux-headers-5.16.0-kali7-amd64) I get the following error: |
So make oldconfig failed. I guess your kernel source tree is either incomplete or corrupted.
How did you create it? |
Quote:
|
So you use kali, which is recommended only for advanced users
you want to build a kernel module, which is again not really suggested for beginners. and finally I guess you have a guide or a set of instructions to explain how do you need to prepare your environment (if you want to build kernel modules). I guess you missed a step or just failed something during that preparation. What is in /usr/src/linux-headers-5.16.0-kali7-common ? And how was this directory created? |
Quote:
I though the environment was already set xD Anyway but is normal that the commands "sudo make oldconfig && sudo make prepare" don't work? I though it wasn't, Later I'll try on my Ubuntu machine to see if I get the same error. I think everyone can do anything if they apply intensively, so despite being raccomended for advaced users I'll learn it (: Obviously I'm not good as you are, but I will learn :D I want to learn to hook syscalls and I want to analyze (disassembly and debugging) the program that hook the syscalls. "linux-headers-5.16.0-kali7-common" I think it's about linux headers, it contains some tools and some scripts and also headers for different kind of processor. It was already installed, I didn't need to get the linux-header package or upgrade it ^^ |
Quote:
Quote:
Quote:
|
Kali is heavily customized and not intended for doing development work, you will have better results and learn more/faster using a normal disto.
Using a distro specialized at penetration testing to learn disassembly and debugging is like using a PlayStation to learn Excel. |
All times are GMT -5. The time now is 03:48 PM. |