Skip to content

Commit

Permalink
Refactor, insert install and remove in makefile and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoproduit committed Nov 30, 2017
1 parent 3a29daa commit d58405e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ all:
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
rm device_usage_example
sudo rmmod my_device
sudo rm /dev/my_device
test:
sudo dmesg -C
sudo insmod my_device.ko
sudo mknod /dev/my_device c 42 0
sudo chmod 666 /dev/my_device
./device_usage_example
dmesg
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
# my_device
This is an example of a kernel device which works as a parrallel port. When writing or reading from the device, it will write in a buffer and print in the KERN_DEBUG.
This is an example of a kernel device which works as a parallel port. When writing or reading from the device, it will write in a buffer and print in the KERN_DEBUG.

## Install

```
git clone [email protected]:brunoproduit/my_device.git
cd my_device
./install.sh
make
```

Note: needs sudo for insmod, mknod & chmod.

if you just want to compile a simple `make` is enough.

The device driver is created in the nodefile `/dev/my_device` as a character device with major number *42*.

## Remove
## Test

The device will write in KERN_DEBUG, which can be read with `dmesg`.
In order to test you can use:

```
./remove.sh
make test
```

Note: needs sudo for rmmod & rm.
This will insert the modue in the kernel, clean dmesg, run device_usage_example.c and print dmesg.
## Remove

The device will write in KERN_DEBUG, which can be read with `dmesg`.
```
make clean
```

Note: needs sudo for rmmod & rm.
9 changes: 0 additions & 9 deletions install.sh

This file was deleted.

5 changes: 0 additions & 5 deletions remove.sh

This file was deleted.

0 comments on commit d58405e

Please sign in to comment.