|
|
Subscribe / Log in / New account

Driver porting: compiling external modules

Driver porting: compiling external modules

Posted Feb 6, 2003 6:05 UTC (Thu) by rfunk (subscriber, #4054)
Parent article: Driver porting: compiling external modules

For the make trickery in the latter part of this article, it's important to note that the original make command assumes the kernel source is in /usr/src/linux/:
make -C /usr/src/linux SUBDIRS=$PWD modules
While the makefile that allows a shorter command line assumes the kernel source is in a directory like /lib/modules/2.5.59/build/, due to the following line:
KDIR := /lib/modules/$(shell uname -r)/build

I believe there was some minor controversy on the linux-kernel mailing list recently over which location is more appropriate.


to post comments

Path to the kernel source

Posted Feb 6, 2003 14:44 UTC (Thu) by corbet (editor, #1) [Link] (3 responses)

Actually, /usr/src/linux is pretty much deprecated by the Prime Penguin himself; you're supposed to keep your kernel sources somewhere else. I got lazy and used it in the example, mostly because it's shorter to type than the /lib/modules path. The latter is the better way to go, however, especially in scripts or makefiles - it "automatically" points to the right source tree, unless you move your trees around.

Path to the kernel source

Posted Oct 27, 2004 8:25 UTC (Wed) by rashminivarthy (guest, #25682) [Link] (2 responses)

hello,
i was trying to compile a simple helloworld module on linux-2.6
kernel (Fedoracore-2)i'm geting this error while using this
makefile
---------------
|MakeFile |
----------------
ifneq ($(KERNELRELEASE),)
obj-m := hello.o
else
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
endif
---------------
|ERROR MESSAGE|
----------------
cc hello.c -o hello
hello.c:1:26: linux/module.h: No such file or directory
hello.c:2:27: linux/kernel.h: No such file or directory
hello.c:3:24: linux/init.h: No such file or directory
make: *** [hello] Error 1

unable to use ksyms on 2.6 kernel

Posted Oct 27, 2004 10:17 UTC (Wed) by rashminivarthy (guest, #25682) [Link] (1 responses)

hello
i tried using ksyms on 2.6 kernel to view all the exported kernel
symbols .It gave an error-
ksyms: QM_MODULES: Function not implemented

plz any 1 reply back

unable to use ksyms on 2.6 kernel

Posted Jul 18, 2005 11:38 UTC (Mon) by kalou (guest, #31046) [Link]

Hi rashminivarthy,

your kernel is not module enabled,
obviously.

Sincere Regards,

Olivier

Driver porting: compiling external modules

Posted Sep 14, 2005 23:45 UTC (Wed) by mraviraj (guest, #32463) [Link]

We have been using linux 2.4 for the development and recently started supporting 2.6.

I need to port our existing makefiles to work with 2.4 and 2.6.

while i am trying to use following syntax for 2.4, it is just doing 'make clean' job in linux kernel directory.

ifeq ($(KERNELRELEASE),)
obj-m := foo.o
else
KDIR := /linux/kernel/src/v2.4/linux-2.4.31
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
endif

foo-objs := foo1.o foo2.o

Can someone please share their experience in compiling the same source code for 2.4 and 2.6 ?

thanks ..
Raviraj


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds