P1: Loading Linux Kernel Modules and Kernel Data Structures.
Assignment Day | January 17, 2018 |
Due Date | January 30 You will need to demo this in class. |
This project is described with less detail in the text book - as programming project on page 96 - 101 (see piazza for a descriptive pdf). In this project you will a) add a basic kernel module to the Linux Kernel, and b) create a traversible kernel data structure, a list structure.
General Steps (how to install Virtual Box is described in 2, at book resource site.).
- (4-5 minutes) Install VirtualBox on your laptop 4-5 minutes
- (1 hr) Download the Virtual Machine from the book website ( site ).
- Update the Linux kernel:
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install linux-headers-$(uname -r)
optional full linux source tree:sudo apt-get install linux-source
- Write a simple linux kernel module that prints out informational messages.
- Write a linux kernel module that manipulates/traverses a kernel list structure.
Hints:
set -o vi
- include files needed in data structure program (in addition to the ones in simple.c):
#include <linux/list.h>
#include <linux/types.h>
#include <linux/slab.h> /* for kmalloc to work */
struct birthday
;
{
int day;
int year;
struct list_head list;
}
Is missing the last ';' after the curly brace in the book.
- osc - password for the virtual machine
Useful commands:
lsmod
sudo insmod simple.ko # installs module
sudo rmmod simple # removes module
sudo dmesg
sudo dmesg -c # clears buffer
- from virtual box machine, log into your host machine via the default gateway at
10.0.2.2
Example (in a terminal of the Debian Linux guest OS in your virtual box).
ssh ingrid@10.0.0.2 # secure remote login
sftp ingrid@10.0.0.2 #transfer files
Submission:
please submit all c-code, Makefile and screenshot (demostrating that your programs work appropriately on nike in a directory prefaced with the string: P2