Results 1 to 3 of 3
hi:
I try to make the following codes.
the makefile is as following
PHP Code:
INCLUDE = / usr / src / kernels / 2.6.35.6 - 45.fc14 . i686 /include
CC = ...
- 06-06-2011 #1Just Joined!
- Join Date
- Jun 2011
- Posts
- 1
about compile error
hi:
I try to make the following codes.
the makefile is as following
PHP Code:
INCLUDE = /usr/src/kernels/2.6.35.6-45.fc14.i686/include
CC = gcc
CFLAGS = -D__KERNEL__ -I$(INCLUDE) -DMODULE -Wall -O2
TARGET = test
SRC = test.c
all: $(TARGET).o
clean:
rm -f *.o *~ core
and the source code is followings:
after execute ./make, the compiler show error and say can not find the file asm/processor.h. my system is fedora14, how to solve the problem,PHP Code:
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
static int hello_init(void)
{
printk(KERN_ALERT "Testing\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "OK\n");
}
module_init(hello_init);
module_exit(hello_exit);
,any suggestions is highly appreciated.Thanks
- 06-06-2011 #2Just Joined!
- Join Date
- May 2011
- Posts
- 5
processor.h should be located in $(INCLUDE)/asm.
- 07-30-2011 #3Just Joined!
- Join Date
- Jul 2011
- Posts
- 16
You have written a module, you need to use the following Makefile to compile it.
vim Makefile
obj-m :=test.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
Now run make tool, then a file test.ko is generated.Last edited by MikeTbob; 07-30-2011 at 07:48 PM. Reason: Deleted advertising


Reply With Quote
