LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 04-12-2004, 01:53 AM   #1
taillefer
LQ Newbie
 
Registered: Mar 2004
Distribution: RH9
Posts: 21

Rep: Reputation: 15
Compiling Kernel Modules Individually


I'm learning to write a network device driver. For this I'm trying to compile code from /usr/src/linux/drivers/net.

My query is how to compile driver code individually.. for eg. if I want to compile ethertap.c (present in the same directory) by using the gcc command, rather than using make modules. I copy the file, ethertap.c to my home directory /root & run,
Code:
gcc -c ethertap.c
but get a lot of errors.

Any help is appreciated.
 
Old 04-12-2004, 06:18 AM   #2
taillefer
LQ Newbie
 
Registered: Mar 2004
Distribution: RH9
Posts: 21

Original Poster
Rep: Reputation: 15
Thumbs up

OK, this sounds corny but got the solution myself. I just had to use the switches -D__KERNEL__ & -DMODULE. So I use -
Code:
gcc -D__KERNEL__ -DMODULE -c ethertap.c
and it works fine!
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
compiling kernel modules axr0284 Programming 2 11-26-2005 03:08 PM
Modules in Kernel Compiling SlackwareInAZ Slackware 1 07-29-2005 05:10 AM
need some help in Compiling Kernel modules bharat83 SUSE / openSUSE 1 01-07-2005 07:21 AM
Compiling Modules for 2.6.6 kernel! Bigg Mike Linux - Newbie 9 06-09-2004 09:04 PM
Compiling kernel modules? jrjarrett Linux - Software 0 09-09-2003 10:24 AM

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

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