Bug 20905

Summary: Compiler warning/insmod error using RedHat 7.0
Product: [Retired] Red Hat Linux Reporter: Richard A. Pries <priesrx>
Component: modutilsAssignee: Michael K. Johnson <johnsonm>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-11-22 23:15:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
kgcc compiler warning/insmod don't recognize kernel version none

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.