Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    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

  2. #2
    Linux 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.

  3. #3
    Linux 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:

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

    Code:
    #include <module.h>

  4. $spacer_open
    $spacer_close
  5. #4
    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

  6. #5
    Just Joined!
    Join Date
    Jun 2007
    Posts
    34
    Anyone ???

  7. #6
    Linux User
    Join Date
    Jun 2007
    Posts
    458
    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.

  8. #7
    Linux User
    Join Date
    Jun 2007
    Posts
    458
    How long did it take you to compile your kernel?

  9. #8
    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:((

  10. #9
    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

  11. #10
    Just Joined!
    Join Date
    Jun 2007
    Posts
    34
    Anyone please??

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •