LinuxQuestions.org
Review your favorite Linux distribution.
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 05-28-2007, 05:09 AM   #16
jaepi
Member
 
Registered: Apr 2007
Location: Urban Jungle
Distribution: Ubuntu
Posts: 189

Original Poster
Blog Entries: 1

Rep: Reputation: 30

a module i mean. it'll print hello world using the insmod command
 
Old 05-28-2007, 05:31 AM   #17
Franklin52
LQ Newbie
 
Registered: Nov 2006
Posts: 6

Rep: Reputation: 0
Try as root:

Code:
/sbin/insmod hello.ko
Regards
 
Old 05-28-2007, 07:31 AM   #18
jaepi
Member
 
Registered: Apr 2007
Location: Urban Jungle
Distribution: Ubuntu
Posts: 189

Original Poster
Blog Entries: 1

Rep: Reputation: 30
im logged as root and i get this one:

Code:
[root@localhost dev-drive]# gcc -c hello.c
[root@localhost dev-drive]# /sbin/insmod ./hello.o
insmod: error inserting './hello.o': -1 Invalid module format
 
Old 05-28-2007, 08:14 AM   #19
Franklin52
LQ Newbie
 
Registered: Nov 2006
Posts: 6

Rep: Reputation: 0
Try:

Code:
/sbin/insmod hello.ko
not:

Code:
/sbin/insmod hello.o
Kernel 2.6 introduces a new file naming convention for kernel modules. Now the extension is .ko in place of the old .o


Regards
 
Old 05-28-2007, 08:46 PM   #20
jaepi
Member
 
Registered: Apr 2007
Location: Urban Jungle
Distribution: Ubuntu
Posts: 189

Original Poster
Blog Entries: 1

Rep: Reputation: 30
i tried it and this is what i get

Code:
[root@localhost dev-drive]# gcc -c hello.c
[root@localhost dev-drive]# /sbin/insmod ./hello.ko
insmod: can't read './hello.ko': No such file or directory
 
Old 05-28-2007, 08:46 PM   #21
jaepi
Member
 
Registered: Apr 2007
Location: Urban Jungle
Distribution: Ubuntu
Posts: 189

Original Poster
Blog Entries: 1

Rep: Reputation: 30
i tried it and this is what i get

Code:
[root@localhost dev-drive]# gcc -c hello.c
[root@localhost dev-drive]# /sbin/insmod ./hello.ko
insmod: can't read './hello.ko': No such file or directory
 
Old 05-28-2007, 09:42 PM   #22
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by jaepi
Code:
[root@localhost dev-drive]# gcc -c hello.c
I don’t think you can do just this anymore (even when you could, you needed many more arguments). I think the preferred method of making a module out of your source is to use the kernel’s own build system. Execute something like this from the directory containing hello.c (and no, you shouldn’t need to be root for it to compile):
Code:
$ make -C /lib/modules/$(uname -r)/build M=$PWD obj-m=hello.o
Of course, it would be much easier to create a Makefile that does this sort of thing for you.
 
  


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
rmmod: command not found ferradura Slackware 3 12-19-2006 01:42 PM
making sys call ex:insmod,rmmod from function in user module shashishankar_h Linux - General 1 09-01-2005 12:36 AM
rmmod -f not working R0UTE Linux - Software 0 10-27-2004 09:12 AM
rmmod and cron issue? Manuel-H Linux - Software 1 10-23-2004 07:05 AM
Why can't I use lsmod rmmod etc JohnSharp Linux - Newbie 4 04-08-2004 10:11 AM

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

All times are GMT -5. The time now is 03:35 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