LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 10-21-2004, 09:13 AM   #1
eltn
LQ Newbie
 
Registered: Oct 2004
Posts: 21

Rep: Reputation: 15
compiling a module


hellow

i tried to compile a simple module

in first i printed

gcc -c hello.c
(created hello.o)

and then

insmod hello.o
(i tried also insmod -f hello.o)
but its printed me an error
hello.o: couldnt find the kernel version the module was compile for?

is anyone know a solution?
 
Old 10-21-2004, 09:37 AM   #2
sjalex
Member
 
Registered: Oct 2004
Posts: 41

Rep: Reputation: 15
uhm! That doesn't look like a kernel module... Is this a program you wrote or what?

Perhaps you should consider dropping the -c flag if you're trying to make an executable...
 
Old 10-21-2004, 10:06 AM   #3
eltn
LQ Newbie
 
Registered: Oct 2004
Posts: 21

Original Poster
Rep: Reputation: 15
its a module that i wrote
 
Old 10-22-2004, 08:08 AM   #4
sjalex
Member
 
Registered: Oct 2004
Posts: 41

Rep: Reputation: 15
ah, OK, I'm gonna go out on a limb and assume you've not done any kernel development before.

What are you trying to do with this module you wrote? I mean, what is it supposed to do?
 
Old 10-22-2004, 09:32 AM   #5
eltn
LQ Newbie
 
Registered: Oct 2004
Posts: 21

Original Poster
Rep: Reputation: 15
module

u r right i dont know mutch about the kernel development

i got a project (from the uni)

this is the project


3. The /proc file system.
(a) Add a file to /proc that will give the number of system calls executed
since the system has been booted. (2)
(b) Add a file to /proc/(pid) directory called \trace" that when read will
give a list of executed system calls by number. (2)
 
Old 04-01-2006, 07:30 PM   #6
Ojp
LQ Newbie
 
Registered: Mar 2006
Location: Mexico
Distribution: Red Hat EL 4
Posts: 12

Rep: Reputation: 0
I give you a little code, you need to create a Makefile like this (more info in Documentation/Kbuild/Meakefiles.txt):

obj-m := main.o
sadoo-objs := main.o


When you compile your module, do this:

$make -C (the path of your kernel source) M=$PWD modules


The path of kernel soure must be the same path of the kernel that you use in your system, don't work at all if you use a source that you downloaded. In my case I use the path like this (I have RHEL 4): /usr/src/kernels/2.6.9-5.EL-i686
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
prroblem while compiling module mas00d Programming 1 02-22-2005 04:05 PM
compiling orinoco module BashTin Linux - Wireless Networking 0 02-02-2005 03:29 AM
compiling a module with gcc mathman0 Linux - Software 5 11-07-2004 03:13 PM
compiling new wireless module kscott121 Debian 1 03-21-2004 06:05 PM
Kernel compiling and module compiling tarballed Linux - General 1 12-22-2002 05:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:09 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration