Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux HostsFree MagazinesJobs
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > The Linux Kernel
Reload this Page Errors compiling hello world module...please help
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

The Linux Kernel Compiling, theory, programming or other discussion about the linux kernel

Reply
 
Thread Tools Display Modes
Old 12-25-2007   #1 (permalink)
Just Joined!
 
Join Date: Jun 2007
Posts: 34
Errors compiling hello world module...please help

Hi All,

I have installed Xubuntu 7.04, i guess. It has 2.6.20.16 kernel. Then I got 2.6.22.1 kernel source code and compiled it( after lots of issues though). It compiled and I am able to boot into it as well. Now , my next venture is to compile the simple Hello World sample from "Linux Device Drivers" by Jonathan Corbett et. all.

When I compile the helloworld.c, I am getting the following errors:

-desktop:~/mysamples/sample1$ make
gcc -D__KERNEL__ -I~/linux-2.6.22.1/include -c helloworld.c -o hello.o
In file included from ~/linux-2.6.22.1/include/asm/thread_info.h:16,
from ~/linux-2.6.22.1/include/linux/thread_info.h:21,
from ~/linux-2.6.22.1/include/linux/preempt.h:9,
from ~/linux-2.6.22.1/include/linux/spinlock.h:49,
from ~/linux-2.6.22.1/include/linux/module.h:9,
from helloworld.c:2:
~/linux-2.6.22.1/include/asm/processor.h:83: error: ‘CONFIG_X86_L1_CACHE_SHIFT’ undeclared here (not in a function)
~/linux-2.6.22.1/include/asm/processor.h:83: error: requested alignment is not a constant
In file included from ~/linux-2.6.22.1/include/linux/module.h:21,
from helloworld.c:2:
~/linux-2.6.22.1/include/asm/module.h:64:2: error: #error unknown processor family
make: *** [hello.o] Error 1

I googled aa lot on this and got some kind of insight into it. Most posts suggested that it's some kind of mismatch of header files. I tried different things none of them seems to work...it's like shooting in the dark.
Can someone please point me in the right direction?

Thanks in advance,
rabantu
rabantu is offline   Reply With Quote
Old 12-25-2007   #2 (permalink)
Linux User
 
usamamuneeb's Avatar
 
Join Date: Jun 2007
Location: Karachi, PAKISTAN
Posts: 412
Send a message via MSN to usamamuneeb
It would be ideal if you could paste a link from where you want to compile the Device Drivers. I can't figure out what Hello World has to do with Linux Device Drivers. Also attach the module.h along with the other post. There's a bug in the code.
__________________
"Who says nothing is impossible? I have been doing nothing for years!"
usamamuneeb is offline   Reply With Quote
Old 12-25-2007   #3 (permalink)
Linux User
 
usamamuneeb's Avatar
 
Join Date: Jun 2007
Location: Karachi, PAKISTAN
Posts: 412
Send a message via MSN to usamamuneeb
And listen there's one more important point. If its a C Program and module.h is in the same directory as the C file, not in your OS's default includes, then you should define the module.h header the following way in each files:

Code:
#include "module.h"
and not like this:

Code:
#include <module.h>
__________________
"Who says nothing is impossible? I have been doing nothing for years!"
usamamuneeb is offline   Reply With Quote
Old 12-25-2007   #4 (permalink)
Just Joined!
 
Join Date: Jun 2007
Posts: 34
here is the link...

Quote:
Originally Posted by usamamuneeb View Post
It would be ideal if you could paste a link from where you want to compile the Device Drivers. I can't figure out what Hello World has to do with Linux Device Drivers. Also attach the module.h along with the other post. There's a bug in the code.
Thanks for the quick reply. Here is the link for the "hello world" module
http://lwn.net/images/pdf/LDD3/ch02.pdf
rabantu is offline   Reply With Quote
Old 12-25-2007   #5 (permalink)
Just Joined!
 
Join Date: Jun 2007
Posts: 34
Anyone ???
rabantu is offline   Reply With Quote
Old 12-25-2007   #6 (permalink)
Linux User
 
usamamuneeb's Avatar
 
Join Date: Jun 2007
Location: Karachi, PAKISTAN
Posts: 412
Send a message via MSN to usamamuneeb
Quote:
Anyone ???
Sure.

