Hello world kernel module for android & unknown relocation: 27 when insmod

后端 未结 2 598
悲&欢浪女
悲&欢浪女 2021-01-17 13:30

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) i

2条回答
  •  感动是毒
    2021-01-17 13:43

    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

提交回复
热议问题