[lkml]   [2001]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRE: Exporting symbols from a module.
If you have a local makefile with which you wish to build your module 
not linked under the kernel tree in the proper way, you still can
"ride" on the master Makefile.

This way one can eliminate the dependency on your particular
machine kernel compilation options to be hardwired in the local Makefile.
I.e., once you reconfigure the kernel, your driver will compile
itself when you do a local "make" with the correct set of the new flags.

This is what you can do on 2.2 (Makefile excerpt follows):
EXTRA_CFLAGS := -DDEBUG -DLINUX -I/usr/src/foo/include
MI_OBJS := your-module.o
O_TARGET := your-module.o
O_OBJS := your1.o your2.o

# Reuse Linux kernel master makefile on this directory
include $(TOPDIR)/Rules.make
cd '/usr/src/linux' && make modules SUBDIRS=$(PWD)

In 2.4 the syntax is different. Rename
MI_OBJS to obj-m and O_OBJS to obj-y to achieve the same goal there:
obj-m := your-module.o
O_TARGET := your-module.o
obj-y := your1.o your2.o


> -----Original Message-----
> From: Anders Peter Fugmann []
> Sent: Thursday, May 17, 2001 12:51 PM
> To: Andreas Dilger
> Cc: linux-kernel
> Subject: Re: Exporting symbols from a module.
> Resolved.
> I just looked at what the kernel did whne compiling a module that
> exported some symbols, and discovered that I needed
> to set CFLAGS to:
> -D__KERNEL__ -I$/usr/src/linux) -Wall -Wstrict-prototypes \
> -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe \
> /usr/src/linux/modversions.h
> Now all works correctly, and I can load my modules.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:53    [W:0.024 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site