public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* gcc compile kernel 2.6 module
@ 2010-10-03 11:31 Frank Coldwell
  2010-10-03 17:01 ` Jiri Slaby
  2010-10-04  2:03 ` Américo Wang
  0 siblings, 2 replies; 3+ messages in thread
From: Frank Coldwell @ 2010-10-03 11:31 UTC (permalink / raw)
  To: linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-04  1:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-03 11:31 gcc compile kernel 2.6 module Frank Coldwell
2010-10-03 17:01 ` Jiri Slaby
2010-10-04  2:03 ` Américo Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox