problem compiling LKM in linux 2.6.21
hi,
i am newbie to LKM programming. I could easily insmod some small modules (like the one given below) into the 2.4 kernel. but when i try the same code, with the same Makefile on 2.6.21 kernel i am getting errors in compilation. the details are as follows:
this is the code i tried--
#include <linux/module.h>
#include <linux/kernel.h>
int init_module(void)
{
printk("<1>Hello world 1\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_ALERT "Goodbye world\n");
}
--------------------------------------------------
this is the Makefile--
TARGET := hello-1
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
#INCLUDE := -I /lib/modules/2.6.21/build/include
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
LIBD := -L /lib/modules/2.6.21/build/lib
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE} ${LIBD}
CC := gcc
${TARGET}.o: ${TARGET}.c
.PHONY: clean
clean:
rm -rf ${TARGET}.o
--------------------------------------------------
and these r the errors
In file included from /lib/modules/2.6.21/build/include/asm/thread_info.h:16,
from /lib/modules/2.6.21/build/include/linux/thread_info.h:21,
from /lib/modules/2.6.21/build/include/linux/preempt.h:9,
from /lib/modules/2.6.21/build/include/linux/spinlock.h:49,
from /lib/modules/2.6.21/build/include/linux/module.h:9,
from hello-1.c:1:
/lib/modules/2.6.21/build/include/asm/processor.h:82: error: 'CONFIG_X86_L1_CACHE_SHIFT' undeclared here (not in a function)
/lib/modules/2.6.21/build/include/asm/processor.h:82: error: requested alignment is not a constant
In file included from /lib/modules/2.6.21/build/include/linux/sched.h:51,
from /lib/modules/2.6.21/build/include/linux/utsname.h:35,
from /lib/modules/2.6.21/build/include/asm/elf.h:12,
from /lib/modules/2.6.21/build/include/linux/elf.h:7,
from /lib/modules/2.6.21/build/include/linux/module.h:15,
from hello-1.c:1:
/lib/modules/2.6.21/build/include/linux/jiffies.h:33:3: error: #error You lose.
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
/lib/modules/2.6.21/build/include/linux/jiffies.h:225:31: error: division by zero in #if
In file included from /lib/modules/2.6.21/build/include/linux/module.h:21,
from hello-1.c:1:
/lib/modules/2.6.21/build/include/asm/module.h:62:2: error: #error unknown processor family
make: *** [hello-1.o] Error 1
pl help me out.. thanks in advance.
|