Results 1 to 10 of 12
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 ...
- 12-25-2007 #1Just 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
- 12-25-2007 #2Linux User
- Join Date
- Jun 2007
- Posts
- 458
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.
"When you have nothing to say, say nothing."
- 12-25-2007 #3Linux User
- Join Date
- Jun 2007
- Posts
- 458
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:
and not like this:Code:#include "module.h"
Code:#include <module.h>
"When you have nothing to say, say nothing."
- 12-25-2007 #4Just Joined!
- Join Date
- Jun 2007
- Posts
- 34
here is the link...
Thanks for the quick reply. Here is the link for the "hello world" module
http://lwn.net/images/pdf/LDD3/ch02.pdf
- 12-25-2007 #5Just Joined!
- Join Date
- Jun 2007
- Posts
- 34
Anyone ???
- 12-25-2007 #6Linux User
- Join Date
- Jun 2007
- Posts
- 458
Sure.Anyone ???
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."When you have nothing to say, say nothing."
- 12-25-2007 #7Linux User
- Join Date
- Jun 2007
- Posts
- 458
How long did it take you to compile your kernel?
"When you have nothing to say, say nothing."
- 12-25-2007 #8Just Joined!
- Join Date
- Jun 2007
- Posts
- 34
it took me a while to compile the 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:
((
- 12-25-2007 #9Just 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
- 12-27-2007 #10Just Joined!
- Join Date
- Jun 2007
- Posts
- 34
Anyone please??


Reply With Quote

