The kernel module may contain multiple files. However, they cannot be linked together like ordinary application build method. We will go over the way to compile multiple .c files and put them together into a kernel module with simple makefile modifications.
Makefile
obj-m := mg12864drv.o
mg12864drv-objs := font_eng.o font_han.o
KDIR := /opt/arm7eko/kernel/linux-2.6.22.8-cvs
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
rm -rf *.ko
rm -rf *.mod.*
rm -rf .*.cmd
rm -rf *.o
The module name specified in the "obj-m :=" should be the same as the variable name in the next line, which is "mg12864drv-objs :=".