Skip to content

araujo88/linux-char-driver-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

linux-char-driver-tutorial

Implementation of a SCULL driver (Simple Character Utility for Loading Localities) example of Linux kernel development.

Linux Kernel version

5.10.0-21-amd64

Description

SCULL is an region is memory that the kernel treats as if it was device or memory in device. It is used for learning to write device drivers and is also used for testing simple drivers.

Datatypes

  • dev_t (defined in <linux/types.h>) is used to hold device numbers - both the major and minor parts
  • const struct file_operations (defined in <linux/fs.h>) hold the file operations performed on this device

Commands

  • cat /proc/devices
  • sudo tail -f /var/log/syslog
  • sudo mknod -m 666 /dev/scull c <MAJOR_NUMBER> <MINOR_NUMBER>
  • sudo rm /dev/scull

Testing

After loading and creating the device in /dev/, test with cat /dev/scull while monitoring with sudo tail -f /var/log/syslog for open-read-close and, as root, echo "testing" > /dev/scull for open-write-close.

About

Linux char driver tutorial

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published