Kernel Development Learning Pipeline
A5 - Building Character 💪
It’t time to write your first driver!
- Get familiar with which system calls can be performed on a character device file.
- Get familiar with how the behavior of a character device is specified by its
file_operations in the driver.
- Get familiar with how userspace code can invoke kernel code.
- You will be assigned a random sequence of operations.
- Get the code for a character driver that logs the operations preformed on it that was shown in class working on your machine
- Add the
llseek syscalls to your driver (make sure to make a commit of the driver for your second patch before you add them)
- Your implementations should be based on the implementations of the read and write operations.
- Write a userspace program to interact with the character driver from class.
- The userspace program will call the syscalls available through the driver in order of the sequence assigned to you. The userspace program should produce a matching output to what is assigned to you.
- Your program should check for system call errors.
What to submit:
- A patch which adds a directory named
firstname_lastname/ to the assignment repo containing a copy of your sequence from the sequence folder.
- The second patch should add your version of the character driver from class
- The third patch should add the
llseek operations to the existing driver.
- The fourth patch should add your userspace program that implements the assignment and should add the ability to compile it to the existing Makefile.
- Make sure to have compiler warnings enabled (at least
-Wall but ideally
-Wpedantic too, or even
-Weverything if you use clang) and that your code doesn’t have any warnings or errors.
- The fifth patch should add a file containing the dmesg log from the driver upon a successful run of your program.
- Don’t forget the cover letter.