An open API service indexing awesome lists of open source software.

https://github.com/leo-aa88/linux-char-driver-tutorial

Linux char driver tutorial
https://github.com/leo-aa88/linux-char-driver-tutorial

char-drivers scull

Last synced: 10 months ago
JSON representation

Linux char driver tutorial

Awesome Lists containing this project

README

          

# 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 ) is used to hold device numbers - both the major and minor parts
- `const struct file_operations` (defined in ) 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 `

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