mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Problem in module loading automatically at boot time
@ 2004-06-11 15:44 Srinivas G.
  2004-06-11 16:59 ` Richard B. Johnson
  0 siblings, 1 reply; 3+ messages in thread
From: Srinivas G. @ 2004-06-11 15:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Surendra I., Subramanyam B


Hi,

I have written a small driver program called hello.c.

************************************************************************
***************
#include <linux/module.h>

MODULE_LICENSE("GPL");

int init_module(void)
{
  printk("<1>" "Hello world\n");
  return 0;
}

void cleanup_module(void)
{
  printk("<1>good bye\n");
}

************************************************************************
****************

I compiled the above program with cc -DMODULE -D__KERNEL__
-I/usr/src/linux2.4/include -O2 -c hello.c

I am using Red Hat Linux 7.3 with kernel version of 2.4.18-3.
It works fine when I load it with insmod from root prompt.

Now, I want to make it load automatically at boot time. 
For that I have used the following steps.

---> I copied the hello.o file in the
/lib/modules/2.4.18-3/kernel/drivers/block

---> I run the depmod command. It included the above path in
/lib/modules/2.4.18-3/modules.dep file.

---> I added "alias hello1 hello" entry into /etc/modules.conf file.

When I reboot the machine after the above changes, my driver is not
loaded and an error message is printed as follows.

---> depmod: *** Unresolved symbols in
/lib/modules/2.4.18-3/kernel/drivers/block/hello.o


Could anyone suggest me, if I am missing anything here?

Srinivas G



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem in module loading automatically at boot time
  2004-06-11 15:44 Problem in module loading automatically at boot time Srinivas G.
@ 2004-06-11 16:59 ` Richard B. Johnson
  0 siblings, 0 replies; 3+ messages in thread
From: Richard B. Johnson @ 2004-06-11 16:59 UTC (permalink / raw)
  To: Srinivas G.; +Cc: linux-kernel, Surendra I., Subramanyam B

On Fri, 11 Jun 2004, Srinivas G. wrote:

>
> Hi,
>
> I have written a small driver program called hello.c.
>
> ************************************************************************
> ***************
> #include <linux/module.h>
>
> MODULE_LICENSE("GPL");
>
> int init_module(void)
> {
>   printk("<1>" "Hello world\n");
>   return 0;
> }
>
> void cleanup_module(void)
> {
>   printk("<1>good bye\n");
> }
>
> ************************************************************************
> ****************
>
> I compiled the above program with cc -DMODULE -D__KERNEL__
> -I/usr/src/linux2.4/include -O2 -c hello.c
>
> I am using Red Hat Linux 7.3 with kernel version of 2.4.18-3.
> It works fine when I load it with insmod from root prompt.
>
> Now, I want to make it load automatically at boot time.
> For that I have used the following steps.
>
> ---> I copied the hello.o file in the
> /lib/modules/2.4.18-3/kernel/drivers/block
>
> ---> I run the depmod command. It included the above path in
> /lib/modules/2.4.18-3/modules.dep file.
>
> ---> I added "alias hello1 hello" entry into /etc/modules.conf file.
>
> When I reboot the machine after the above changes, my driver is not
> loaded and an error message is printed as follows.
>
> ---> depmod: *** Unresolved symbols in
> /lib/modules/2.4.18-3/kernel/drivers/block/hello.o
>
>
> Could anyone suggest me, if I am missing anything here?
>
> Srinivas G
>

Maybe `depmod -e ...` would tell you what symbols are missing??

Then, after you observe that, try including <linux/kernel.h>,
and <linux/module.h>, like you are supposed to do.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
            Note 96.31% of all statistics are fiction.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Problem in module loading automatically at boot time
@ 2004-06-12  8:45 Srinivas G.
  0 siblings, 0 replies; 3+ messages in thread
From: Srinivas G. @ 2004-06-12  8:45 UTC (permalink / raw)
  To: root; +Cc: linux-kernel, Surendra I., Subramanyam B

