[Newbies] couldn't insert module Resolved
Tofloor
poster avatar
q7777
deepin
2022-08-25 01:39
Author

insmod: ERROR: could not insert module mm_test.ko: Invalid module format

Makefile

obj-m := mm_test.o

KERNELDIR =/home/XXX/Desktop/work/linux-5.15.34
PWD:=$(shell pwd)
all:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules  
clean:
	rm -rf *.o *.ko *.mod.* *.symvers *.order

uname -a

Linux XXX-PC 5.15.34-amd64-desktop #2 SMP Mon May 16 16:31:30 CST 2022 x86_64 GNU/Linux

Reply Favorite View the author
All Replies
寂静的羽夏
deepin
2022-08-25 02:48
#1

Please check that the header file version of the driver development is consistent with the kernel version of the test computer.

I suggest you compile the code on the test computer and insert the module to avoid this error.

Reply View the author
q7777
deepin
2022-08-25 04:40
#2
寂静的羽夏

Please check that the header file version of the driver development is consistent with the kernel version of the test computer.

I suggest you compile the code on the test computer and insert the module to avoid this error.

Thank,I changed KERNELDIR and it's worked.

Reply View the author