The Linux Kernel Hackers' Guide
Michael K. Johnson
Copyright © 1992, 1993, 1994, 1995
Michael K. Johnson
201 Howell Street, Apt. 1C,
Chapel Hill, North Carolina
The Linux Kernel Hackers' Guide may be reproduced and distributed in whole or in part, subject
to the following conditions:
Exceptions to these rules may be granted for academic purposes: Write
to Michael K. Johnson, at the above address, or email
email@example.com, and ask. These restrictions are here to protect
the authors, not to restrict you as educators and learners.
All source code in The Linux Kernel Hackers' Guide is placed under
the GNU General Public License. See Appendix #gnulicense#24>
for a copy of the GNU ``GPL.'' Source code for all full example programs is
available on-line as tsx-11.mit.edu:/pub/linux/docs/hacker-source.tar.Z
and a copy of the GPL is available in that file as COPYING.
[O.K., so it will be available when there is some
source to distribute...]
- The copyright notice above and this permission notice must be
preserved complete on all complete or partial copies.
- Any translation or
derivative work of The Linux Kernel Hackers' Guide must be approved
by the author in writing before distribution.
- If you distribute The
Linux Kernel Hackers' Guide in part, instructions for obtaining
the complete version of The Linux Kernel Hackers' Guide must be
included, and a means for obtaining a complete version provided.
Small portions may be reproduced as illustrations for reviews or quotes in
other works without this permission notice, if proper citation is given.
The GNU General Public License referenced below may be reproduced under the
conditions given within it.
- Several sections of this document are held
under separate copyright. When these sections are covered by a different
copyright, the seperate copyright is noted. If you distribute The
Linux Kernel Hackers' Guide in part, and that part is, in whole, held
under a seperate copyright, the conditions of that copyright apply.
UNIX is a trademark of X/Open
MS-DOS is a trademark of Microsoft Corporation.
Linux is not a trademark, and has no connection to
UNIX or X/Open.
If any trademarks have been unintentionally unacknowledged, please
inform the editor, Michael K. Johnson, 201 Howell Street, Apt. 1C,
Chapel Hill, North Carolina 27514-4818, email firstname.lastname@example.org.
The The Linux Kernel Hackers' Guide is inspired by all of us ``kernel hacker wannabees'' who
just did not know enough about unix systems to hack the Linux kernel
when it first came out, and had to learn slowly. This guide is
designed to help you get up to speed on the concepts that are not
intuitively obvious, and to document the internal structures of
Linux so that you don't have to read the whole kernel source to
figure out what is happening with one variable, or to discover the
purpose of one function call.
Why Linux? Well, Linux is the first free unix clone for the 386 to
be freely available. It is a complete re-write, and has been kept
small, so it does not have a lot of the time-honored baggage that
other free operating systems (like 386BSD) carry, and so is easier to
understand and modify.
Unix has been around for over twenty years, but only in the last few
years have microcomputers become powerful enough to run a modern
protected, multiuser, multitasking operating system. Furthermore, unix
implementations have not been free. Because of this, very little free
documentation has been written, at least for the kernel internals.
Unix, though simple at first, has grown more and more appendages, and has
become a very complex system, which only ``wizards'' understand. With
, however, we have a chance to change this, for a few reasons:
It is our hope that this book will help the nascent kernel hacker
learn how to hack the Linux kernel, by giving an understanding of
how the kernel is structured.
- Linux has a simple kernel, with well-structured interfaces.
- One person, Linus Torvalds, has control of what code is added to
, and he does this work gratis. This means that random pieces
of code are not forced into the kernel by some company's politics, and
the kernel interfaces stay relatively clean.
- The source is free, so many people can study it and learn to
understand it, becoming ``wizards'' in their own right, and eventually
contribute code to the effort.
- Linus Torvalds,
- of course, for starting this whole time
sink, and for gently providing explanations whenever necessary. He
has done a wonderful job of keeping the kernel source code
understandable and neat. I can't imagine having learned so much in
the past few years without .
- Krishna Balasubramanian and Douglas Johnson,
for writing much of the section on memory management, and helping
with the rest.
- Stanley Scalsky,
- for helping document the system call interface.
- Rik Faith,
- for writing the section on how to write a
SCSI device driver.
- Robert Baruch,
- for the review of Writing UNIX
Device Drivers and for his help with the section on writing device
- Linux Journal,
- for providing me with a Linux-related
job, and for allowing me to do work on the KHG on their time.
- Kim Johnson, my wife,
- for tolerating and
encouraging me even when I spend my time on crazy stuff like Linux.
- Linux Memory Management:
- The original version of this
document is copyright © 1993 Krishna Balasubramanian. Some
changes copyright © 1993 Michael K. Johnson and Douglas R. Johnson.
- How System Calls Work:
- The original version of this
document is copyright © 1993 Stanley Scalsky. Some changes
copyright © 1993 Michael K. Johnson
- Writing a SCSI Device Driver
- The original version of
this document is copyright © 1993 Rickard E. Faith. Some
modifications are copyright © 1993 Michael K. Johnson. The
author has approved the inclusion of this material, despite the
slightly more restrictive copyright on this whole document. The
original copyright restrictions, which still apply to any
work derived solely from this work, are:
1993 Rickard E. Faith (email@example.com). All rights reserved.
Permission is granted to make and distribute verbatim copies of this
paper provided the copyright notice and this permission notice are
preserved on all copies.
If you wish to make a derived work, please start
from the original document. To do so, please contact
Rickard E. Faith, firstname.lastname@example.org. The original is available
for anonymous ftp as ftp.cs.unc.edu:/pub/faith/papers/scsi.paper.tar.gz.