【备忘录】加载模块提示“invalid module format”

按友善之臂的教程,加载示例模块报错:

[root@FriendlyARM /wrk]# insmod mini6410_hello_module.ko
insmod: can't insert 'mini6410_hello_module.ko': invalid module format

查看内核消息,没看懂,百度了些才了解。

[root@FriendlyARM /wrk]# dmesg|tail
eeprom_93cx6: version magic '2.6.38-FriendlyARM preempt mod_unload ARMv6 ' should be '2.6.38-FriendlyARM-g64c6ee8-dirty preempt mod_unload ARMv6 '

[root@FriendlyARM /wrk]# uname -r
2.6.38-FriendlyARM-g64c6ee8-dirty

ian@devel:/wrk/linux/src$ modinfo drivers/char/mini6410_hello_module.ko
filename:       /wrk/linux/src/drivers/char/mini6410_hello_module.ko
license:        GPL
depends:
vermagic:       2.6.38-FriendlyARM preempt mod_unload ARMv6

 将“-FriendlyARM”修改为“-FriendlayARM-g64c6ee8-dirty”,再重新编译模块即可。

ian@devel:/wrk/linux/src$ make menuconfig
    General setup  ---> 
      (-FriendlyARM-g64c6ee8-dirty) Local version - append to kernel release

ian@devel:/wrk/linux/src$ make modules
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
  Building modules, stage 2.
  MODPOST 5 modules
  CC      drivers/char/mini6410_hello_module.mod.o
  LD [M]  drivers/char/mini6410_hello_module.ko
  CC      drivers/scsi/scsi_wait_scan.mod.o
  LD [M]  drivers/scsi/scsi_wait_scan.ko
  CC      sound/soc/codecs/snd-soc-wm9713.mod.o
  LD [M]  sound/soc/codecs/snd-soc-wm9713.ko
  CC      sound/soc/samsung/snd-soc-ac97.mod.o
  LD [M]  sound/soc/samsung/snd-soc-ac97.ko
  CC      sound/soc/samsung/snd-soc-mini6410-wm9713.mod.o
  LD [M]  sound/soc/samsung/snd-soc-mini6410-wm9713.ko

 

模块相关命令:depmod, insmod, rmmod, lsmod, modinfo, modprobe

你可能感兴趣的:(Tiny6410)