Bug 20905 - Compiler warning/insmod error using RedHat 7.0
Compiler warning/insmod error using RedHat 7.0
Product: Red Hat Linux
Classification: Retired
Component: modutils (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Michael K. Johnson
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2000-11-15 09:46 EST by Richard A. Pries
Modified: 2007-04-18 12:29 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-11-22 18:15:25 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
kgcc compiler warning/insmod don't recognize kernel version (321 bytes, text/plain)
2000-11-15 14:28 EST, Richard A. Pries
no flags Details

  None (edit)
Description Richard A. Pries 2000-11-15 09:46:02 EST
Given the following module (like that for hello.c in Rubini's book) 

#define MODULE
#include <linux/module.h>

int init_module(void) 
   printk("<1>Hello from the Kernel world!");
   return 0;}

void cleanup_module (void) {
   printk ("<1>Goodbye.\n");

Trying to compile/install it in RedHat 7.0 gives the following errors:

$ kgcc -c hello.c

/tmp/ccWSbrbm.s: Assembler messages:
/tmp/ccWSbrbm.s:9: Warning: Ignoring changed section attributes for 

# insmod hello.o

 hello.o: kernel-module version mismatch
        hello.o was compiled for kernel version 2.4.0-0.26
        while this kernel is version 2.2.16-22.

These commands worked fine using RedHat 6.2.  Also, I get similar compiler 
warnings when doing a "make modules" when rebuilding the 2.2.16-22 kernel.

Any assistance provided will be much appreciated.
Comment 1 Bill Nottingham 2000-11-15 11:37:31 EST
You're using

a) the wrong compiler.

   To build 2.2 kernel modules, use kgcc, not gcc.

b) the wrong include path

   You need to use -I/usr/src/linux-2.2.16/include/linux, not -I/usr/include/linux

The headers in /usr/include/linux are for glibc and userland use, not
kernel module use.

Comment 2 Richard A. Pries 2000-11-15 13:47:35 EST
Thanks for the answer, but I still get the same warning and error as shown by 
the attached.  Please note that I already was using kgcc, not gcc.  
Comment 3 Richard A. Pries 2000-11-15 14:28:40 EST
Created attachment 5400 [details]
kgcc compiler warning/insmod don't recognize kernel version
Comment 4 Matt Wilson 2000-11-22 18:14:59 EST
Use -I/usr/src/linux-2.2.16/include not -I/usr/src/linux-2.2.16/include/linux
Comment 5 Matt Wilson 2000-11-22 18:15:22 EST
let me know if that works
Comment 6 Richard A. Pries 2000-11-24 10:53:29 EST
Thank you very much.  Using -I/usr/src/linux-2.2.16/include not -
I/usr/src/linux-2.2.16/include/linux works.  However, I still get the warning 
message: Ignoring changed section attributes for .modinfo. 

Note You need to log in before you can comment on or make changes to this bug.