How to convert a static driver to a loadable module in linux kernel?
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Obviously, from a software-design perspective, there are. Your driver must "understand" that it is designed to be dynamically loadable, and it must do all the right things to be certain that Linux I/O activity occurs properly ... when the driver isn't loaded, when it's being loaded/unloaded, when it is loaded. If your driver does not have that "additional intelligence," it can't survive as a loadable module.
Far more informative than anything I could whip up here ... would be an actual search of the source-code of your own system. Device drivers can be loaded at several different points in the lifetime of a Linux system, and, in particularly in the case of a USB-connected device, they can be dynamically unloaded again. I am not "dodging" your question when I say quite frankly that the very best way that you can answer any of these questions, and many more, is to: "Use the Source, Luke!"
You can, and should, also skim the various HOWTOs that you will find concerning this subject. The operative word here, in my mind, is "skim." If you don't quickly perfect the skill of "skimming," you will first-hand experience what has been aptly called a "Sip from the Firehose."
No source of information about software on this planet beats the careful inspection of existing software that actually works, hence my very-pointed reference to that particular source. Look at it, and pay attention to whatever existing module out there might be closest to whatever-it-is that you now want to do. There is zero reason to start from scratch. Actum Ne Agas: Do Not Do A Thing Already Done. One thing that you will find in a great many existing drivers is the cordial acknowledgment of "prior work" from which the driver was "cabbaged." If you are starting your work from a blank editor screen, then you are most likely starting your work in the wrong place.
Last edited by sundialsvcs; 05-09-2012 at 02:01 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.