Giter Club home page Giter Club logo

isfri's Introduction

Why and how

While taking a course called "Advanced Linux: The Linux Kernel" on LinkedIn Learning I wanted to play around with making modules after finishing the sample module for the course. And here is what I came up with in a couple hours. I was honestly surprised I managed to get it working pretty smoothly. I used this great book, borrowed setting permissions from the TTY driver as explained here and modified it slightly when the kernel complained about NULL pointer dereference using this resource.

Prerequisites

You need to have the Linux kernel development package installed. If you see a "build" directory under /lib/modules/<YOUR KERNEL VERSION>/ then you're good to go. If not, consult your distro-specific instruction on how to obtain the package.

Compilation

Clone the repo, enter it and use

make -C /lib/modules/$(uname -r)/build M=$PWD modules

Usage

After succesful compilation, add the module using

sudo insmod isfri.ko

After the module has been added, you can use it by simply using cat on the new device

cat /dev/isfri

The module will then "respond" with a proper message according to the current day of the week:

  • Friday: "IT IS!"
  • Saturday: "You just missed it!"
  • Sunday: "No, but it's still the weekend!"
  • Any other day: "Nope."

If you want to remove the module from the kernel, simply use

sudo rmmod isfri

isfri's People

Contributors

pokerfacowaty avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.