jillmpla / linuxkernelproject

A loadable Linux Kernel Module (LKM) that creates a file in /proc and provides read + write functionality.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A loadable Linux Kernel Module (LKM) that creates a "pseudo"-file in /proc and provides read + write functionality for a message on the current development state of the running kernel.

Focus was placed on learning about and understanding /proc, how to communicate between user-space and kernel-space, as well as how to load and unload kernel modules while the kernel is running.


Project Overview:

  • The proc file system is a virtual file system created when the system boots and destroyed at system shut down. It contains information about various processes running and is generally considered the main kernel information source about the kernel while the kernel is running.
  • Linux kernel supports loadable device drivers / kernel modules. These can be added at runtime and can be added without recompiling the entire kernel. They are particularly useful when developing for the kernel and debugging the kernel while the kernel is live.
  • After building the C program available in this GitHub, it can be loaded to create a new "pseudo"-file under /proc.
  • Current developer / development status can be written and read via the command-line / user-space, helping to keep track of what part of the kernel was last worked on, when it was last worked on, and who last worked on it.
  • Project can easily be repurposed to keep track of other information relevant while the Linux OS/kernel is running.

Please view powerpoint (Linux.pptx file in this GitHub) for further details on the project.


To Use on a Linux machine:

  • download devstate.c and Makefile from folder "Code" in this GitHub
  • sudo -s - to stay in superuser mode
  • cd to where the devstate.c and accompanying Makefile are located
  • run make command
  • insmod devstate.ko - load the module into the kernel
  • lsmod - list kernel modules that are currently running, look for devstate at the top
  • To Write: echo "Date:12/01/19, Time:12:00PM, Working on:/proc file system, Author:JPlatts" >> /proc/devstate - updates/overwrites previous development state message
  • To Read: cat /proc/devstate - get current development state message
  • rmmod devstate - remove module from kernel

Tools Used:

Virtual Box

Linux distribution / kernel - Linux Mint 19.2 Cinnamon, kernel: 4.15.0-54-generic, x86-64 architecture.

Linux Kernel Documentation

About

A loadable Linux Kernel Module (LKM) that creates a file in /proc and provides read + write functionality.

License:MIT License


Languages

Language:C 94.5%Language:Makefile 5.5%