/knock-out

Crate with an example of a kernel module in Rust

Primary LanguageRustGNU General Public License v2.0GPL-2.0

knock-out

Crate with an example of a kernel module in Rust

What does this crate actually do?

This repo is a Makefile with a Rust project that, using Kbuild, the kernel's build system, will generate a kernel module file named parrot.ko.

The kernel module creates a char device that on every read() call, will return a new frame of an ASCII art party parrot in your terminal, which ultimately makes an animation appear when used with cat.

A lot has changed since my talk!

I gave a more in depth explanation of the process for creating this kernel module at DevConf.cz 2020. Since then, I was contacted by the Rust for Linux effort. As a result of the great work they've done, I've migrated this kernel module over to use the Rust for Linux kernel API.

Instructions for party parrot

# Follow https://github.com/Rust-for-Linux/linux/blob/rust/Documentation/rust/quick-start.rst

# Build and load the kernel module
make
sudo insmod parrot.ko

# Party hard!
sudo cat /dev/parrot

Attribution for ASCII art

The frames for the parrot are from parrot.live. parrot.live appears to have taken them from terminal-parrot. That project states that the frames came from jp2a.