Character device driver made for Ubuntu v14.04.4 over Oracle VM VirtualBox.
Uses basic init and clean as well as open, close, read and write for device.
- clone the repo:
git clone https://github.com/ntubach/cop4600.git
cd cop4600
- Run
make
- Insert the module by using
sudo insmod cop.ko
- View the driver init info for the major number using
sudo tail -f /var/log/syslog
- Use mknod for node setup
mknod /dev/copchar c 247 x
where x is you guessing the minor number (start with 1); - Test the device through the supporting file using
sudo ./test
- Follow the onscreen instructions (write a string, press enter, press enter some more, see the same string given back)
- Remove the module by using
sudo rmmod cop
- View step by step events that have been posted to the system log at any time using
tail -f /var/log/syslog
- (alternatively
sudo tail -f /var/log/kern.log
)
- (alternatively
- Congratualations, you have initialized, run, tested and removed a character device driver successfully!
👉 💥💥😎💥💥 👈
Writing a Linux Kernel Module
The Linux Kernel Module Programming Guide
-Limit read-in amount by buffer allotted size (1024), currently allows for any size string (very large) to be read in
-Guarentee buffer clear after printing to terminal