Bug 20905 - Compiler warning/insmod error using RedHat 7.0
Summary: Compiler warning/insmod error using RedHat 7.0
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: modutils
Version: 7.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Michael K. Johnson
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-11-15 14:46 UTC by Richard A. Pries
Modified: 2007-04-18 16:29 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-11-22 23:15:25 UTC
Embargoed:


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

Description Richard A. Pries 2000-11-15 14:46:02 UTC
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 
    .modinfo

# 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 16:37:31 UTC
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 18:47:35 UTC
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 19:28:40 UTC
Created attachment 5400 [details]
kgcc compiler warning/insmod don't recognize kernel version

Comment 4 Matt Wilson 2000-11-22 23:14:59 UTC
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 23:15:22 UTC
let me know if that works

Comment 6 Richard A. Pries 2000-11-24 15:53:29 UTC
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.