Linux Kernel Module - Sharing variables between source files
问题 I'm trying to link a kernel module to a non-LKM source file. The problem is, I'm running into some issues. The names of the two files are chardev.c (the LKM) and foo.c. My Makefile: obj-m += chardev.o obj-y += foo.o all: make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules $(CC) test.c -o test clean: make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) clean rm test Inside of chardev.c I've the following line of code: extern int foo; , and inside foo I've the following line of