嵌入式爱好者

查看: 12306|回复: 2

OK6410A 256M/4G linux3.0.1加载模块失败问题求助

[复制链接]

0

主题

0

帖子

3

积分

扫一扫,手机访问本帖
发表于 2012-12-1 10:46:12 | 显示全部楼层 |阅读模式
问题:hello.ko加载失败,提示模块格式错误
[root@FORLINX6410]# insmod hello.ko                                             
insmod: cannot insert 'hello.ko': invalid module format                        
[root@FORLINX6410]#  

开发板:   OK6410A 256MB DDR, 4GB NAND FLASH,  linux3.0.1
[root@FORLINX6410]# uname -ra                                                   
Linux FORLINX6410 3.0.1 #439 Sun Sep 23 13:36:30 CST 2012 armv6l unknown

编译环境:Linux ubuntu 3.2.0-23
gavin@ubuntu:~$ uname -ra
Linux ubuntu 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686 i686 i386 GNU/Linux

代码:hello.c
#include <linux/init.h>
#include <linux/module.h>
static int hello_init(void)
{
    printk(KERN_INFO " hello, welcome to the ldd world. \n");
   
    return 0;
}
static int hello_exit(void)
{
    printk(KERN_INFO " hello, exit. \n");
   
    return 0;
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_AUTHOR("gavin");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_DESCRIPTION("hello module.");
MODULE_ALIAS("the door to ldd.");

Makefile:
ifneq ($(KERNELRELEASE),)
    # kbuild syntax. dependency relationshsip of files and target modules are listed here.
    mymodule-objs := hello.o
obj-m := hello.o
else
    PWD  := $(shell pwd)
    KVER ?= $(shell uname -r)
    KDIR := /lib/modules/$(KVER)/build
all:
$(MAKE) -C $(KDIR) M=$(PWD)
clean:
rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versions
endif

编译过程:
gavin@ubuntu:~/forlinx/LDD/hello$ make clean
rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versions
gavin@ubuntu:~/forlinx/LDD/hello$ make
make -C /lib/modules/3.2.0-23-generic-pae/build M=/home/gavin/forlinx/LDD/hello
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-23-generic-pae'
  LD      /home/gavin/forlinx/LDD/hello/built-in.o
  CC [M]  /home/gavin/forlinx/LDD/hello/hello.o
/home/gavin/forlinx/LDD/hello/hello.c: In function ‘__exittest’:
/home/gavin/forlinx/LDD/hello/hello.c:20:1: warning: return from incompatible pointer type [enabled by default]
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/gavin/forlinx/LDD/hello/hello.mod.o
  LD [M]  /home/gavin/forlinx/LDD/hello/hello.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-23-generic-pae'
gavin@ubuntu:~/forlinx/LDD/hello$




回复

使用道具 举报

8

主题

38

帖子

67

积分

发表于 2012-12-2 21:59:19 | 显示全部楼层
你是用arm-linux-gcc编译的吗
回复 支持 反对

使用道具 举报

rrrps 该用户已被删除
发表于 2012-12-4 13:50:45 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2025-4-19 23:10

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

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