Ask Your Question

Problem in compiling modules

asked 2013-02-28 09:27:54 -0500

Asaf L gravatar image

updated 2014-09-28 15:53:01 -0500

mether gravatar image

I am tring to compile a module, but the computer tells me about missing header files. So I have copied some from the source into /usr/include/linux and /usr/include/asm. Now it wants generated/bounds.h, and I don't know where from and into where to copy this. I have tryed some things, and the last one was to create "generated" library but it tells me that there is already a file that is called "generated" in the library. Please help me. Thank you.

edit retag flag offensive close merge delete



Please provide more info on what you are trying to compile and the exact error messages.

lnxslck gravatar imagelnxslck ( 2013-02-28 09:33:40 -0500 )edit

/* * hello−1.c − The simplest kernel module. */

include <linux/module.h>

/* Needed by all modules */

include <linux/kernel.h>

/* Needed for KERNINFO */ int initmodule(void) { printk(KERNINFO "Hello world 1.\n"); /* * A non 0 return means initmodule failed; module can't be loaded. */ return 0; } void cleanupmodule(void) { printk(KERNINFO "Goodbye world 1.\n"); }

Asaf L gravatar imageAsaf L ( 2013-03-01 15:37:09 -0500 )edit

The compilation report : (the problem is first in the end:

/usr/include/linux/nodemask.h:325:35: error: ‘nodemaskt’ has no member named ‘bits’ /usr/include/linux/nodemask.h: In function ‘noderemap’: /usr/include/linux/nodemask.h:333:37: error: ‘nodemaskt’ has no member named ‘bits’ /usr/include/linux/nodemask.h:333:49: error: ‘nodemaskt’ has no member named ‘bits’ /usr/include/linux/nodemask.h: In function ‘nodesremap’: /usr/include/linux/nodemask.h:341:19: error: ‘nodemaskt’ has no member named ‘bits’ /usr/include/linux/nodemask.h:341:31: error: ‘nodemaskt’ has no member named ‘bits’ /usr/include/linux/nodemask.h:341:43: error: ‘nodemaskt’ has no member named ‘bits’ /usr/include/linux/nodemask.h:341:55: error: ‘nodemaskt’ has no member named ‘bits’ /usr/include/linux/nodemask.h: In function ‘nodesonto’: /usr/include/linux/nodemask.h:349:18: error ...(more)

Asaf L gravatar imageAsaf L ( 2013-03-01 15:38:19 -0500 )edit

I think youre compiling it the wrong way please read this link

lnxslck gravatar imagelnxslck ( 2013-03-01 17:42:27 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2016-09-22 15:04:39 -0500

vedalken gravatar image

Kernel modules are compiled little differently. Information how to compile is stored in kernel source code Makefile /lib/modules/$(uname -r)/build/Makefile. The makefile define rules necessary to build kernel modules. For your example, Makefile

 obj-m += hello-1.o

 KERNEL_VERSION = $(shell uname -r)

 <TAB>$(MAKE) -C /lib/modules/$(KERNEL_VERSION)/build M=$(PWD) modules
 <TAB>$(MAKE) -C /lib/modules/$(KERNEL_VERSION)/build M=$(PWD) clean

<TAB> replace with actual tabular within the rule section not spaces (the infamous tabular-space issue).



to produce kernel module.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-02-28 09:27:54 -0500

Seen: 689 times

Last updated: Feb 28 '13