- 论坛徽章:
- 0
|
我用ubuntu10.04编译hello模块出现错误,程序如下
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void) //有的上面定义的是init_modules(void)是通不过编译的
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, world\n");
}
module_init(hello_init);
module_exit(hello_exit);
Makefile文件如下:
PWD = $(shell pwd)
KERNEL_SRC = /usr/src/linux-headers-2.6.32-22-generic/
obj-m := hello.o
module-objs := hello.o
all:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules
clean:
rm *.ko
rm *.o
出现以下错误提示:
make -C /usr/src/linux-headers-2.6.32-22-generic/ M=/root/text/hello2 modules
make[1]: 正在进入目录 `/usr/src/linux-headers-2.6.32-22-generic'
CC [M] /root/text/hello2/hello.o
cc1: error: unrecognized command line option "-mlittle-endian"
cc1: error: unrecognized command line option "-mapcs"
cc1: error: unrecognized command line option "-mno-sched-prolog"
cc1: error: unrecognized command line option "-mabi=apcs-gnu"
make[2]: *** [/root/text/hello2/hello.o] 错误 1
make[1]: *** [_module_/root/text/hello2] 错误 2
make[1]:正在离开目录 `/usr/src/linux-headers-2.6.32-22-generic'
make: *** [all] 错误 2
由于是第一次弄这个,所以没有经验,只好问问论坛里的高手了 |
|