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
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
It turns out I had to use
make CFLAGS_MODULE=-fno-pic