Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: srekrap on June 25, 2013, 07:06:43 PM

Title: Building 3rd party MODULE from source
Post by: srekrap on June 25, 2013, 07:06:43 PM
Hello -

  I'm trying to compile the xpad module - pretty simple. However there's no 'build' directory under /lib/modules/3.0.21-tinycore64.
 
  I tried fetching linux-3.0.21-patched.txz from ibiblio and it has no such build directory either.
 
  Any suggestions?

     Thanks - Sean
Title: Re: Building 3rd party MODULE from source
Post by: Juanito on June 25, 2013, 11:10:00 PM
symlink /lib/modules/3.0.21-tinycore64/build to the unpacked kernel source
Title: Re: Building 3rd party MODULE from source
Post by: srekrap on June 26, 2013, 08:56:12 AM
Juanito -

    OK - seems obvious to you guys :-)
    I did (may not have needed to) 'make oldconfig && make prepare && make', and realized the kernel in TC is newer than what xpad's expecting - So I replaced usb_buffer_alloc/free w/ usb_alloc/free_coherent, and now it compiles.

    However, when I "sudo insmod xpad.ko" I get: "insmod: can't insert 'xpad.ko': invalid module format."

    Is there some setting in the env/.config of the kernel I need to set?

    (All this is done in TC, not another dev host)

    Thanks
           Sean
Title: Re: Building 3rd party MODULE from source
Post by: Rich on June 26, 2013, 09:08:05 AM
Hi srekrap
input-joystick-3.0.21-tinycore64.tcz  has  xpad.ko
Title: Re: Building 3rd party MODULE from source
Post by: srekrap on June 26, 2013, 10:02:49 AM
Rich - OMG thank you!

Does it (or seomthing else) have the (serial) input driver too?

I see that the input-joystick extension has tons of other drivers (a3d, adi, analog, etc) - will those drivers get insmoded on boot? If I don't want those installed on boot can I simply delete the .ko.tgz files, or is there a cleaner way to restrict what gets loaded?

I'm a noob so anything that implies I'm missing the picture is obvious - please advise...

  Thanks!
Title: Re: Building 3rd party MODULE from source
Post by: Rich on June 26, 2013, 10:12:21 AM
Hi srekrap
If the kernel detects your joystick it should load the driver. Drivers only get loaded if the corresponding hardware is
detected, no need to delete anything. Modprobe is preferred over insmod.
Quote
Does it (or seomthing else) have the (serial) input driver too?
Not sure what you are referring to here, I don' have a joystick.
Title: Re: Building 3rd party MODULE from source
Post by: srekrap on June 26, 2013, 10:29:39 AM
Rich - I'm working w/ two flavors of usb device - xbox controller (xpad driver) and serial usb devices (linux input driver) - "input" allows/handles connecting serial usb devices so they can be opened like a comport (is creates /dev/ttyUSB0, etc) I don't see my device showing up, and input-joystick doesn't have what I think I should see, there's nothing in the repo like "input-serial" - only input-joystick and input-tablet.

I had to unzip the xpad.ko.gz that got "installed" and place xpad.ko in, say, /lib/modules, then edit /opt/bootload.sh to include "insmod /lib/modules/xpad.ko" - now on boot it sees I have the joystick plugged in fine. Aside from modprobe vs. insmod, does this sound like I jumped through the right hoops? Is there a more official way to do it?

    Thanks for your help
        Sean


Title: Re: Building 3rd party MODULE from source
Post by: tinypoodle on June 26, 2013, 10:47:59 AM
There's no reason to gunzip modules.
Title: Re: Building 3rd party MODULE from source
Post by: srekrap on June 26, 2013, 01:11:51 PM
@tinypoodle -

    Thanks for the reply - then how else is it supposed to happen? (because it didn't without further intervention)

    If it doesn't happen by default, where can I look to see why it didn't?

   Thanks
           Sean

Title: Re: Building 3rd party MODULE from source
Post by: Rich on June 26, 2013, 03:36:15 PM
Hi srekrap
As tinypoodle said, no reason to gunzip modules. Did you try:
Code: [Select]
modprobe xpadHere is a basic explanation of the differences:
http://nashkius.wordpress.com/2010/11/24/modprobe-vs-insmod/
Title: Re: Building 3rd party MODULE from source
Post by: Lee on June 26, 2013, 04:03:07 PM
Quote
Here is a basic explanation of the differences:
http://nashkius.wordpress.com/2010/11/24/modprobe-vs-insmod/

This looks suspiciously "muggle" - not at all what I expected.  Thanks for the link!  :)
Title: Re: Building 3rd party MODULE from source
Post by: srekrap on June 26, 2013, 04:45:43 PM
Rich/tinypoodle -

     I'm using modprobe now - are you suggesting that if I do "modprobe xpad.ko.tgz" it'll unzip it for me?
     If so then of course you all would think my unzipping was unnecessary...

     I'll leave it for another time when I really can't get a driver to build to re-answer the question... I got the stuff working finally with you-all's help... Thanks!

    Cheers,
           Sean

Title: Re: Building 3rd party MODULE from source
Post by: tinypoodle on June 26, 2013, 05:08:04 PM
Thanks for the reply - then how else is it supposed to happen? (because it didn't without further intervention)

Out of my head, it may be a matter of kernel config, not depending on userspace.
Title: Re: Building 3rd party MODULE from source
Post by: srekrap on June 26, 2013, 05:57:10 PM
tinypoodle -

   10-4 - for now I'll ignore it and have the boot as it goes - and I'll make a note of it for our own communications, but it works so I'm happy...

   Cheers
           Sean