LKM compile problem

LKM compile problem

Post by Farsh » Thu, 18 Jul 2002 09:25:26



Hi,

 I cannot compile even this simple hello.c LKM on Redhat 7.3 Kernel
2.4.3:

http://tldp.org/LDP/lkmpg/node11.html
(or find it at the end of this message)

 I get the following error messages:

[root]# make
gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c hello.c
In file included from hello.c:11:
/usr/include/linux/module.h:60: parse error before `atomic_t'
/usr/include/linux/module.h:60: warning: no semicolon at end of struct
or union
/usr/include/linux/module.h:60: warning: no semicolon at end of struct
or union
/usr/include/linux/module.h:62: parse error before `}'
/usr/include/linux/module.h:62: warning: data definition has no type
or storage class
/usr/include/linux/module.h:91: parse error before `}'
hello.c: In function `init_module':
hello.c:26: warning: implicit declaration of function `printk'
make: *** [hello.o] Error 1

 Any ideas?!

    thanks,
    Farshad

/* hello.c
 * Copyright (C) 1998 by Ori Pomerantz
 *
 * "Hello, world" - the kernel module version.
 */

/* The necessary header files */

/* Standard in kernel modules */
#include <linux/kernel.h> /* We're doing kernel work */
#include <linux/module.h> /* Specifically, a module */

/* Deal with CONFIG_MODVERSIONS */
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif

/* Initialize the module */
int init_module()
{
  printk("Hello, world - this is the kernel speaking\n");

  /* If we return a non zero value, it means that
   * init_module failed and the kernel module
   * can't be loaded */
  return 0;

Quote:}

/* Cleanup - undid whatever init_module did */
void cleanup_module()
{
  printk("Short is the life of a kernel module\n");
Quote:}

 
 
 

LKM compile problem

Post by John Levo » Thu, 18 Jul 2002 09:45:03



> gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c hello.c

http://kernelnewbies.org/faq/#compmod

regards
john

 
 
 

LKM compile problem

Post by Kasper Dupon » Thu, 18 Jul 2002 18:25:31




> > gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c hello.c

> http://kernelnewbies.org/faq/#compmod

Yup, what is actually missing from the above command line
is "-O2" and "-I/lib/modules/`uname -r`/build/include"

If that doesn't help we need to see the source of the
module.

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


 
 
 

1. Compiling LKM on Solaris 8

Hi all.

I need to know if there is a way to get (or to make) these objects:
memmove.o memcpy.o strstr.o in ELF-64 format to be linked with another
object file (elf 64).

I need that because I'm trying to compile a Loadable Kernel Module for
my Solaris 8 UltraSPARC-II and the module needs to be ELF-64.

I'm using gcc-3.1.

byez
darko

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

2. A Video Drama

3. problems with lkm, (modstat)

4. HP Surestore 2000 via SCSI on SCO3.2-4.2

5. LKM Newbie with some problems

6. New: using xmodmap to reverse mouse buttons, causes button 3 to behave as though 1 & 3 both pressed

7. LKM system calls.

8. [via-rhine][ANNOUNCE] 1.17rc

9. Looking for home based Linux LKM and socket based application project

10. Getting the CPU load value in a LKM...

11. LKM: Linux Emulator Q

12. Generating a simple sound (f.e. "beep") in a LKM - 2.2.12

13. chkrootkit report : LKM trojan?