Forum Discussion
Altera_Forum
Honored Contributor
21 years agoThat's an extremely complicated makefile... have you tried using the Makefile I provided in this thread? It does allow for building outside of the kernel tree. As a bonus, it also pulls in all the necessary rules for building the module properly from the original kernel source instead of requiring you to specify the rules manually.
Give it a try, and post any errors that you get when you try running "make". It worked like a charm when I did it. In fact, here's the Makefile tailored to your situation:CONFIG_TEST_MOD=m
ifneq ($(KERNELRELEASE),)
# This is the section of the Makefile that builds the module inside the kernel
obj-$(CONFIG_TEST_MOD) := testModule_mod.o
else
# This section is for building the module outside of the source# $(ECLIPSE_WORKSPACE) is assumed to be defined externally by the environment
# please reference the articles on http://www.lwn.net regarding# kernel module development for more information about this Makefile
KDIR := $(KERNEL_PLUGIN)/linux-2.6.x
$(error You need to specify the kernel project that this module is being built for before this will work!)# delete the above line after you have modified the variable below to its proper setting
KERNEL_PROJECT := your_kernel_project
BUILDDIR := $(ECLIPSE_WORKSPACE)/$(KERNEL_PROJECT)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) O=$(BUILDDIR) SUBDIRS=$(PWD) modules
endif