LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 07-28-2003, 11:23 AM   #1
glo
LQ Newbie
 
Registered: Jul 2003
Posts: 8

Rep: Reputation: 0
newbie compiling and versions question


Hi All,

I just cut and paste a very simple module program (using C).

#ifndef __KERNEL__
# define __KEREL__
#endif
#ifndef MODULE
# define MODULE
#endif
#ifndef __NO_VERSION__
# define __NO_VERSION__
#endif

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>

static char __initdata hellomessage[] = "hello world";
static char __exitdata bymessage[] = "good bye";

static int __init start_hello_world(void)
{
printk(hellomessage);
}

static void __exit go_awa(void)
{
printk(byemessage);
}

module_init(start_hello_world);
moudle_exit(go_away);

When i compile it, i get this mesage.

example.o was compiled for kernel version 2.4.20 while this kernel is version 2.4.20-8.

I've been surfing the net for answers and i'm getting the impression that i will have to re-compile my kernel and modify the make file to take away version (ie. change 2.4.20-8 to 2.4.20).

Is this the only way? I am really stumped with this.

Thanks.
 
Old 07-28-2003, 11:32 AM   #2
glo
LQ Newbie
 
Registered: Jul 2003
Posts: 8

Original Poster
Rep: Reputation: 0
sorry. afer reading my email i made mistake.

Compiling is ok. Its just when i run this comamnd: /sbin/insmod , i get this error message.

example.o was compiled for kernel version 2.4.20 while this kernel is version 2.4.20-8.
 
Old 07-29-2003, 05:27 AM   #3
DIYLinux
Member
 
Registered: Jul 2003
Location: NL
Distribution: My own
Posts: 92

Rep: Reputation: 17
The version string encoded in one of the linux headerfiles doesnt match the kernel version. I think its in /usr/include/linux/version.h, but dont have linux kernel; src at hand. Run grep on it looking for 'version' and 'VERSION'. If you find a macro definition for the function, you can just pass the -Dmacroname=value to gcc, otherwise edit the header itself.

For module compile info, get Rubini's book Linux Device Drivers, chapters 1&2 (I believe) (visit O Reilly site for free sample), or get the Linux Kernel Module Programmers Guide (LKMPG, free though a bit dated, www.tldp.org)
 
Old 07-30-2003, 10:54 AM   #4
glo
LQ Newbie
 
Registered: Jul 2003
Posts: 8

Original Poster
Rep: Reputation: 0
awsome, thanks!

in the version.h file i changed the UTS_RELEASE macro and that seem to work.

thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kind of a newbie question On PHP compiling. Junior41180 Linux - Software 2 02-10-2005 09:01 PM
Package Dependencies on Old Versions (Newbie: Help Please!) bradleymorgan Linux - Software 2 04-02-2004 02:15 PM
Linux Newbie--- Identify versions pradsy90 Linux - General 2 03-31-2004 10:45 PM
newbie c++ compiling class question true_atlantis Programming 4 02-20-2004 08:34 PM
some question asked by a newbie compiling KDE3.2 tony yu Mandriva 2 02-15-2004 08:43 PM


All times are GMT -5. The time now is 02:38 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration