android6.0 insmod xx.ko, exec format error

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

android6.0 insmod xx.ko, exec format error

5,030 次查看
jiejia
Contributor III

Hi,

   I have a board reference to imx6q-sabresd using android_M6.0.1_2.0.0_source.tar.gz.

   I am trying to port device drivers on this board. 

   makefile:

obj-m := sema.o
KDIR := /work/myandroid/kernel_imx/
PWD := $(shell pwd)
all:
   make -C $(KDIR) ARCH=arm CROSS_COMPILE=arm-linux-androideabi- M=$(PWD) modules
clean:
   $(MAKE) -C $(KDIR) M=$(PWD) clean

 

when insmod sema.ko:

root@sabresd_6dq:/data/local/tmp # insmod sema.ko
insmod: failed to load sema.ko: Exec format error

标签 (4)
0 项奖励
回复
1 回复

2,102 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Jia,

    The question is on how to compile linux kernel module and write Makefile, Actually, it is not within our support range. Only give you some advice, help you correct your Makefile, see below, please!

---------------------------------------------Pay attention to correct path of your compiler----------------------------

obj-m := sema.o

sema-objs := sema.o
KDIR := /work/myandroid/kernel_imx/
PWD := $(shell pwd)

ARCH=arm

CROSS_COMPILE=arm-eabi-

CC=$(CROSS_COMPILE)gcc

LD=$(CROSS_COMPILE)ld
all:
   make -C $(KDIR) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) modules
clean:
   $(MAKE) -C $(KDIR) M=$(PWD) clean

--------------------------------------------------------------------------------------------------------------------------------------------

Try it , please!

Regards,

Weidong

0 项奖励
回复