Kernel Development Learning Pipeline
A5 - Building Character 💪
It’t time to write your first driver!
Outcomes:
- 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.
Procedure:
- You will be assigned a random sequence of operations.
- Add the
ioctl
and llseek
syscalls to your copy of the driver provided in the assignment repo.
- 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 the provided driver and Makefile.
- The second patch should add the
ioctl
and llseek
operations to the existing driver.
- The third patch should add your userspace program that implements the assignment and should add to the existing Makefile.
- Make sure to have compiler warnings enabled (at least
-Wall
but ideally -Wextra
and -Wpedantic
too, or even -Weverything
if you use clang) and that your code doesn’t have any warnings or errors.
- The fourth 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.
Submission Guidelines