public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
* Error building 'Hello,World' kernel Module
@ 2004-08-04 22:43 Lei Yang
  2004-08-05  5:17 ` Shine Mohamed Jabbar
  0 siblings, 1 reply; 5+ messages in thread
From: Lei Yang @ 2004-08-04 22:43 UTC (permalink / raw)
  To: kernelnewbies, linux-newbie

Hello,

I am learning about module programming and just tried to build a
simplest module, Hello World.

The code is as follows:
/* hello.c
#include <linux/module.h>       
#include <linux/kernel.h>      

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

void cleanup_module(void)
{
        printk(KERN_ALERT "Goodbye world!\n");
}


The makefile is just one line:
 obj-m += hello.o

Then as root, I did in the HelloWorld directory:

make -C /usr/src/linux-`uname -r` SUBDIRS=$PWD modules

There is such an error:
make: Entering directory `/usr/src/linux-2.6.5-7.104-default'

WARNING: Symbol version dump
/usr/src/linux-2.6.5-7.104-default/Module.symvers is  missing, modules
will have CONFIG_MODVERSIONS disabled.

make[1]: *** No rule to make target `/home/lei/HelloWorld/hello.c',
needed by `/home/lei/HelloWorld/hello.o'.  Stop.
make: *** [_module_/home/lei/HelloWorld] Error 2
make: Leaving directory `/usr/src/linux-2.6.5-7.104-default'


Appreciate any comments and help!

TIA
Lei


-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

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

* Re: Error building 'Hello,World' kernel Module
  2004-08-04 22:43 Error building 'Hello,World' kernel Module Lei Yang
@ 2004-08-05  5:17 ` Shine Mohamed Jabbar
  2004-08-05 22:44   ` Lei Yang
  0 siblings, 1 reply; 5+ messages in thread
From: Shine Mohamed Jabbar @ 2004-08-05  5:17 UTC (permalink / raw)
  To: Lei Yang; +Cc: Kernel Newbies Mailing List, linux-newbie

Hi,

I tried ur program in my machine and
its working fine.

Apart from what u've done I did two more things
1) Copied the config file from the /boot to kernel
   source directory and done "make menuconfig"

2) Done a make in the kernel source till it compiles
   the first c file (CC      init/main.o). (I've done
   because to make a link of include/asm->include/asm-i386).

Regards,
Shine Mohamed Jabbar

On Thu, 2004-08-05 at 04:13, Lei Yang wrote:
> Hello,
> 
> I am learning about module programming and just tried to build a
> simplest module, Hello World.
> 
> The code is as follows:
> /* hello.c
> #include <linux/module.h>       
> #include <linux/kernel.h>      
> 
> int init_module(void)
> {
>         printk("Hello world!\n");
>         return 0;
> }
> 
> void cleanup_module(void)
> {
>         printk(KERN_ALERT "Goodbye world!\n");
> }
> 
> 
> The makefile is just one line:
>  obj-m += hello.o
> 
> Then as root, I did in the HelloWorld directory:
> 
> make -C /usr/src/linux-`uname -r` SUBDIRS=$PWD modules
> 
> There is such an error:
> make: Entering directory `/usr/src/linux-2.6.5-7.104-default'
> 
> WARNING: Symbol version dump
> /usr/src/linux-2.6.5-7.104-default/Module.symvers is  missing, modules
> will have CONFIG_MODVERSIONS disabled.
> 
> make[1]: *** No rule to make target `/home/lei/HelloWorld/hello.c',
> needed by `/home/lei/HelloWorld/hello.o'.  Stop.
> make: *** [_module_/home/lei/HelloWorld] Error 2
> make: Leaving directory `/usr/src/linux-2.6.5-7.104-default'
> 
> 
> Appreciate any comments and help!
> 
> TIA
> Lei
> 
> 
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

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

* Re: Error building 'Hello,World' kernel Module
  2004-08-05  5:17 ` Shine Mohamed Jabbar
@ 2004-08-05 22:44   ` Lei Yang
  2004-08-06  5:20     ` Shine Mohamed Jabbar
  0 siblings, 1 reply; 5+ messages in thread
