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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Create and use device files9m 16s
-
(Locked)
Implement character device driver file operations12m 31s
-
(Locked)
Write a character device driver10m 29s
-
(Locked)
Understand the user and kernel address spaces5m 7s
-
(Locked)
Challenge: Write a character driver1m 38s
-
(Locked)
Solution: Write a character driver2m 7s
-
-
-
-