D
D
Danil Tunev2018-12-14 18:23:50
linux
Danil Tunev, 2018-12-14 18:23:50

Explain the process of writing a driver for Linux?

There was a need to write a driver for the interaction of the kernel with a network card, don’t just throw stones, otherwise I’ll sit in a corner and cry (I’m still a complete 0 in system programming). The essence of the question is pretty stupid, I read articles on this topic on the net, everyone refers to the fact that after writing the source code, you need to recompile the entire system, and how then they write firewood on the window, there was a "suspicion" that it is possible not to compile the system due to one small source code . Is there a mechanism for replacing native drivers with custom ones without compiling the entire system?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Cheremisin, 2018-12-14
@lada-guy

No, you don't need to recompile the system at all!
To write a kernel driver, you need kernel sources (more precisely, just the hereds) and a compiler.
As for the network driver, I recommend starting with the ne2000 driver as one of the easiest ones.
To start writing something for the kernel - start with Pomerants' kizhka The Linux Kernel Module Programming Guide - https://www.tldp.org/LDP/lkmpg/2.6/lkmpg.pdf
And here and in Russian - citforum.ru/ operating_systems/linux/lkmpg
Also in the kernel sources there are driver templates (templates), though I don’t remember where exactly now ...
There is such a resource - https://github.com/ngtkt0909/linux-kernel-module-t .. .(it is not necessary to install cross-compilers if you are not developing a module for a platform other than x86)
Here, in general, is an excellent article, like do it one-two-three - https://blog.sourcerer.io/writing-a-simple-linux-k. ..

T
TyzhSysAdmin, 2018-12-14
@POS_troi

This article should answer your question
https://habr.com/post/117654/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question