项目作者: InputUsername

项目描述 :
/dev/hodor
高级语言: C
项目地址: git://github.com/InputUsername/dev-hodor.git
创建时间: 2015-08-29T15:04:40Z
项目社区:https://github.com/InputUsername/dev-hodor

开源协议:GNU General Public License v2.0

下载


/dev/hodor

This is a device that behaves like Hodor.

It answers to your calls with nothing but Hodor.

Really useful for, uh… Not much. Oh well.

This repo contains code to build a Linux kernel module that creates a device, /dev/hodor.
Has been tested on Ubuntu 14.04 and should work on Debian too.

Largely based on http://www.linuxdevcenter.com/pub/a/linux/2007/07/05/devhelloworld-a-simple-introduction-to-device-drivers-under-linux.html.

How to build/use

First you need the module-assistant package, which installs packages and configures the system to build out-of-kernel modules. Install it with:

  1. $ sudo apt-get install module-assistant

That should be enough to build the module. To build it, run:

  1. $ make

Then, to install the module, use:

  1. $ sudo insmod ./hodor_dev.ko

Now you should be able to read from /dev/hodor. Note that this requires root.

  1. $ cat /dev/hodor

To uninstall the module again, use:

  1. $ sudo rmmod hodor_dev