How can I Build a module in a different folder
I had written a small HelloWorld module; I had prepared this simple
Makefile for it:
obj-m := HelloWorld.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
I ran make, the ko file was created, and I could insmod the module.
I want to be able to run make and that the results (the *.o and
*.ko and all intermediate results) will be in a different folder,
What should I do ?
I tried to run make make make O=myFolder (where myFolder is a directory
I created under where I am ) but I got errors.
How should this be done?
Moreover: can this be done by setting some option in the Makefile itself ?