天嵌 ARM开发社区

 找回密码
 注册
查看: 2356|回复: 2

动态加载hello world驱动模块出错

[复制链接]
xiaofei_heu 发表于 2012-12-29 14:36:31 | 显示全部楼层 |阅读模式
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
 楼主| xiaofei_heu 发表于 2012-12-29 14:55:53 | 显示全部楼层
怎么没有回复呐
 楼主| xiaofei_heu 发表于 2012-12-29 15:24:32 | 显示全部楼层
问题已解决,不用麻烦技术指导了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-5-18 07:32 , Processed in 1.046869 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表