Conceptual
Login

Building a Character Device You Can Read and Write from a Shell

A driver is only useful once something outside the kernel can talk to it, and the simplest door is a file under /dev that a shell can read from and write to. In this stage you register a small character device whose read returns a greeting, whose write stores the bytes you send it, and which answers one custom request with a counter. After it you can drive your own kernel code with nothing but cat and echo, which is the fastest testing interface you will have all path.

Questions this Concept answers

  • Why may a driver not simply dereference the address that user space passed to a write call?