Skip to contentSkip to conversation

Makefile problem

DISCUSSION cranium2003 2 participants 2 messages Mar 21, 2006

lore
Share & tools
lore
#0 lore raw

Hi,
I have some Makefile questions
1)Why a kernel module in 2.6 kernel cannot be compiled with single gcc command? Why it requires Makefile in current directory so that i can use Makefile?

2) why following command used to compile 2.4 kernel module fails on 2.6 kernel
gcc -D__KERNEL__ -DMODULE -DLINUX -O2 -Wall -Wstrict-prototypes -I/lib/modules/uname -r/build/include -c -o example.ko example.c

3) Is that because of gcc cannot create .ko file?? then what header changes occurred from .o to .ko module implementaion?

Thanks & Regards,
cranium

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#1 lore raw

Review

Quoted 11 lines · On Tue, 2006-03-21 at 03:21 -0800, cranium2003 wrote:

Hi,
I have some Makefile questions
1)Why a kernel module in 2.6 kernel cannot be compiled with single gcc command? Why it requires Makefile in current directory so that i can use Makefile?

2) why following command used to compile 2.4 kernel module fails on 2.6 kernel
gcc -D__KERNEL__ -DMODULE -DLINUX -O2 -Wall

(quoted diff) +0 -2
-Wstrict-prototypes -I/lib/modules/`uname
-r`/build/include -c -o example.ko example.c

because it's broken and isn't using the same CFLAGS as the kernel is. Read Documentation/kbuild/*

You *HAVE* to use the same CFLAGS as the rest of the kernel.