Install the libmodule* packages if you haven't already. If you were the impatient reader, go through the "Setting Up Your Test System" section first. Also, thanks for introducing me this page. I am learning C language from a book right now. So it might help later.
__________________
"Who says nothing is impossible? I have been doing nothing for years!"
usamamuneeb is offline   Reply With Quote
Old 12-25-2007   #7 (permalink)
Linux User
 
usamamuneeb's Avatar
 
Join Date: Jun 2007
Location: Karachi, PAKISTAN
Posts: 412
Send a message via MSN to usamamuneeb
How long did it take you to compile your kernel?
__________________
"Who says nothing is impossible? I have been doing nothing for years!"
usamamuneeb is offline   Reply With Quote
Old 12-25-2007   #8 (permalink)
Just Joined!
 
Join Date: Jun 2007
Posts: 34
it took me a while to compile the kernel..

Quote:
Originally Posted by usamamuneeb View Post
How long did it take you to compile your kernel?
Hi,

I did go through that section and followed.
I compiled my kernel sometime back in august or so. Then I got buys with my work. Now I started over with this as I am in vacation.

I had lots of issues with my kernel compilation. Mostly the config part. However, with lots of help from the users of this website, I completed my kernel compilation.
Now I am stuck here:((
rabantu is offline   Reply With Quote
Old 12-25-2007   #9 (permalink)
Just Joined!
 
Join Date: Jun 2007
Posts: 34
Errors compiling hello world module...please help

Hi All,

I have installed Xubuntu 7.04, i guess. It has 2.6.20.16 kernel. Then I got 2.6.22.1 kernel source code and compiled it( after lots of issues though). It compiled and I am able to boot into it as well. Now , my next venture is to compile the simple Hello World sample from "Linux Device Drivers" by Jonathan Corbett et. all.

When I compile the helloworld.c, I am getting the following errors:

-desktop:~/mysamples/sample1$ make
gcc -D__KERNEL__ -I~/linux-2.6.22.1/include -c helloworld.c -o hello.o
In file included from ~/linux-2.6.22.1/include/asm/thread_info.h:16,
from ~/linux-2.6.22.1/include/linux/thread_info.h:21,
from ~/linux-2.6.22.1/include/linux/preempt.h:9,
from ~/linux-2.6.22.1/include/linux/spinlock.h:49,
from ~/linux-2.6.22.1/include/linux/module.h:9,
from helloworld.c:2:
~/linux-2.6.22.1/include/asm/processor.h:83: error: ‘CONFIG_X86_L1_CACHE_SHIFT’ undeclared here (not in a function)
~/linux-2.6.22.1/include/asm/processor.h:83: error: requested alignment is not a constant
In file included from ~/linux-2.6.22.1/include/linux/module.h:21,
from helloworld.c:2:
~/linux-2.6.22.1/include/asm/module.h:64:2: error: #error unknown processor family
make: *** [hello.o] Error 1

I googled aa lot on this and got some kind of insight into it. Most posts suggested that it's some kind of mismatch of header files. I tried different things none of them seems to work...it's like shooting in the dark.
Can someone please point me in the right direction?

Thanks in advance,
rabantu
rabantu is offline   Reply With Quote
Old 12-27-2007   #10 (permalink)
Just Joined!
 
Join Date: Jun 2007
Posts: 34
Anyone please??
rabantu is offline   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
 

Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen Resolution stuck at 640x480 geo Gentoo Linux Help 17 11-24-2006 09:51 PM
Help installing soundcard and ethernet card on suse 10.0 TaTonkax SuSE Linux Help 56 11-13-2005 08:59 PM
A logical quandry with SuSE and the x-server gypsy Linux Newbie 5 07-31-2005 02:28 PM
Problem With Geforce 5700 Le Install twirl Redhat / Fedora Linux Help 0 07-19-2005 02:31 AM
Mouse Wheel adamhoward_4 Slackware Linux Help 27 11-20-2004 09:23 PM

Free Magazines
Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe
Systems Management News, the newspaper for IT systems administration and data center managers!
Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe
The Enterprise Newsweekly
eWeek is the essential technology information source for builders of e-business.
subscribe
Oracle Magazine
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe
Total Telecom
Total Telecom is "The Economist of the communications industry".
subscribe
More free magazines »



All times are GMT. The time now is 06:46 PM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.2.0