OK6410A 256M/4G linux3.0.1加载模块失败问题求助
问题:hello.ko加载失败,提示模块格式错误# insmod hello.ko
insmod: cannot insert 'hello.ko': invalid module format
#
开发板: OK6410A 256MB DDR, 4GB NAND FLASH,linux3.0.1
# 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: Entering directory `/usr/src/linux-headers-3.2.0-23-generic-pae'
LD /home/gavin/forlinx/LDD/hello/built-in.o
CC /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
Building modules, stage 2.
MODPOST 1 modules
CC /home/gavin/forlinx/LDD/hello/hello.mod.o
LD /home/gavin/forlinx/LDD/hello/hello.ko
make: Leaving directory `/usr/src/linux-headers-3.2.0-23-generic-pae'
gavin@ubuntu:~/forlinx/LDD/hello$
你是用arm-linux-gcc编译的吗
页:
[1]