Understanding the Structure of a Linux Kernel Device Driver

Поділитися
Вставка
  • Опубліковано 25 лис 2024

КОМЕНТАРІ • 75

  • @riddhidoshi2335
    @riddhidoshi2335 13 днів тому

    This is very useful for someone interested in building and adding linux drivers for the first time. Thank you.

    • @spradotube
      @spradotube  13 днів тому

      Thanks for the feedback! I am glad you enjoyed it!

  • @samiurkhan
    @samiurkhan Рік тому +18

    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  9 місяців тому +1

      I am glad you enjoyed it @samiurkhan!

  • @radhakrishnans785
    @radhakrishnans785 8 місяців тому +1

    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  8 місяців тому

      That was the purpose, yeah. Thanks for commenting!

  • @electrolance7505
    @electrolance7505 Рік тому +4

    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  9 місяців тому

      I am glad you enjoyed it @electrolance7505!

  • @yjiang7894
    @yjiang7894 9 місяців тому

    The depth of this tutorial is spot on. Thank you so much!

    • @spradotube
      @spradotube  9 місяців тому

      I am glad you enjoyed it @yjiang7894!

  • @kenyie8080
    @kenyie8080 2 місяці тому

    I really appreciate the structure of the talk. Starting from the most basic and simple implementation, then demonstrating the issues with basic implementations and then explaining why each framework is introduced as a best practice provides a great way to understand the necessity of each abstraction and framework and what problems are solved by the current best practices. I wish all talks could explain what problems are solved and why we need to adopt the current best practices.

    • @spradotube
      @spradotube  2 місяці тому

      Thanks for the kind words!I am glad you enjoyed the talk!

  • @shashidhark.v5111
    @shashidhark.v5111 Рік тому +5

    I have seen other videos of yours. You explain things really well. Thank you very much for sharing your knowledge with us.

  • @ninthsign76
    @ninthsign76 5 місяців тому +1

    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  5 місяців тому

      I am glad you enjoyed it!

  • @radhakrishnans785
    @radhakrishnans785 8 місяців тому +1

    @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  8 місяців тому

      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).

  • @ericgorder1
    @ericgorder1 6 місяців тому +1

    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  5 місяців тому

      I am glad you enjoyed it!

  • @junwu680
    @junwu680 6 місяців тому +1

    Great tutorial and step by step guide from a simple start to a complete nice solution. Many thanks.

    • @spradotube
      @spradotube  6 місяців тому

      Thanks! I am glad you enjoyed it!

  • @sd07kwon
    @sd07kwon Рік тому +1

    리눅스의 device 제어에 대하여 상세하게 설명을 해주셨네요. 정말 좋은 강의였습니다. 반복해서 볼께요

    • @spradotube
      @spradotube  9 місяців тому

      Thanks @sd07kwon! I am glad you enjoyed it!

  • @SmartBoy-l1f
    @SmartBoy-l1f 2 місяці тому

    Hi sergio,
    This is one of the "Best" content i've ever seen on linux device driver, these 58 mins. helped me save months to understand linux device driver.
    Pls continue to give some insights on linux process management, file-systems and network subsystems as well.
    A million thanks for creating this lecture.

    • @spradotube
      @spradotube  2 місяці тому

      Thanks for the kind words! I am glad you enjoyed it!

  • @richjamjam
    @richjamjam 11 місяців тому +5

    Very good video. I learned a lot. Having just come from Low Level Learning and Low Bytes Productions, this solidified it all.

    • @spradotube
      @spradotube  9 місяців тому

      Hey @richjamjam! I am glad you enjoyed it

  • @ahmedzain6270
    @ahmedzain6270 5 місяців тому

    Many thanks I keep revisit your presentation, the order you created is very good

    • @spradotube
      @spradotube  5 місяців тому

      I am glad you liked it!

  • @catcatcatcatcatcatcatcatcatca
    @catcatcatcatcatcatcatcatcatca Рік тому +1

    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  9 місяців тому

      I am glad you enjoyed it!

  • @David-yp9oz
    @David-yp9oz 3 місяці тому +1

    Thank you so much! This was very helpful

    • @spradotube
      @spradotube  3 місяці тому

      I am glad you enjoyed it!

  • @venkatanagarajendraprasadv5152
    @venkatanagarajendraprasadv5152 8 місяців тому

    Excellent video

  • @sangsuplee5467
    @sangsuplee5467 Рік тому +1

    Thanks for your nice lecture.

  • @andrerclaudio
    @andrerclaudio Рік тому +3

    Olá, Sérgio. Você tem git repositório para os arquivos.c desse hands-on?

    • @spradotube
      @spradotube  9 місяців тому

      Olá @andreribeiroclaudio2747! O link para baixar o código-fonte está na descrição do video.

  • @pkl2000us
    @pkl2000us 2 роки тому +7

    hey. Do you have a link to the code

    • @spradotube
      @spradotube  9 місяців тому

      The link to the code is in the description of the video.

  • @justcurious1940
    @justcurious1940 2 місяці тому +1

    Great video Sergio, can u write a device (NIC) driver that always sends a copy of any packet to a specific IP address?

    • @spradotube
      @spradotube  2 місяці тому

      It is certainly possible to hook up into kernel functions to do this, but probably this is better done nowadays with eBPF (ebpf.io/)

  • @adammontgomery7980
    @adammontgomery7980 2 місяці тому +1

    Nice! What is that hardware setup? It looks like a daughter board with the LED on an itx motherboard.

    • @spradotube
      @spradotube  2 місяці тому

      I used a Toradex platform (Colibri iMX6 + Aster carrier board) with a custom expansion board. You can translate to English the link below in case you want more info about the hardware:
      sergioprado.org/aster-ipe-cape-e-o-novo-kit-de-desenvolvimento-da-embedded-labworks/

    • @adammontgomery7980
      @adammontgomery7980 2 місяці тому

      ​@@spradotube Thank you for the response. It's even more complicated than I thought.

  • @ivanpiri8982
    @ivanpiri8982 11 місяців тому

    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  9 місяців тому

      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.

  • @MillaGamer
    @MillaGamer 10 місяців тому +1

    Sergio tu tem o GIT com esses exemplos? Parabéns pelo conteúdo.

    • @spradotube
      @spradotube  9 місяців тому

      Olá Milla! O código de exemplo está na descrição do video.

  • @kumarnkvc
    @kumarnkvc Рік тому

    This is very helpful. Thank you.

    • @spradotube
      @spradotube  9 місяців тому

      Hi @kumarnkvc! I am glad you enjoyed it!

  • @icojb25
    @icojb25 Рік тому

    Great video, thanks a lot

    • @spradotube
      @spradotube  9 місяців тому

      Thanks @icojb25! I am glad you enjoyed!

  • @nandishsg9805
    @nandishsg9805 3 роки тому +2

    Nice explaining

    • @spradotube
      @spradotube  9 місяців тому

      I am glad you enjoyed it!

  • @armando6114
    @armando6114 6 місяців тому

    Muito bom o video!

  • @mithrandirthegrey7644
    @mithrandirthegrey7644 Рік тому +3

    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  9 місяців тому

      @mithrandirthegrey7644 I am glad you could work that out!

  • @moatasemelsayed6226
    @moatasemelsayed6226 Рік тому +1

    how to know all the framework that is supported by Linux like led ,I2c,watchdog ,etc ?

    • @spradotube
      @spradotube  9 місяців тому

      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.

  • @David-7815
    @David-7815 11 місяців тому

    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  9 місяців тому +1

      Thanks @David-7815! I've used a Colibri iMX6 SoM connected to the Aster carrier board (both from Toradex).

  • @aashishchauhan1989
    @aashishchauhan1989 2 роки тому +1

    Brilliant

    • @spradotube
      @spradotube  9 місяців тому

      I am glad you enjoyed it @aashishchauhan1989!

  • @bennguyen1313
    @bennguyen1313 Рік тому

    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  9 місяців тому +1

      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 Рік тому

    Do you give guidance for the open source contribution to Linux and other projects? If so, can i get a sessoin?

    • @spradotube
      @spradotube  9 місяців тому

      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.

  • @viktor1772
    @viktor1772 Рік тому +1

    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  9 місяців тому

      Hi @viktor1772! I am glad you enjoyed it. You can find the source code in the video's description.

  • @calyptratus474
    @calyptratus474 4 місяці тому

    Brasil citado! faz o L

    • @spradotube
      @spradotube  4 місяці тому

      I am glad you enjoyed it!