Re: Error building 'Hello,World' kernel Module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/


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


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux