element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Experts, Learning and Guidance
  • Technologies
  • More
Experts, Learning and Guidance
Ask an Expert Forum Calling embedded Linux kernel experts - how do you build a loadable kernel module from the Linux kernel driver repo
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Experts, Learning and Guidance to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 9 replies
  • Subscribers 287 subscribers
  • Views 2137 views
  • Users 0 members are here
  • linux
Related
See a helpful answer?

Be sure to click 'more' and select 'suggest as answer'!

If you're the thread creator, be sure to click 'more' then 'Verify as Answer'!

Calling embedded Linux kernel experts - how do you build a loadable kernel module from the Linux kernel driver repo

BigG
BigG over 2 years ago

I seem to be going around in circles here, to what is probably very straight forward.

This issue is probably not that common with Raspberry Pi's as I've noticed on Raspbian that most optional Linux kernel drivers are included by default.

So what I'm seeing is the following.

First we have the official repo for Linux and as you can see there is a stack of drivers available: https://github.com/torvalds/linux/tree/master/drivers

In fact what I am after is already here.

I'll start with a straightforward example, of what I am talking about.

So, let's take a CAN bus module such as the MCP2510. You can find this driver here: https://github.com/torvalds/linux/tree/master/drivers/net/can/spi/mcp251xfd

But this SPI module is not always included by default on your Single Board Computer.

So, the question I have is what is the simplest way to make a loadable linux kernel module (i.e. a .ko file) for this module.

I'm assuming there has to be well proven method of doing this. Please note that I wish to do so without having to recompile the whole kernel.

I know for starters I need to get the Linux kernel headers for my distro.

I've at least done that.

Any tips greatly appreciated.

  • Sign in to reply
  • Cancel

Top Replies

  • obones
    obones over 2 years ago +3
    Well, the documentation says this: https://tldp.org/LDP/lkmpg/2.6/html/x181.html And then there's the Kernel Newbies community that would be of great help here I believe: https://kernelnewbies.org…
  • Jan Cumps
    Jan Cumps over 2 years ago +2
    The AVNET IIOT Gateway Linux includes the MCP251x drivers. I don't know yet how they add it, but their Linux bespoke part is on github: https://github.com/Avnet/smartedge-iiot-gateway
  • shabaz
    shabaz over 2 years ago +2
    Hi Colin, I wouldn't normally recommend such an outdated tech book, but it's surprisingly just £3.60 on Amazon currently: It is extremely outdated, but (hopefully) some of it still relevant, although…
Parents
  • obones
    0 obones over 2 years ago

    Well, the documentation says this:
    https://tldp.org/LDP/lkmpg/2.6/html/x181.html

    And then there's the Kernel Newbies community that would be of great help here I believe: https://kernelnewbies.org/

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • BigG
    0 BigG over 2 years ago in reply to obones

    Ha. I knew there were real experts here... Two excellent links. Thanks.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • BigG
    0 BigG over 2 years ago in reply to BigG

    Adding one to the list from the tldp.org website, which I found interesting: https://tldp.org/LDP/lkmpg/2.6/html/x380.html

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • BigG
    0 BigG over 2 years ago in reply to BigG

    Adding one to the list from the tldp.org website, which I found interesting: https://tldp.org/LDP/lkmpg/2.6/html/x380.html

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube