help: atomic_t error when complie kernel module "hello world"

help: atomic_t error when complie kernel module "hello world"

Post by yang296 » Fri, 31 Jan 2003 10:54:16



Hi, super,
I am new to kernel programming. I met problem when complied the sample
kernel module example "hello world " , said: structure error or not found
atomic_t(sorry ,not sure the spell), and parse error .. in module.h...
the codes : hello.c is :
#include <linux/kernel.h>   #include <linux/module.h>
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
int init_module()
{  printk("Hello, world - this is the kernel speaking\n");    return 0;}
void cleanup_module()
{  printk("Short is the life of a kernel module\n");}

my kernel version is 2.4.18.
is there anybody can help me with that?
many thankx,
Judy

 
 
 

help: atomic_t error when complie kernel module "hello world"

Post by Kasper Dupon » Fri, 31 Jan 2003 15:08:15



> Hi, super,
> I am new to kernel programming. I met problem when complied the sample
> kernel module example "hello world " , said: structure error or not found
> atomic_t(sorry ,not sure the spell), and parse error .. in module.h...
> the codes : hello.c is :
> #include <linux/kernel.h>   #include <linux/module.h>
> #if CONFIG_MODVERSIONS==1
> #define MODVERSIONS
> #include <linux/modversions.h>
> #endif
> int init_module()
> {  printk("Hello, world - this is the kernel speaking\n");    return 0;}
> void cleanup_module()
> {  printk("Short is the life of a kernel module\n");}

> my kernel version is 2.4.18.
> is there anybody can help me with that?
> many thankx,
> Judy

I can compile and run it without problems. (Except from the missing
newline between the first two #include lines which I of course had
to add myself.) I am using kernel version 2.4.19, but that is not
the reason for your problem. Many compile problems with modules are
due to an incorrect commandline being used for compilation. Which
options did you use for gcc?

BTW I just wrote a small script to compile a module so I wouldn't
have to type it over and over again each time I compile a module:

#!/bin/bash

--
Kasper Dupont -- der bruger for meget tid p? usenet.

for(_=52;_;(_%5)||(_/=5),(_%5)&&(_-=2))putchar(_);

 
 
 

help: atomic_t error when complie kernel module "hello world"

Post by paopaoe » Fri, 31 Jan 2003 21:11:49


#include <linux/module.h>
#include <linux/kernel.h>
in this order.

$gcc -c helloworld.c -I/usr/src/`uname -r`/include

try it



Quote:> Hi, super,
> I am new to kernel programming. I met problem when complied the sample
> kernel module example "hello world " , said: structure error or not found
> atomic_t(sorry ,not sure the spell), and parse error .. in module.h...
> the codes : hello.c is :
> #include <linux/kernel.h>   #include <linux/module.h>
> #if CONFIG_MODVERSIONS==1
> #define MODVERSIONS
> #include <linux/modversions.h>
> #endif
> int init_module()
> {  printk("Hello, world - this is the kernel speaking\n");    return 0;}
> void cleanup_module()
> {  printk("Short is the life of a kernel module\n");}

> my kernel version is 2.4.18.
> is there anybody can help me with that?
> many thankx,
> Judy

 
 
 

1. Help: atomic_t error when compile an simple kernel module "hello world"

Hi, super,
I am new to kernel programming. I met problem when complied the sample
kernel module example "hello world " , said: structure error or not found
atomic_t(sorry ,not sure the spell), and parse error .. in module.h...
the codes : hello.c is :
#include <linux/kernel.h>   #include <linux/module.h>
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
int init_module()
{  printk("Hello, world - this is the kernel speaking\n");    return 0;}
void cleanup_module()
{  printk("Short is the life of a kernel module\n");}

my kernel version is 2.4.18.
is there anybody can help me with that?
many thankx,
Judy

2. qt3: QComboTableItem - how i can use the selection

3. erroneous "hello" from forked "hello world" process!

4. single click in GNOME???

5. "Hello World!" = "HellWrld" on Solaris 8, Linux ok

6. Telnet question.

7. how to tell if a mac is "new world " or "old world"

8. dd command fails when used with remsh

9. Help me with Perl "Hello world"

10. "Hello,Hello,Hello-Whats going on here then?"

11. GETSERVBYNAME()????????????????????"""""""""""""

12. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""

13. Driver performace "Kernel Mode" and "Module Mode"?