简体   繁体   中英

Cross compiling a kernel module: how to set configs right

I'm trying to cross-compile an external module for the Beaglebone (Linux, ARM).To avoid kernel version issues I grabbed a kernel tarball and cross-compiled for ARM with the CodeSourcery toolchain on the host machine (x86). Then I cross-compiled an external hello-world module with the exact same toolchain against the exact same kernel sources. I used this simple makefile:

obj-m += hello-1.o

all:
   make -C /home/***/****/linux-3.2.0-beaglebone-20120411.00              
M=$(PWD) modules

clean:
    make -C /home/***/****/linux-3.2.0-beaglebone-20120411.00 M=$(PWD) clean

When I copy the ko-file over to target and try to insmod it I get: "insmod: error inserting 'hello-1.ko': -1 Invalid module format" which (from what I learned in this group and elsewhere) usually stems from conflicting kernel versions, and indeed uname -a on the target gives:

Linux beaglebone 3.2.18 #1 Wed May 30 14:21:54 CEST 2012 armv7l GNU/Linux

while modinfo hello-1.ko gives:

srcversion: 140276773A3090F6F33891F depends:
vermagic: 3.2.0+ mod_unload modversions ARMv5 p2v8

So version 3.2.18 vs. 3.2.0+ (why the +?) and armv7l vs. ARMv5!

Does anyone know why I get different versions albeit I compiled against the same kernel-sources (maybe some configs)?

Any suggestions are appreciated!

best, Chris

answer is, you should run 'the kernel you compiled on beagle board.

'+' means that you modified your source tree.

And finally make sure that you're using correct defconfig. 'make beagle_defconfig' should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM