* 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
* Re: gcc compile kernel 2.6 module
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
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2010-10-03 17:01 UTC (permalink / raw)
To: Frank Coldwell; +Cc: linux-kernel
On 10/03/2010 01:31 PM, Frank Coldwell wrote:
> Does anybody know how should look gcc compilation line
> to compile kernel module for kernel 2.6
Don't do this on your own, leave it on kbuild:
Documentation/kbuild/modules.txt
regards,
--
js
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gcc compile kernel 2.6 module
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
1 sibling, 0 replies; 3+ messages in thread
From: Américo Wang @ 2010-10-04 2:03 UTC (permalink / raw)
To: Frank Coldwell; +Cc: linux-kernel
On Sun, Oct 03, 2010 at 03:31:01PM +0400, Frank Coldwell wrote:
>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
In 2.6, it would be much simpiler, kbuild has some pre-defined
variables for you to use, so you don't need to, e.g. specify
INCLUDE and CFLAGS in this way.
Please read Documentation/kbuild/*.
^ 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