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.
You want to look into 'linux kernel module programming', which is a nontrivial task for actual hardware drivers. This howto from The Linux Documentation Project explains it.
If you want to write some small and easy drivers, it would be easier to write a kernel from scratch, using James Molloy's Kernel Development Tutorial.
If you install the kernel source packages for your distro, you'll find the source-code for literally hundreds of device drivers. If one of these is not exactly what you need, it will be "damm close." And so, that is the proper place to start. Find existing tested source-code that is 99.9% of what you're looking for, and tweak it.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
No one should start touching device drivers without reading this book: http://lwn.net/Kernel/LDD3/ For some reason I still don't understand this excellent source is freely available.
Actually I dont want to design the driver for a specific device. I want to just design a driver to learn how a driver(for eg keyboard) is working and how it is created. So from where should I start for it??
don't want to design the driver for a specific device. I want to just design a driver to learn how a driver(for eg keyboard) is working and how it is created. So from where should I start for it??
"Use the Source, Luke." The best way to learn how to write a driver is to follow the path that others use to write their drivers: they study what has already been successfully done for their particular distro, find the closest match from existing work, and tweak it. That's the important power of open-source: you don't have to start from the beginning on anything, so no one does.
Do bear in mind that the Linux kernel has evolved considerably over time, so, although books are fine, the documentation directory that comes with the kernel tree, and the kernel itself, should be your primary reference. Once you've got the essential concepts and ideas straight in your head.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.