1
0
Fork
You've already forked Linux_Driver_Tutorial_legacy
0
A Tutorial how to get started with Linux Kernel Modules and Linux Drivers.
  • C 92.3%
  • Makefile 7.7%
2024年06月18日 19:59:19 +01:00
01_simple_LKM Update mymodule.c 2022年05月12日 12:50:10 +01:00
02_dev_nr Update dev_nr.c 2023年09月21日 17:28:27 +03:30
03_read_write 03_read_write:read_write.c Fixes typo in AND bitwise operation 2023年09月26日 23:16:32 -03:00
04_gpio_driver Deleted files 2023年08月07日 20:34:45 +01:00
05_lcd_driver Update lcd_driver.c 2022年04月28日 18:37:41 -03:00
06_pwm_driver Update pwm_driver.c 2022年04月28日 18:38:06 -03:00
07_BMP280 I2C example 2023年12月20日 19:14:40 +00:00
08_timer Changed folder names and update README 2021年01月25日 20:12:18 +00:00
09_hrtimer Changed folder names and update README 2021年01月25日 20:12:18 +00:00
10_spi_bmp280 Added example for SPI 2021年01月25日 20:06:08 +00:00
11_gpio_irq gpio: simplify irq handler 2024年02月18日 22:28:13 +00:00
12_parameters Using example for Module Parameters 2021年05月10日 19:52:54 +01:00
13_ioctl Update README.md 2021年05月26日 20:51:45 +02:00
14_Kernel_Threads Added example for Threads in a LKM 2021年06月07日 17:46:56 +01:00
15_Sending_Signals signals: simplify irq handler 2024年02月18日 22:26:04 +00:00
16_Poll poll: simplify irq handler 2024年02月18日 22:25:40 +00:00
17_waitqueue Example for waitqueues added 2022年03月17日 19:58:51 +00:00
18_procfs Delete vim swap :p 2022年03月25日 17:28:20 +00:00
19_sysfs Added Sysfs examßple 2022年04月04日 19:34:33 +01:00
20_dt_probe Add example for device tree probing 2022年05月12日 12:51:15 +01:00
21_dt_gpio Added Device Tree GPIO driver 2022年05月16日 20:17:59 +01:00
22_dt_i2c Device Tree Driver for I2C devices 2022年06月09日 18:25:10 +01:00
23_malloc Example for memory management added 2022年07月02日 18:35:42 +01:00
24_serdev Serial (UART) Driver 2022年07月11日 17:28:22 +01:00
25_dt_iio Added sources for Atmega I2C ADC 2022年08月01日 21:15:27 +01:00
26_dt_spi Added Device Tree sPI Driver 2022年08月08日 15:30:40 +01:00
27_misc_device Fixing typos 2022年08月30日 20:40:53 +01:00
28_mutex Added example for mutex 2023年06月20日 19:10:37 +01:00
29_completion Example for completion 2023年07月04日 19:29:29 +01:00
30_dma_memcpy Added a DMA memcopy example 2023年08月07日 20:31:32 +01:00
31_file_access Adding file access example 2023年09月01日 17:35:57 +01:00
32_mmap added mmap example 2023年09月28日 21:12:48 +01:00
33_list Added example for linked lists 2023年10月11日 11:10:10 +01:00
34_my_cdev Added cdev example take 2 2023年11月22日 20:11:54 +00:00
35_priv_data Example for private data in struct file 2023年11月30日 18:10:14 +00:00
36_i2c_driver I2C example 2023年12月20日 19:14:40 +00:00
38_log_levels Added example for showing kernel log levels 2024年06月18日 19:59:19 +01:00
.gitignore Added gitignore from laoshaw. Thank you :-) 2023年08月07日 20:40:40 +01:00
LICENSE.txt Add License 2020年12月31日 11:04:44 +00:00
README.md Added example for showing kernel log levels 2024年06月18日 19:59:19 +01:00

Linux Driver Tutorial

Here you can find examples for simple Linux Kernel Modules and Linux Drivers.

Preparation

I used a Raspberry Pi 3 to develop and test my modules and drivers. To compile them, you need to install the Kernel headers on your Pi. On Raspbian you can do this with the following command:

sudo apt update
sudo apt install raspberrypi-kernel-headers

Raspberry Pi OS is only installs the latest kernel headers. So, make sure, you are running the latest kernel. You can do this by running:

sudo apt upgrade

You also need the build utils (make, gcc, ...) but they come preinstalled on Raspbian.

Content

In this repo you can find examples for:

  1. Simple Kernel Module
  2. Device Numbers and Device Files
  3. Create device file in driver and callbacks
  4. GPIO Driver
  5. Text LCD Driver
  6. PWM Module
  7. Temperature Sensor (I2C)
  8. Timer in Linux Kernel Modules
  9. High Resolution Timer in Linux Kernel Modules
  10. Accessing SPI with a Linux Kernel Module (BMP280 sensor again)
  11. Using a GPIO Interrupt in a Linux Kernel Module
  12. Using Parameters in a Linux Kernel Module
  13. IOCTL in a Linux Kernel Module
  14. Threads in a Linux Kernel Module
  15. Sending a signal from a Linux Kernel Module to an userspace application
  16. The poll callback
  17. Waitqueues in a Linux Kernel Module
  18. Create procfs entries from a Linux Kernel Module
  19. Create sysfs entries from a Linux Kernel Module
  20. Parse the device tree from a Linux Kernel Module to get the deivce properties of a specific device
  21. Device Tree GPIO Driver
  22. Device Tree Driver for I2C Device
  23. Dynamical memory management in a Linux Kernel module
  24. Serial (UART) Driver
  25. Industrial IO compatible driver for an ATMEGA I2C ADC
  26. Device Tree SPI Driver (IIO compatible driver for Atmega SPI ADC)
  27. Misc Device
  28. Mutex for exclusive access to shared resource
  29. Completions for synchronisation
  30. Direct Memory Access (DMA) memcopy example
  31. Accessing files form a Linux Driver
  32. The mmap callback
  33. Linked Lists
  34. Registering device numbers, read and write callback in character devices Take 2
  35. Private Data in struct file
  36. I2C Device Driver without Device Tree
  37. Sysfs Class
  38. Kernel Log levels

More Information

For more information about my Linux Driver examples check out my videos and my playlist

Support me

If you want to support me, you can buy me a coffee buymeacoffee.com/johannes4linux.