WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Building 3rd party MODULE from source  (Read 3593 times)

Offline srekrap

  • Newbie
  • *
  • Posts: 20
Building 3rd party MODULE from source
« 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

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
Re: Building 3rd party MODULE from source
« Reply #1 on: June 25, 2013, 11:10:00 PM »
symlink /lib/modules/3.0.21-tinycore64/build to the unpacked kernel source

Offline srekrap

  • Newbie
  • *
  • Posts: 20
Re: Building 3rd party MODULE from source
« Reply #2 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

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11634
Re: Building 3rd party MODULE from source
« Reply #3 on: June 26, 2013, 09:08:05 AM »
Hi srekrap
input-joystick-3.0.21-tinycore64.tcz  has  xpad.ko

Offline srekrap

  • Newbie
  • *
  • Posts: 20
Re: Building 3rd party MODULE from source
« Reply #4 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!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11634
Re: Building 3rd party MODULE from source
« Reply #5 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.

Offline srekrap

  • Newbie
  • *
  • Posts: 20
Re: Building 3rd party MODULE from source
« Reply #6 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



Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Building 3rd party MODULE from source
« Reply #7 on: June 26, 2013, 10:47:59 AM »
There's no reason to gunzip modules.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline srekrap

  • Newbie
  • *
  • Posts: 20
Re: Building 3rd party MODULE from source
« Reply #8 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


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11634
Re: Building 3rd party MODULE from source
« Reply #9 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/

Offline Lee

  • Hero Member
  • *****
  • Posts: 645
    • My Core wiki user page
Re: Building 3rd party MODULE from source
« Reply #10 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!  :)
32 bit core4.7.7, Xprogs, Xorg-7.6, wbar, jwm  |  - Testing -
PPR, data persistence through filetool.sh          |  32 bit core 8.0 alpha 1
USB Flash drive, one partition, ext2, grub4dos  | Otherwise similar

Offline srekrap

  • Newbie
  • *
  • Posts: 20
Re: Building 3rd party MODULE from source
« Reply #11 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


Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Building 3rd party MODULE from source
« Reply #12 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.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline srekrap

  • Newbie
  • *
  • Posts: 20
Re: Building 3rd party MODULE from source
« Reply #13 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