Linux
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives Mailing Lists Linux

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old May 7th, 2008, 03:15 AM
vin2008_linux vin2008_linux is offline
Registered User
Dev Archives Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 2 vin2008_linux User rank is Just a Lowly Private (1 - 20 Reputation Level)  
Time spent in forums: 8 m 18 sec
Reputation Power: 0
Building linux kernel module/Driver in C code?

I want to compile and run below code I tried lot as

# gcc -C -W -Wall -D__KERNEL__ -DMODULE -isystem /lib/modules/2.6.23.14-115.fc8/build -v /usr/include/linux/version.h -c hello.c

# gcc -C -E -W -Wall -D__KERNEL__ -DMODULE -isystem /lib/modules/2.6.23.14-115.fc8/build -v /usr/include/linux/version.h -c hello.c

# gcc -C -E -W -Wall -D__KERNEL__ -DMODULE -isystem /lib/modules/2.6.23.14-115.fc8/build -v /usr/include/linux/version.h -c hello.c

# gcc -W -Wall -D__KERNEL__ -DMODULE -isystem /lib/modules/2.6.23.14-115.fc8/build -v /usr/include/linux/version.h -c hello.c

# gcc -W -Wall -D__KERNEL__ -DMODULE -isystem /lib/modules/2.6.23.14-115.fc8/build -v /usr/include/linux/version.h -c hello.c

Its not able to find linux/module.h whereas I have installed linux-source code and able to see same file in include/linux/module.h ?


#include <linux/module.h>
int init_module(void)
{
printk("<1>Hello, world\n");
return 0;
}
void cleanup_module(void)
{
printk("<1>Goodbye cruel world\n");
}


I tried by Creating Makefile with contents:

obj-m <tab spaces> := hello.o




===============================then fired below============

# make -C /lib/modules/`uname -r` M=/Project modules
# make -C /lib/modules/`uname -r` M=/Project modules -c hello.c
# make -C /lib/modules/`uname -r` M=/Project modules hello.c
# make -C /lib/modules/`uname -r` M=/Project modules hello.c


But all failed ...................! Need Help
Is Anybody konwing how to compile Kernel C code I have docs to will send to u guys as per ur request for reference????????

My Linux Version :
uname -r
Linux linuxguru.symantec.com 2.6.23.14-115.fc8 #1 SMP Mon Jan 21 14:20:50 EST 2008 i686 i686 i386 GNU/Linux

Reply With Quote
  #2  
Old May 14th, 2008, 01:58 AM
vin2008_linux vin2008_linux is offline
Registered User
Dev Archives Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 2 vin2008_linux User rank is Just a Lowly Private (1 - 20 Reputation Level)  
Time spent in forums: 8 m 18 sec
Reputation Power: 0
Quote:
Originally Posted by vin2008_linux
I want to compile and run below code I tried lot as

# gcc -C -W -Wall -D__KERNEL__ -DMODULE -isystem /lib/modules/2.6.23.14-115.fc8/build -v /usr/include/linux/version.h -c hello.c

# gcc -C -E -W -Wall -D__KERNEL__ -DMODULE -isystem /lib/modules/2.6.23.14-115.fc8/build -v /usr/include/linux/version.h -c hello.c

# gcc -C -E -W -Wall -D__KERNEL__ -DMODULE -isystem /lib/modules/2.6.23.14-115.fc8/build -v /usr/include/linux/version.h -c hello.c

# gcc -W -Wall -D__KERNEL__ -DMODULE -isystem /lib/modules/2.6.23.14-115.fc8/build -v /usr/include/linux/version.h -c hello.c

# gcc -W -Wall -D__KERNEL__ -DMODULE -isystem /lib/modules/2.6.23.14-115.fc8/build -v /usr/include/linux/version.h -c hello.c

Its not able to find linux/module.h whereas I have installed linux-source code and able to see same file in include/linux/module.h ?


#include <linux/module.h>
int init_module(void)
{
printk("<1>Hello, world\n");
return 0;
}
void cleanup_module(void)
{
printk("<1>Goodbye cruel world\n");
}


I tried by Creating Makefile with contents:

obj-m <tab spaces> := hello.o




===============================then fired below============

# make -C /lib/modules/`uname -r` M=/Project modules
# make -C /lib/modules/`uname -r` M=/Project modules -c hello.c
# make -C /lib/modules/`uname -r` M=/Project modules hello.c
# make -C /lib/modules/`uname -r` M=/Project modules hello.c


But all failed ...................! Need Help
Is Anybody konwing how to compile Kernel C code I have docs to will send to u guys as per ur request for reference????????

My Linux Version :
uname -r
Linux linuxguru.symantec.com 2.6.23.14-115.fc8 #1 SMP Mon Jan 21 14:20:50 EST 2008 i686 i686 i386 GNU/Linux



I got solutn

Reply With Quote
Reply

Viewing: Web Development Archives Mailing Lists Linux > Building linux kernel module/Driver in C code?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT