From the course: Linux Device Drivers

Unlock the full course today

Join today to access over 23,100 courses taught by industry experts.

Challenge: Write a character driver

Challenge: Write a character driver - Linux Tutorial

From the course: Linux Device Drivers

Challenge: Write a character driver

(lively music) - [Instructor] All right. We got some little challenges for you here. And I want to remind you when you're loading kernel modules, you're writing code that executes in kernel space, bad things potentially can happen. So be careful about that. It's probably best to be doing exercises like this in a virtual machine so that if stuff gets corrupted nothing important has been lost. So start a new virtual machine just for these sorts of exercises would be safest. So if you had the exercise files, you should find the source for a driver called char driver in there and a make file. So you want to build that and insert it and then create a device file. You can do it right there in your home directory, usually, give it major number 197 and minor number zero and then echo your name into the device file. So make sure you gave yourself write permission. You had to be root to create the file. If you give everybody write…

Contents