Some time ago, I developed a kernel module for ARMv7 (Cortex-A5). This module worked fine, but I needed to add a feature to it. Unfortunately, the machine that had the cross-compiler toolchain installed got repurposed in the mean time, so I had to set it up again. Of course, I found that I hadn't documented all the details, and I have been struggling to get a module that would actually load. After a day or so, I managed to compile something that was accepted by insmod
on the target.
But the module does nothing.
insmod
does not give me any errors. dmesg
doesn't show anything, although the module is supposed to print some info from its probe routine. Also, the character device it's supposed to create does not exist, obviously the module's probe routine didn't run.
If I do modinfo
on both the old .ko
(which I still have) and new .ko
, there are no differences. file
also shows the same output, except for the sha1
checksum, which is to be expected:
module_old.ko: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), BuildID[sha1]=1f55850e8da4b3b5931536060d62193d94730cf6, not stripped
module_new.ko: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), BuildID[sha1]=c3b1f6fdcb72381beb7b8a766c70af7a1252a78f, not stripped
The only difference I see is that the new .ko
is about 10x bigger than the old one:
-rw-r--r-- 1 root root 154504 Apr 21 23:38 module_new.ko
-rw-rw-r-- 1 root root 17956 Oct 4 2017 module_old.ko
My Makefile is as follows:
obj-m += mymodule.o
KERNEL_SOURCE_DIR = /home/ludo/linux-at91-linux4sam_5.3
all:
make -C $(KERNEL_SOURCE_DIR) CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm M=$(PWD) modules
clean:
make -C $(KERNEL_SOURCE_DIR) CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm M=$(PWD) clean
I tried adding
CFLAGS_mymodule.o := -march=armv7-a -mtune=cortex-a5
but this made no difference.
I'm building on Debian Jessie (8.10) with gcc 4.9. I do not recall exactly with what GCC version I built the old version, but it was 4.x, not newer.
Any ideas how I can debug this problem?