Being an electrical engineering student at my undergraduate level, my exposure to Linux
started rather late and was limited to C programming on Linux PC. My true interaction with
Linux started during my post graduation at IIT DELHI, wherein I started learning Linux shell
commands, Vi editor etc. Still my experience remained limited to user space work like
programming, networking and basic system administration.
My first encounter with kernel programming happened when I was given an assignment to
write a device driver for mouse. Although I could succeed in getting mouse events, I could not
complete the assignment. But it left an interesting area open to me which I continued to
explore till date.
The idea of sharing the experience started when I finished a self assignment to write a
network device driver on 2.4 kernel. I wrote an article and published it on Linux Malta group.
The article turned out to be an immensely popular which increased my faith in sharing my
experience. Later, the same article was re-published in Linux Gazette magazine because Linux
Malta group website went down.
Based on the responses from the readers I realized that while many good, in-fact very good,
reference books are available about Linux device driver programming, still there is a void in
teaching an end to end driver development. Specifically a sample and real hardware made
users to do the real development from scratch.
Encouraged from this articleâ€™s success, I decided to write similar articles for block, USB,
char, UART drivers as well and put them together along with kernel programming articles so
that a reader finds all of them in one place. Thatâ€™s how this book has originated. All the code
samples in this book are written or re-written for 2.6.21 kernel, however wherever needed,
reference to older kernel are also been given so that readers may know the difference if they
have to work on older kernels.
The examples sited throughout this book are trimmed versions of the self assignments done
at home on Linux running on AMD AthlonTM processor. Specifically the error handling part is
either removed or is minimal for the sake of brevity. Also the driver design is kept very simple
and minimal basic functions are implemented for easy understanding. This will help readers to
quickly understand and then modify them to add more features, error handling and bug fixing
to grasp better understanding.