Thomas Eibner wrote:
> 
> On Fri, Jun 15, 2001 at 04:54:24PM -0500, Seth Bernsen wrote:
> >
> > Thanks to those who answered my previous question.  I have a new one.
> > I've got Rubini's book, "Linux Device Drivers" and I'm trying the little
> > sample program demonstrated in the first chapter.  The program is very
> > simple and looks like:
> >
> > #define MODULE
> > #include <linux/module.h>
> >
> > int init_module(void) { printk("<1>Hello World\n"); return 0; }
> > void cleanup_module(void) { printk("<1>Goodbye World\n"); }
> >
> > It compiles with
> >
> > gcc -c hello.c
> >
> > The problem comes when I try to install it.  I have two machines, on the
> > first, both RedHat distributions.  The first is RH6.0 (2.2.5-5) and the
> > other is RH6.2 (2.2.14-5).  On the first machine I do:
> >
> > insmod hello.o
> >
> > and the module is installed.  On the second machine, with the newer
> > kernel I do the same thing and printk is unresolvable.  I've tried a
> > number of insmod options to no avail.  The kernel is built to support
> > dynamic modules so why can't the modules see any of the exported
> > functions?  One other difference is that the kernel on the older machine
> > has been rebuilt in the past (for unrelated reasons) and the newer
> > machine has not and so has no kernel object code laying around.
> 
> Don't you need this:
> 
> #include <linux/kernel.h>
> 
> before you include <linux/module.h>
> 
> as printk is defined in include/linux/kernel.h

If that were the case I think there would be warnings from the compiler
about implicitly defined functions (printk in this case).  Either way, I
tried adding the kernel.h reference, but it had no effect on the
outcome.

Thanks,
Seth

-- 

Seth Bernsen
V-CPU Engineer
Innoveda, Inc.
Phone: 651-765-2252
Fax: 651-765-2205
http://www.innoveda.com