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
- Host: GitHub
- URL: https://github.com/leo-aa88/linux-char-driver-tutorial
- Owner: leo-aa88
- License: gpl-3.0
- Created: 2023-02-07T06:01:48.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-10T14:33:48.000Z (over 3 years ago)
- Last Synced: 2025-06-17T23:06:27.291Z (about 1 year ago)
- Topics: char-drivers, scull
- Language: C
- Homepage:
- Size: 18.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.