gcc compile kernel 2.6 module

From: Frank Coldwell
Date: Sun Oct 03 2010 - 07:31:11 EST


Hi all,

Does anybody know how should look gcc compilation line
to compile kernel module for kernel 2.6

In 2.4 it looks like this:
----------------------------------------------------
TARGET := hello-1
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC := gcc-3.0

${TARGET}.o: ${TARGET}.c

.PHONY: clean

clean:
rm -rf ${TARGET}.o
----------------------------------------------------

and for multiple source files, like this:
----------------------------------------------------
CC=gcc
MODCFLAGS := -O -Wall -DMODULE -D__KERNEL__

hello.o: hello2_start.o hello2_stop.o
ld -m elf_i386 -r -o hello2.o hello2_start.o hello2_stop.o

start.o: hello2_start.c
${CC} ${MODCFLAGS} -c hello2_start.c

stop.o: hello2_stop.c
${CC} ${MODCFLAGS} -c hello2_stop.c
----------------------------------------------------

Kind regards,

Dragoslav Zaric
MSc Astrophysics
Professional programmer
--
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/