|
這是C文件
#include
#include
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);
~
下面是makefile
CC =/usr/local/arm/bin/arm-linux-gcc
KERNELDIR=/home/work/linux2.6
CFLAGS =-D__KERNEL__ -DMODULE -I$(KERNELDIR)/include -O -Wall
hello.hello.c
$(CC)$(CFLAGS) -g -c $<
clean:
這時報錯:
/usr/local/arm/bin/arm-linux-gcc -D__KERNEL__ -DMODULE -I/home/work/linux2.6/include -O -Wall -g -c hello.c
In file included from /home/work/linux2.6/include/asm/hardware.h:16,
from /home/work/linux2.6/include/asm/arch/memory.h:24,
from /home/work/linux2.6/include/asm/memory.h:27,
from /home/work/linux2.6/include/asm/system.h:6,
from /home/work/linux2.6/include/asm/bitops.h:23,
from /home/work/linux2.6/include/linux/bitops.h:9,
from /home/work/linux2.6/include/linux/thread_info.h:20,
from /home/work/linux2.6/include/linux/preempt.h:9,
from /home/work/linux2.6/include/linux/spinlock.h:49,
from /home/work/linux2.6/include/linux/module.h:9,
from hello.c:2:
/home/work/linux2.6/include/asm/arch/hardware.h:30:2: #error "Unsupported AT91 processor"
In file included from /home/work/linux2.6/include/linux/bitops.h:9,
from /home/work/linux2.6/include/linux/thread_info.h:20,
from /home/work/linux2.6/include/linux/preempt.h:9,
from /home/work/linux2.6/include/linux/spinlock.h:49,
from /home/work/linux2.6/include/linux/module.h:9,
from hello.c:2:
/home/work/linux2.6/include/asm/bitops.h: In function `____atomic_set_bit':
/home/work/linux2.6/include/asm/bitops.h:40: warning: implicit declaration of function `local_irq_save'
/home/work/linux2.6/include/asm/bitops.h:42: warning: implicit declaration of function `local_irq_restore'
In file included from /home/work/linux2.6/include/linux/kobject.h:25,
from /home/work/linux2.6/include/linux/module.h:17,
from hello.c:2:
/home/work/linux2.6/include/linux/rwsem.h:24:65: asm/rwsem.h: No such file or directory
In file included from /home/work/linux2.6/include/linux/module.h:17,
from hello.c:2:
/home/work/linux2.6/include/linux/kobject.h: At top level:
/home/work/linux2.6/include/linux/kobject.h:178: error: field `rwsem' has incomplete type
In file included from /home/work/linux2.6/include/linux/memory_hotplug.h:7,
from /home/work/linux2.6/include/linux/mmzone.h:463,
from /home/work/linux2.6/include/linux/gfp.h:4,
from /home/work/linux2.6/include/linux/slab.h:14,
from /home/work/linux2.6/include/linux/percpu.h:5,
from /home/work/linux2.6/include/asm-generic/local.h:4,
from /home/work/linux2.6/include/asm/local.h:1,
from /home/work/linux2.6/include/linux/module.h:19,
from hello.c:2:
/home/work/linux2.6/include/linux/notifier.h:62: error: field `rwsem' has incomplete type
In file included from /home/work/linux2.6/include/asm/io.h:76,
from /home/work/linux2.6/include/asm/arch/irqs.h:24,
from /home/work/linux2.6/include/asm/irq.h:4,
from /home/work/linux2.6/include/asm/hardirq.h:6,
from /home/work/linux2.6/include/linux/hardirq.h:7,
from /home/work/linux2.6/include/asm-generic/local.h:5,
from /home/work/linux2.6/include/asm/local.h:1,
from /home/work/linux2.6/include/linux/module.h:19,
from hello.c:2:
/home/work/linux2.6/include/asm/arch/io.h: In function `at91_sys_read':
/home/work/linux2.6/include/asm/arch/io.h:36: error: `AT91_BASE_SYS' undeclared (first use in this function)
/home/work/linux2.6/include/asm/arch/io.h:36: error: (Each undeclared identifier is reported only once
/home/work/linux2.6/include/asm/arch/io.h:36: error: for each function it appears in.)
/home/work/linux2.6/include/asm/arch/io.h: In function `at91_sys_write':
/home/work/linux2.6/include/asm/arch/io.h:43: error: `AT91_BASE_SYS' undeclared (first use in this function)
make: *** [hello.o] 錯誤 1
到底是什么原因,版主和朋友們能不能幫個忙,謝謝了 |
|