Skip to content Skip to sidebar Skip to footer

Hello World Kernel Module For Android & Unknown Relocation: 27 When Insmod

I am trying to create a simple kernel module. I am trying to print messages to dmesg but i keep getting insmod: init_module 'hello.ko' failed (Exec format error) in android after :

Solution 1:

It turns out I had to use

make CFLAGS_MODULE=-fno-pic

Solution 2:

Thanks, -fno-pic got my dlkm working also. On to "real" work...

BTW, you can export ARCH, SUBARCH, CROSS_COMPILE, KERNELDIR in the shell so the Makefile becomes very simple. This also allows one to more easily build the dlkm for the native or target platform by setting the KERNELDIR properly (native does not need the ARCH, SUBARCH or CROSS_COMPILE vars.)

obj-m += hello.o

all: make -C $(KERNELDIR) M=$(PWD) modules

Post a Comment for "Hello World Kernel Module For Android & Unknown Relocation: 27 When Insmod"