|
PC平台:ubuntu10.04 内核源码为2.6.32.38-generic
使用移植源码为天嵌光盘里的2.6.30.4压缩包,放在了root/test,使用tar命令解压到默认路径 /
在/root/test下建立了一个test01文件夹,里面创建了两个文件,分别是hello.c Makefile
root@xiaofei-desktop:~/test/test01# ls
hello.c Makefile
hello.c的内容是
#include <linux/init.h>
#include <linux/module.h>
static int __init hello_init(void)
{
printk("Hello,My world!\n");
printk(KERN_ALERT"This is my first driver.\n");
return 0;
}
static void __exit hello_exit(void)
{
printk(KERN_ALERT"Goodbye,My world\n");
return 0;
}
MODULE_LICENSE("GPL");
MODULE_AUTHOR("LIU");
module_init(hello_init);
module_exit(hello_exit);
Makefile的内容是
ifneq ($(KERNELRELEASE),)
obj-m := hello.o
else
KDIR := /opt/EmbedSky/linux-2.6.30.4
all:
make -C $(KDIR) M=$(PWD) modules ARCH=arm CROSS_COMPILE=arm-linux-
clean:
rm -rf *.o *.ko *.mod.c *.markers *.order *.symvers
endif
在/root/test/test01/下使用make命令,出现以下错误:
root@xiaofei-desktop:~/test/test01# make
make -C /opt/EmbedSky/linux-2.6.30.4 M=/root/test/test01 modules ARCH=arm CROSS_COMPILE=arm-linux-
make[1]: 正在进入目录 `/opt/EmbedSky/linux-2.6.30.4'
ERROR: Kernel configuration is invalid.
include/linux/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump /opt/EmbedSky/linux-2.6.30.4/Module.symvers
is missing; modules will have no dependencies and modversions.
Building modules, stage 2.
/opt/EmbedSky/linux-2.6.30.4/scripts/Makefile.modpost:43: include/config/auto.conf: 没有那个文件或目录
make[2]: *** 没有规则可以创建目标“include/config/auto.conf”。 停止。
make[1]: *** [modules] 错误 2
make[1]:正在离开目录 `/opt/EmbedSky/linux-2.6.30.4'
make: *** [all] 错误 2
|
|