Linux / module.h No such file or directory

For my thesis, I create Manet using the ARAN protocol. To install the protocol, I use this guide , but the first step, creating trace_route, I got errors like:

-linux/module.h: No such file or directory -linux/procs_Fs: No such file or directory -linux/skbuff: No such file or directory 

I searched the Internet and found out that the problem is in the headers, but I could not find a solution ...

PS I am using Ubuntu 10.04 LTS Kernel 2.6.33, recompiled

+4
source share
2 answers

You are missing Linux kernel headers that allow you to compile code in the Linux kernel.

To set only headers in Ubuntu :

 $ sudo apt-get install linux-headers-$(uname -r) 

To install all Linux kernel source code in Ubuntu :

 $ sudo apt-get install linux-source 

Note that you must use kernel headers that correspond to the running kernel.

+9
source
 **/*source file name is basic.c */** #include <linux/init.h> #include <linux/module.h> /*MODULE_LICENSE("Dual BSD/GPL");*/ static int hello_init(void) { printk(KERN_ALERT "Hello, world\n"); return 0; } static void hello_exit(void) { printk(KERN_ALERT "Goodbye, cruel world\n"); } module_init(hello_init); module_exit(hello_exit); 

=======================================

now create a file for ubuntu

/ * for the first type on the ur terminal that $ (uname -r), then u will get the version. which uses ur system * /

 obj-m +=basic.o KDIR =//usr/src/linux-headers-3.13.0-44-generic all: $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules clean: rm -rf *.o *.ko *.mod.* *.symvers *.order 

================================================= =

To run the code

 $sudo insmode basic.ko $dmesg u will get the output $sudo rmmod basic.ko $dmesg 
+3
source

Source: https://habr.com/ru/post/1484414/


All Articles