[-- Attachment #1: Type: text/plain, Size: 2390 bytes --]

Hi Johnson,

I tried with depmod -e option. It showed that printk is unresolved
symbol. Is it current? Is it(printk) not a kernel symbol? If so, give me
a suggestion.

Note: I included the <linux/kernel.h> and <linux/module.h> also. Please
see the attachments.

Thanks and regards,

Srinivas G

-----Original Message-----
From: Richard B. Johnson [mailto:root@chaos.analogic.com] 
Sent: Friday, June 11, 2004 10:29 PM
To: Srinivas G.
Cc: linux-kernel@vger.kernel.org; Surendra I.; Subramanyam B
Subject: Re: Problem in module loading automatically at boot time

On Fri, 11 Jun 2004, Srinivas G. wrote:

>
> Hi,
>
> I have written a small driver program called hello.c.
>
>
************************************************************************
> ***************
> #include <linux/module.h>
>
> MODULE_LICENSE("GPL");
>
> int init_module(void)
> {
>   printk("<1>" "Hello world\n");
>   return 0;
> }
>
> void cleanup_module(void)
> {
>   printk("<1>good bye\n");
> }
>
>
************************************************************************
> ****************
>
> I compiled the above program with cc -DMODULE -D__KERNEL__
> -I/usr/src/linux2.4/include -O2 -c hello.c
>
> I am using Red Hat Linux 7.3 with kernel version of 2.4.18-3.
> It works fine when I load it with insmod from root prompt.
>
> Now, I want to make it load automatically at boot time.
> For that I have used the following steps.
>
> ---> I copied the hello.o file in the
> /lib/modules/2.4.18-3/kernel/drivers/block
>
> ---> I run the depmod command. It included the above path in
> /lib/modules/2.4.18-3/modules.dep file.
>
> ---> I added "alias hello1 hello" entry into /etc/modules.conf file.
>
> When I reboot the machine after the above changes, my driver is not
> loaded and an error message is printed as follows.
>
> ---> depmod: *** Unresolved symbols in
> /lib/modules/2.4.18-3/kernel/drivers/block/hello.o
>
>
> Could anyone suggest me, if I am missing anything here?
>
> Srinivas G
>

Maybe `depmod -e ...` would tell you what symbols are missing??

Then, after you observe that, try including <linux/kernel.h>,
and <linux/module.h>, like you are supposed to do.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
            Note 96.31% of all statistics are fiction.



[-- Attachment #2: hello.c --]
[-- Type: application/octet-stream, Size: 644 bytes --]

/*
 * Simple hello.c program
 */

/* kernel header files */
#include <linux/init.h>       /* for explicit init & exit marco definitions */
#include <linux/kernel.h>     /* for printk */
#include <linux/module.h>     /* for everything ... */	

MODULE_LICENSE("GPL");
MODULE_AUTHOR("SRINIVAS G");

/*
 * Module entry point
 */ 
static int 
__init hello_init(void)
{
	printk("Hello, Welcome to Device Driver World!\n");
	return 0;
}

/*
 * Module exit point
 */
static void
__exit hello_exit(void)
{
	printk("Good Bye to Device Driver World!\n");
}

/* macros to define init and exit modules */
module_init(hello_init);
module_exit(hello_exit);



[-- Attachment #3: Makefile --]
[-- Type: application/octet-stream, Size: 262 bytes --]

#
# Make file for hello.c file
#

INCDIR=/usr/src/linux-2.4/include	# Include path on RedHat 7.3

TARGET=hellodemo.o
OBJS=hello.o

CFLAGS=-DMODULE -D__KERNEL__ -I$(INCDIR) -O2 

$(TARGET): $(OBJS)
	$(LD) -r -o $(TARGET) $(OBJS)

clean:
	$(RM) $(TARGET) $(OBJS)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-06-12  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-11 15:44 Problem in module loading automatically at boot time Srinivas G.
2004-06-11 16:59 ` Richard B. Johnson
2004-06-12  8:45 Srinivas G.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®