From the course: Linux Device Drivers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Write a character driver - Linux Tutorial
From the course: Linux Device Drivers
Solution: Write a character driver
(upbeat music) - [Instructor] So let's look at solutions for those challenges. The first question was, build and load the char driver from the exercise files. So you need to change the directory into exercises. Chapter three, dual make should try to use the header for your current Colonel, so that all needs to be installed. And then you should get chardriver1.ko, and as route with Sudo you insmod that, then number two, create a character device file with major 197 and minor zero. 'Cause that's what the driver expects. And I made it in tmp, and again, it got to be route, so Sudo, mknod, tmp/mydev, C for character 197 for the major, zero for the minor. Number three, echo your name into that. So if you look at the source code to char driver, you'll see there's a limited buffer, so don't try to Echo the dictionary into it or something, just your name there. And then step four, you cut it and that should show your name.…
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
-
-
-
-