No video

Understanding the Structure of a Linux Kernel Device Driver

  Рет қаралды 38,628

Sergio Prado

Sergio Prado

Күн бұрын

For newcomers, it's not easy to understand the structure of a device driver in the Linux kernel. In the end, a device driver is just an abstraction to a piece of hardware. But designing it in a way that it's reusable and maintainable is not that easy. That is why, over time, several concepts and abstractions were developed in the Linux kernel to write device drivers. From the way devices are declared to how drivers are instantiated, from the separation of devices and buses to APIs and subsystems used to export functionality to users. This presentation will be a walkthrough of the design concepts of a Linux kernel device driver, going over the main ideas of the driver model, so we can easily understand the structure of a Linux device driver and start writing our own.
Talk presented at Embedded Linux Conference 2021
Slides: www.dropbox.com/s/m5yafv9v2b3...
Source code: www.dropbox.com/s/q2g7uodmyzi...

Пікірлер: 60
@samiurkhan
@samiurkhan Жыл бұрын
Thanks a million for this. Seeing a device driver actually getting made made it make way more sense than the official book. Cheers
@spradotube
@spradotube 5 ай бұрын
I am glad you enjoyed it @samiurkhan!
@shashidhark.v5111
@shashidhark.v5111 Жыл бұрын
I have seen other videos of yours. You explain things really well. Thank you very much for sharing your knowledge with us.
@electrolance7505
@electrolance7505 9 ай бұрын
I find this presentation has right balance of theory and actual code, has given very good basic understanding how drivers works in linux kernel.
@spradotube
@spradotube 5 ай бұрын
I am glad you enjoyed it @electrolance7505!
@radhakrishnans785
@radhakrishnans785 4 ай бұрын
This gives basic understanding and overview of device driver in a simpler way. It is is good for beginers to watch this video before reading any books, blog...etc
@spradotube
@spradotube 4 ай бұрын
That was the purpose, yeah. Thanks for commenting!
@yjiang7894
@yjiang7894 5 ай бұрын
The depth of this tutorial is spot on. Thank you so much!
@spradotube
@spradotube 5 ай бұрын
I am glad you enjoyed it @yjiang7894!
@junwu680
@junwu680 2 ай бұрын
Great tutorial and step by step guide from a simple start to a complete nice solution. Many thanks.
@spradotube
@spradotube 2 ай бұрын
Thanks! I am glad you enjoyed it!
@ninthsign76
@ninthsign76 29 күн бұрын
Thanks for a great presentation to understand the driver. It is really amazing how you have broken this into steps which makes the structure and its underlying working so much easier to understand
@spradotube
@spradotube 29 күн бұрын
I am glad you enjoyed it!
@richjamjam
@richjamjam 6 ай бұрын
Very good video. I learned a lot. Having just come from Low Level Learning and Low Bytes Productions, this solidified it all.
@spradotube
@spradotube 5 ай бұрын
Hey @richjamjam! I am glad you enjoyed it
@sangsuplee5467
@sangsuplee5467 Жыл бұрын
Thanks for your nice lecture.
@sd07kwon
@sd07kwon 8 ай бұрын
리눅스의 device 제어에 대하여 상세하게 설명을 해주셨네요. 정말 좋은 강의였습니다. 반복해서 볼께요
@spradotube
@spradotube 5 ай бұрын
Thanks @sd07kwon! I am glad you enjoyed it!
@ericgorder1
@ericgorder1 Ай бұрын
Thanks so much you have made it so clear what the real difference of user space and kernel space interfaces. Well presented video, good work!
@spradotube
@spradotube Ай бұрын
I am glad you enjoyed it!
@ahmedzain6270
@ahmedzain6270 Ай бұрын
Many thanks I keep revisit your presentation, the order you created is very good
@spradotube
@spradotube Ай бұрын
I am glad you liked it!
@kumarnkvc
@kumarnkvc 10 ай бұрын
This is very helpful. Thank you.
@spradotube
@spradotube 5 ай бұрын
Hi @kumarnkvc! I am glad you enjoyed it!
@venkatanagarajendraprasadv5152
@venkatanagarajendraprasadv5152 4 ай бұрын
Excellent video
@spradotube
@spradotube 4 ай бұрын
Thanks!
@catcatcatcatcatcatcatcatcatca
@catcatcatcatcatcatcatcatcatca Жыл бұрын
I definitely lacked a lot of knowledge compared to the target audience, but this was still helpful for introducing the consepts. Will probably rewatch this in few months and hopefully understand much more.
@spradotube
@spradotube 5 ай бұрын
I am glad you enjoyed it!
@radhakrishnans785
@radhakrishnans785 4 ай бұрын
@9:15 I think flow sequence may be bi-directional. Based on components and its arrangement in your test/target board shows that you have good experience in 8-bit microcontroller based developments and leveraged those experiences in this test/target board.
@spradotube
@spradotube 4 ай бұрын
Yeah, you are right, for every request there is a response, so the flow sequence is bi-directional (though in the diagram I wanted to represent only the request).
@icojb25
@icojb25 10 ай бұрын
Great video, thanks a lot
@spradotube
@spradotube 5 ай бұрын
Thanks @icojb25! I am glad you enjoyed!
@armando6114
@armando6114 2 ай бұрын
Muito bom o video!
@spradotube
@spradotube 2 ай бұрын
Legal que gostou!
@nandishsg9805
@nandishsg9805 2 жыл бұрын
Nice explaining
@spradotube
@spradotube 4 ай бұрын
I am glad you enjoyed it!
@aashishchauhan1989
@aashishchauhan1989 Жыл бұрын
Brilliant
@spradotube
@spradotube 5 ай бұрын
I am glad you enjoyed it @aashishchauhan1989!
@ivanpiri8982
@ivanpiri8982 7 ай бұрын
Very clear talk, probably the best introduction of the subject present here on yt. My only question that I have while following along is, why when in the "hands on" part we do modprobe drvled the loading of the module doesn't taint the kernel? All my drivers do and i can't figure out how to stop this from happening. My module is built inside the kernel since when i boot i can do "modprobe drivername" so the kernel knows my module but i don't know if i have to do other things
@spradotube
@spradotube 5 ай бұрын
Thanks @ivanpiri8982! About your question, loading an out-of-tree kernel driver does not always taint the kernel. Whether loading a driver taints the kernel depends on the licensing and behavior of the module. If you load a kernel module that it is not licensed under a GPL compatible license or performs actions that are considered risky or unstable, like using certain unsafe APIs or mechanisms, it might taint the kernel. If an out-of-tree driver is licensed under a compatible open-source license (like GPL), and it properly declares its license to the kernel, like in my examples, it doesn't cause the kernel to be tainted.
@David-7815
@David-7815 7 ай бұрын
Thank you fr this insightful lecture Mr. Prado! Can you kindly share exactly what hardware do you use in your demo so who's interested can follow hand on with your demonstrations?
@spradotube
@spradotube 5 ай бұрын
Thanks @David-7815! I've used a Colibri iMX6 SoM connected to the Aster carrier board (both from Toradex).
@moatasemelsayed6226
@moatasemelsayed6226 Жыл бұрын
how to know all the framework that is supported by Linux like led ,I2c,watchdog ,etc ?
@spradotube
@spradotube 5 ай бұрын
Unfortunately, there is no easy way to answer this question. I don't know of any document that describes all frameworks. Probably the source code is the best place to look at. Most frameworks are a subdirectory inside the drivers/ directory in the Linux source code, but there might frameworks in other places.
@andrerclaudio
@andrerclaudio Жыл бұрын
Olá, Sérgio. Você tem git repositório para os arquivos.c desse hands-on?
@spradotube
@spradotube 5 ай бұрын
Olá @andreribeiroclaudio2747! O link para baixar o código-fonte está na descrição do video.
@MillaGamer
@MillaGamer 6 ай бұрын
Sergio tu tem o GIT com esses exemplos? Parabéns pelo conteúdo.
@spradotube
@spradotube 5 ай бұрын
Olá Milla! O código de exemplo está na descrição do video.
@viktor1772
@viktor1772 11 ай бұрын
Hi Sergio, it is a very nice lecture on linux Kernel Device Drivers. I am trying to practice in this topic, so please, could you provide the source code from this tutorial to have a deep look on it? Thanks in advace! 😃
@spradotube
@spradotube 5 ай бұрын
Hi @viktor1772! I am glad you enjoyed it. You can find the source code in the video's description.
@pkl2000us
@pkl2000us 2 жыл бұрын
hey. Do you have a link to the code
@spradotube
@spradotube 5 ай бұрын
The link to the code is in the description of the video.
@bennguyen1313
@bennguyen1313 10 ай бұрын
How do you call functions from a driver's source file? I have a USB (VID0A46 / PID9621) Ethernet Adapter and found driver source code for it, qop_kernel/drivers/net/usb/dm9620 But not sure how I can use it (compile, load, call functions)! For example, I installed gcc and plugged it in , but how do I call functions from that file.. like "dm_write_eeprom_word"?
@spradotube
@spradotube 5 ай бұрын
Hi @bennguyen1313, You usually don't call functions from drivers. Linux device drivers use kernel subsystems to export an interface to the user (usually in /sys or /dev). For example, there is a LED driver with a function to turn on/off this LED. You don't call this function directly. To turn on/off the LED, you write to a file exposed by the driver (via the LED framework) in /sys/class/leds//brightness.
@agarwalminal
@agarwalminal 9 ай бұрын
Do you give guidance for the open source contribution to Linux and other projects? If so, can i get a sessoin?
@spradotube
@spradotube 5 ай бұрын
Hi @agarwalminal! Currently, I don't do that. But I have plans to do some Ask me anything sessions. Make sure you are subscribed to the channel, enable notifications, and join one of those sessions.
@mithrandirthegrey7644
@mithrandirthegrey7644 Жыл бұрын
fml been trying to write a bridge driver for an LCD for 3 weeks can't get it working. I hate computers.
@fabriciomansillapuente
@fabriciomansillapuente Жыл бұрын
Let's talk. Let's hang out, I am also interested on that
@mithrandirthegrey7644
@mithrandirthegrey7644 Жыл бұрын
@@fabriciomansillapuente I ended up trying to set up the bridge as a panel in the device tree instead just to force some MIPI DSI signals out.
@spradotube
@spradotube 5 ай бұрын
@mithrandirthegrey7644 I am glad you could work that out!
How Do Linux Kernel Drivers Work? - Learning Resource
17:02
LiveOverflow
Рет қаралды 541 М.
Device Tree: hardware description for everybody !
43:17
Bootlin
Рет қаралды 84 М.
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 172 МЛН
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 76 МЛН
Who has won ?? 😀 #shortvideo #lizzyisaeva
00:24
Lizzy Isaeva
Рет қаралды 65 МЛН
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 20 МЛН
How Does Linux Boot Process Work?
4:44
ByteByteGo
Рет қаралды 582 М.
How to Avoid Writing Device Drivers for Embedded Linux - Chris Simmonds, 2net
41:19
Debugging the Linux kernel with GDB
36:35
Sergio Prado
Рет қаралды 4,4 М.
Fundamentals of Embedded Linux - Chris Simmons - NDC TechTown 2022
1:04:15
Signals. I spent 2 years to understand this part.
21:24
kimylamp
Рет қаралды 198 М.
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 172 МЛН