From: Lei Yang @ 2004-08-05 22:44 UTC (permalink / raw)
  To: shinemohamed_j; +Cc: Kernel Newbies Mailing List, linux-newbie

Shine Mohamed Jabbar wrote:
> Hi,
> 
> I tried ur program in my machine and
> its working fine.
> 
> Apart from what u've done I did two more things
> 1) Copied the config file from the /boot to kernel
>    source directory and done "make menuconfig"

I didn't copy anything to kernel source, I just did 'make oldconfig'

> 2) Done a make in the kernel source till it compiles
>    the first c file (CC      init/main.o). (I've done
>    because to make a link of include/asm->include/asm-i386).

Is this really necessary...? I don't know. I didn't do that. I thought 
all the information module needed is the kernel configuration.

Thanks.
Lei

> Regards,
> Shine Mohamed Jabbar
> 
> On Thu, 2004-08-05 at 04:13, Lei Yang wrote:
> 
>>Hello,
>>
>>I am learning about module programming and just tried to build a
>>simplest module, Hello World.
>>
>>The code is as follows:
>>/* hello.c
>>#include <linux/module.h>       
>>#include <linux/kernel.h>      
>>
>>int init_module(void)
>>{
>>        printk("Hello world!\n");
>>        return 0;
>>}
>>
>>void cleanup_module(void)
>>{
>>        printk(KERN_ALERT "Goodbye world!\n");
>>}
>>
>>
>>The makefile is just one line:
>> obj-m += hello.o
>>
>>Then as root, I did in the HelloWorld directory:
>>
>>make -C /usr/src/linux-`uname -r` SUBDIRS=$PWD modules
>>
>>There is such an error:
>>make: Entering directory `/usr/src/linux-2.6.5-7.104-default'
>>
>>WARNING: Symbol version dump
>>/usr/src/linux-2.6.5-7.104-default/Module.symvers is  missing, modules
>>will have CONFIG_MODVERSIONS disabled.
>>
>>make[1]: *** No rule to make target `/home/lei/HelloWorld/hello.c',
>>needed by `/home/lei/HelloWorld/hello.o'.  Stop.
>>make: *** [_module_/home/lei/HelloWorld] Error 2
>>make: Leaving directory `/usr/src/linux-2.6.5-7.104-default'
>>
>>
>>Appreciate any comments and help!
>>
>>TIA
>>Lei
>>
>>
>>
>>--
>>Kernelnewbies: Help each other learn about the Linux kernel.
>>Archive:       http://mail.nl.linux.org/kernelnewbies/
>>FAQ:           http://kernelnewbies.org/faq/
>>
>>
> 
> 
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

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

* Re: Error building 'Hello,World' kernel Module
  2004-08-05 22:44   ` Lei Yang
@ 2004-08-06  5:20     ` Shine Mohamed Jabbar
  2004-08-06  5:59       ` pa3gcu
  0 siblings, 1 reply; 5+ messages in thread
From: Shine Mohamed Jabbar @ 2004-08-06  5:20 UTC (permalink / raw)
  To: Lei Yang; +Cc: Kernel Newbies Mailing List, linux-newbie

On Fri, 2004-08-06 at 04:14, Lei Yang wrote:
> Shine Mohamed Jabbar wrote:
> > Hi,
> > 
> > I tried ur program in my machine and
> > its working fine.
> > 
> > Apart from what u've done I did two more things
> > 1) Copied the config file from the /boot to kernel
> >    source directory and done "make menuconfig"
> 
> I didn't copy anything to kernel source, I just did 'make oldconfig'

Thats fine..
> 
> > 2) Done a make in the kernel source till it compiles
> >    the first c file (CC      init/main.o). (I've done
> >    because to make a link of include/asm->include/asm-i386).
> 
> Is this really necessary...? I don't know. I didn't do that. I thought 
> all the information module needed is the kernel configuration.

In my case the soft link {KERNEL SRC}/include/asm was not defined.
Without that soft link it was not possible to include arch specific
header files.

So when I did a "make" (for first/one time) that link came
automatically (by some scripts). Am I right ?

Thanks and Regards,
Shine Mohamed Jabbar

> 
> Thanks.
> Lei
> 
> > Regards,
> > Shine Mohamed Jabbar
> > 
> > On Thu, 2004-08-05 at 04:13, Lei Yang wrote:
> > 
> >>Hello,
> >>
> >>I am learning about module programming and just tried to build a
> >>simplest module, Hello World.
> >>
> >>The code is as follows:
> >>/* hello.c
> >>#include <linux/module.h>       
> >>#include <linux/kernel.h>      
> >>
> >>int init_module(void)
> >>{
> >>        printk("Hello world!\n");
> >>        return 0;
> >>}
> >>
> >>void cleanup_module(void)
> >>{
> >>        printk(KERN_ALERT "Goodbye world!\n");
> >>}
> >>
> >>
> >>The makefile is just one line:
> >> obj-m += hello.o
> >>
> >>Then as root, I did in the HelloWorld directory:
> >>
> >>make -C /usr/src/linux-`uname -r` SUBDIRS=$PWD modules
> >>
> >>There is such an error:
> >>make: Entering directory `/usr/src/linux-2.6.5-7.104-default'
> >>
> >>WARNING: Symbol version dump
> >>/usr/src/linux-2.6.5-7.104-default/Module.symvers is  missing, modules
> >>will have CONFIG_MODVERSIONS disabled.
> >>
> >>make[1]: *** No rule to make target `/home/lei/HelloWorld/hello.c',
> >>needed by `/home/lei/HelloWorld/hello.o'.  Stop.
> >>make: *** [_module_/home/lei/HelloWorld] Error 2
> >>make: Leaving directory `/usr/src/linux-2.6.5-7.104-default'
> >>
> >>
> >>Appreciate any comments and help!
> >>
> >>TIA
> >>Lei
> >>
> >>
> >>
> >>--
> >>Kernelnewbies: Help each other learn about the Linux kernel.
> >>Archive:       http://mail.nl.linux.org/kernelnewbies/
> >>FAQ:           http://kernelnewbies.org/faq/
> >>
> >>
> > 
> > 
> > 
> > --
> > Kernelnewbies: Help each other learn about the Linux kernel.
> > Archive:       http://mail.nl.linux.org/kernelnewbies/
> > FAQ:           http://kernelnewbies.org/faq/
> > 
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

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

* Re: Error building 'Hello,World' kernel Module
  2004-08-06  5:20     ` Shine Mohamed Jabbar
@ 2004-08-06  5:59       ` pa3gcu
  0 siblings, 0 replies; 5+ messages in thread
From: pa3gcu @ 2004-08-06  5:59 UTC (permalink / raw)
  To: shinemohamed_j; +Cc: Lei Yang, Kernel Newbies Mailing List, linux-newbie

On Friday 06 August 2004 07:20, Shine Mohamed Jabbar wrote:
> In my case the soft link {KERNEL SRC}/include/asm was not defined.
> Without that soft link it was not possible to include arch specific
> header files.
>
> So when I did a "make" (for first/one time) that link came
> automatically (by some scripts). Am I right ?

You are correct in using make, but in 2.6 kernels you can use;
make symlinks
In 2.4 kernels 'make dep' does the job.
Its not a script its the Makefile via make that places symlinks in 2.6 
kernels.

> Thanks and Regards,
> Shine Mohamed Jabbar

-- 
If the Linux community is a bunch of thieves because they
try to imitate windows programs, then the Windows community
is built on organized crime.

Regards Richard
pa3gcu@zeelandnet.nl
http://people.zeelandnet.nl/pa3gcu/


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


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

end of thread, other threads:[~2004-08-06  5:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-04 22:43 Error building 'Hello,World' kernel Module Lei Yang
2004-08-05  5:17 ` Shine Mohamed Jabbar
2004-08-05 22:44   ` Lei Yang
2004-08-06  5:20     ` Shine Mohamed Jabbar
2004-08-06  5:59       ` pa3gcu

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