Makefile for kernel modules

From: Dragoslav Zaric
Date: Sat Oct 02 2010 - 13:23:01 EST


Dear all,

I have a question about kernel modules compilation. I understand the
way how make/Makefile works,
for example if I have two source files, hexdump3.asm and textlib.asm,
my Makefile will look like this:
---------------------------------------------------------------------------
hexdump3: hexdump3.o
ld -o hexdump3 hexdump3.o textlib.o
hexdump3.o: hexdump3.asm
nasm -f elf -g -F stabs hexdump3.asm
textlib.o: textlib.asm
nasm -f elf -g -F stabs textlib.asm
---------------------------------------------------------------------------
and I understand how this works, it goes bottom up, building dependencies first.

But if I have two kernel modules source files, for example, start.c
and stop.c, my Makefile will look like this:
---------------------------------------------------------------------------
obj-m += startstop.o
startstop-objs := start.o stop.o

all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
---------------------------------------------------------------------------
But this does not work on my machine, it runs without errors but does
not produce startstop.ko file.
Also, when I run make on my machine, first line that appears is:
---------------------------------------------------------------------------
make -C /lib/modules/2.6.33.7-rt29/build
M=/home/maiev/work/modules/parts modules
---------------------------------------------------------------------------

So, does anybody know what are lines for manual kernel module
compilation using probably gcc,
without 'obj-m +=' or at least how Makefile should look for multiple
kernel module source files ???

Kind regards

--
Dragoslav Zaric

Professional Programmer
MSc Astrophysics
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/