Find the answer to your Linux question:
Results 1 to 8 of 8
Hi, im learning to make my first module! First of all avoid answers like "read this huge book that weights 20 pounds" or "learn the basics first" or "you need ...
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Posts
    16

    The kernel source-code-tree problem...

    Hi, im learning to make my first module!
    First of all avoid answers like "read this huge book that weights 20 pounds" or "learn the basics first" or "you need to install alot more than what you need". Because that's the type of answers i've been getting in places where people are suppose to help.

    Note: I know about the book linux dev driv 3rd edition, and it has the same problem as the tutorial im following: doesnt explain nothing to newbies...

    Now my situation:
    Im following this tutorial: tinyurl.com/324vf3d
    My point is to learn exactly what it teaches, play with a paralel port (yes i know for you there are thousands of funnier and "simpler" ways to do this, but i want this one).

    But now im stuck on page 2, where the author says:
    Since the release of kernel version 2.6.x, compiling modules has become slightly more complicated. First, you need to have a complete, compiled kernel source-code-tree. If you have a Debian Sarge system, you can follow the steps in Appendix B (towards the end of this article). In the following, I’ll assume that a kernel version 2.6.8 is being used.
    He doesnt tell how do i do that.
    So i went to kernel.org, downloaded the one thats similar to me (my ubuntu has 2.6.31-19-generic so i downloaded the 2.6.31 version of the kernel).

    Then i extracted it, and did make config, pressed ENTER key all the way down choosing default options, then i did make and waited all night.

    Now i was hoping to make this work (little i knew that this hell was just beginning).
    So i inputed the following line like the authour tells:
    $ make -C ../Desktop/kernel-source-2.6.31 M=pwd modules

    But he gives me errors like /Desktop/kernel-source-2.6.31/pwd/modules not found or something like that.

    Yes, i dont know how to mess with the kernel, no i dont want to become a linux hacker, yes just wanna make the damn module compiling right...

    Please, tell me what to do *just to this situation* step by step very, but very slowly to compile this stuff. Please take a look at the page 2 of that tutorial to understand what i need to do.

    Thank you all that will really help, and no thanks for those that will link to books, blame me because i dont understand such a simple task, tell me that i need to learn 343721892 things just to do that or ask me to install interminable stuff just to do that step... etc.


    A little about why i want to learn this:
    I learned about operating systems in college, but on the theorical part, so i know alots of theory about this stuff, but im a zero when it comes to really use this things, so, i would like to learn this cool part that is, connecting the computer to the "outside world" trought the paralelport in this case.
    I think that after i learn this, even knowing that it can be a bit hard, like it is being right now, it will help me to improve more my skills using linux.
    Ps. Yes, i know there are alot of other things that i can learn, but now, im on with this one, no changing mind here.



    EDIT:
    Its easier to show a picture of the problem:

    [IMG]gyazo.com/ce00a13d22a62fb7d8a5a3859fb7c652.png[/IMG]

    The yellow underlined line on the terminal says "File or directory not found!"
    The next line are the normal makefile errors:
    "make[1]: No rule for target ' ... '
    /Makefile . Stop."

    Inside the folder linux-2.6.31.14 its the compiled kernel i wanna use in that tutorial (the author uses 2.6..
    Inside the folder modules are 2 files as you can see in the terminal, i'll cat the files here:

    Makefile:
    PHP Code:
    obj-mnothing.
    nothing.c:
    PHP Code:
    #include <linux/module.h>

    MODULE_LICENSE("GPL"); 
    As you see, its just the code the author asks us to use in those files for the first example.

  2. #2
    Super Moderator MikeTbob's Avatar
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    7,145
    Hello and Welcome.
    I am not sure but I thik you are giving the command in the wrong directory. When you follow a tutorial, you need to substitute the examples with your own paths. So when they tell you to issue this command.
    $ make -C ../Desktop/kernel-source-2.6.31 M=pwd modules
    If you kernel source is not at ../Desktop/ the command will fail.

    EDIT:You probably want the kernel source from your Ubuntu Repos anyway and not the Vanilla kernels from kernel.org
    Last edited by MikeTbob; 12-18-2010 at 10:06 PM. Reason: See EDIT:
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

  3. #3
    Just Joined!
    Join Date
    Dec 2010
    Posts
    16
    Quote Originally Posted by MikeTbob View Post
    Hello and Welcome.
    I am not sure but I thik you are giving the command in the wrong directory. When you follow a tutorial, you need to substitute the examples with your own paths. So when they tell you to issue this command.

    If you kernel source is not at ../Desktop/ the command will fail.

    EDIT:You probably want the kernel source from your Ubuntu Repos anyway and not the Vanilla kernels from kernel.org
    Please check the IMG i posted above (unfortunatly you have to view the link because i cannot post links yet...15 posts limit).
    If you see the error message, you'll see that what you describe is not the case.

    He somehow is searching the path ../Desktop/kernel-source-2.6.31/pwd/modules.


    Link to the picture: gyazo.com/ce00a13d22a62fb7d8a5a3859fb7c652.png
    (can you take this 15 post limit?)

  4. #4
    Super Moderator MikeTbob's Avatar
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    7,145
    Okay.
    Which kernel are you running right now? I think your running kernel must must the module you are trying to build. That's why I think you need to install the Ubuntu source instead of the vanilla kernel.
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

  5. #5
    Just Joined!
    Join Date
    Dec 2010
    Posts
    16
    Quote Originally Posted by MikeTbob View Post
    Okay.
    Which kernel are you running right now? I think your running kernel must must the module you are trying to build. That's why I think you need to install the Ubuntu source instead of the vanilla kernel.
    Its the same version of that vanila one. Does the fact being vanila makes a huge difference in a module compilation?
    Is the error im getting related to that? Looks like that is the Make command that's failing to make the correct path.

  6. #6
    Super Moderator MikeTbob's Avatar
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    7,145
    Quote Originally Posted by MakiMaki View Post
    Its the same version of that vanila one. Does the fact being vanila makes a huge difference in a module compilation?
    Is the error im getting related to that? Looks like that is the Make command that's failing to make the correct path.
    Yes, it's the same version but Ubuntu adds/modifies patches and other things that may or may not be the same in the vanilla kernels. I'm not sure if it makes a difference or not but being a new to Linux person you should make it easiest on yourself and use the repos to get what you need for Ubuntu.
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

  7. #7
    Just Joined!
    Join Date
    Dec 2010
    Posts
    16
    Ok, now my error is another, forget the posts before this one.


    ------------------------------



    i'm compiling a module, but instead of geting the nothing.ko i was expecting, i get 2 files Module.symver and modules.order, both empty.

    This is my input:


    This is what i get:



    My Makefile is this:
    PHP Code:
    obj-:= nothing.
    My nothing.c is this:
    PHP Code:
    #include <linux/module.h>

    MODULE_LICENSE("GPL"); 
    What am i doing wrong?

    (I also tried this '/lib/modules/2.6.32-26-generic/build' has a candidate kernel)

  8. #8
    Linux User twoHats's Avatar
    Join Date
    Jan 2005
    Location
    NH, USA
    Posts
    276
    What am i doing wrong?
    The first thing is that you are treating MikeTbob like your lackey! The very next post you do should start with "Thank you MikeTbob..."

    The second thing is that your are coming in as a newby making demands about what you don't want to hear. Since you are asking advice, you may want to let the experts lead you through the shoals.

    Not trying to put you down - not many watching this post anyway, but just treat folks with a little respect. Sometimes complex problems are not resolved on the first few posts.

    MikeTbob - Wow - I knew you had patience, but....
    - Clouds don't crash - Bertrand Meyer

    registered Linux user 393557

    finally - hw to brag about - but next year it will look pitifully quaint:
    Athlon64 X2 3800 - 1G PC3200 - 250G SATA - ati radeon x300
    circa 2006

Posting Permissions

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