Skip to contentSkip to conversation

Insmod problems

DISCUSSION Michael Zhu 3 participants 3 messages Dec 4, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

I've define these two when I compile the module. The command line is:

gcc -D_KERNEL_ -DMODULE -c hello.c

Quoted 48 lines · --- Tyler BIRD

You need to define the __KERNEL__ and MODULE symbols

#define __KERNEL__
#define MODULE

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Nav Mundi <[email protected]> 12/04/01 09:33AM

What are we doing wrong? - Nav & Michael
**************************************************

hello.c Source:

#include "/home/mzhu/linux/include/linux/config.h" /*retrieve the CONFIG_* macros */
#if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
#define MODVERSIONS /* force it on */ #endif

#ifdef MODVERSIONS
#include
"/home/mzhu/linux/include/linux/modversions.h"
#endif

#include "/home/mzhu/linux/include/linux/module.h"

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

Output:

#>gcc -D_KERNEL_ -DMODULE -c hello.c

[This builds the hello.o file. ]

#>insmod hello.o

hello.o : unresolved symbol printk
hello.o : Note: modules without a GPL compatible
license cannot use
GPONLY_symbols

Quoted 8 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

______________________________________________________
Send your holiday cheer with http://greetings.yahoo.ca

#2 lore raw

_KERNEL_ != __KERNEL__

gcc -D__KERNEL__ -DMODULE -c hello.c

Quoted 69 lines

gcc -D_KERNEL_ -DMODULE -c hello.c

Quoted 48 lines · --- Tyler BIRD

You need to define the __KERNEL__ and MODULE symbols

#define __KERNEL__
#define MODULE

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Nav Mundi <[email protected]> 12/04/01 09:33AM

What are we doing wrong? - Nav & Michael
**************************************************

hello.c Source:

#include "/home/mzhu/linux/include/linux/config.h" /*retrieve the CONFIG_* macros */
#if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
#define MODVERSIONS /* force it on */ #endif

#ifdef MODVERSIONS
#include
"/home/mzhu/linux/include/linux/modversions.h"
#endif

#include "/home/mzhu/linux/include/linux/module.h"

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

Output:

#>gcc -D_KERNEL_ -DMODULE -c hello.c

[This builds the hello.o file. ]

#>insmod hello.o

hello.o : unresolved symbol printk
hello.o : Note: modules without a GPL compatible
license cannot use
GPONLY_symbols

Quoted 8 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

______________________________________________________
Send your holiday cheer with http://greetings.yahoo.ca
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
In reply to Michael Zhu

On Tue, 4 Dec 2001, Michael Zhu wrote:

| I've define these two when I compile the module. The
| command line is:
|
| gcc -D_KERNEL_ -DMODULE -c hello.c

Check the spelling of "__KERNEL__".

~Randy

| --- Tyler BIRD <[email protected]> wrote:
| > You need to define the __KERNEL__ and MODULE symbols
| >
| > #define __KERNEL__
| > #define MODULE
| >
| >
| > >>> Nav Mundi <[email protected]> 12/04/01 09:33AM
| > >>>
| > What are we doing wrong? - Nav & Michael
| > **************************************************
| >
| > hello.c Source:
| >
| > #include "/home/mzhu/linux/include/linux/config.h"
| > /*retrieve the CONFIG_* macros */
| > #if defined(CONFIG_MODVERSIONS) &&
| > !defined(MODVERSIONS)
| > #define MODVERSIONS  /* force it on */
| > #endif
| >
| > #ifdef MODVERSIONS
| > #include
| > "/home/mzhu/linux/include/linux/modversions.h"
| > #endif
| >
| > #include "/home/mzhu/linux/include/linux/module.h"
| >
| > int init_module(void)  { printk("<1>Hello,
| > world\n");  return 0; }
| > void cleanup_module(void) { printk("<1>Goodbye cruel
| > world\n"); }
| >
| > Output:
| >
| > #>gcc -D_KERNEL_ -DMODULE -c hello.c
| >
| > [This builds the hello.o file. ]
| >
| > #>insmod hello.o
| >
| > hello.o : unresolved symbol printk
| > hello.o : Note: modules without a GPL compatible
| > license cannot use
| > GPONLY_symbols