Linux is licensed with the GNU General Public License (GPL), adocument devised for the GNU project by the Free SoftwareFoundation. The GPL allows anybody to redistribute, and even sell, aproduct covered by the GPL, as long as the recipient is allowed to rebuildan exact copy of the binary files from source. Additionally, anysoftware product derived from a product covered by the GPL must, if it isredistributed at all, be released under the GPL.
The main goal of such a license is to allow the growth of knowledge bypermitting everybody to modify programs at will; at the same time,people selling software to the public can still do their job. Despitethis simple objective, there’s a never-ending discussion about the GPLand its use. If you want to read the license, you can find it inseveral places in your system, including the directory/usr/src/linux
, as a file calledCOPYING
.
Third-party and custom modules are not part of the Linux kernel, andthus you’re not forced to license them under the GPL. A moduleuses the kernel through a well-defined interface,but is not part of it, similar to the way user programs use the kernelthrough system calls. Note that the exemption to GPL licensing appliesonly to modules that use only the published module interface. Modulesthat dig deeper into the kernel must adhere to the “derived work”terms of the GPL.
In brief, if your code goes in the kernel, you must use the GPL assoon as you release the code. Although personal use of your changesdoesn’t force the GPL on you, if you distribute your code you mustinclude the source code in the distribution—people acquiringyour package must be allowed to rebuild the binary at will. If youwrite a module, on the other hand, you are allowed to distribute it inbinary form. However, this is not always practical, as modules shouldin general be recompiled for each kernel version that they will belinked with (as explained in Chapter 2, in Section 2.2.1, and Chapter 11, in Section 11.3). Newkernel releases—even minor stable releases—often breakcompiled modules, requiring a recompile. Linus Torvalds has statedpublicly that he has no problem with this behavior, and that binarymodules should be expected to work only with the kernel under whichthey were compiled. As a module writer, you will generally serve yourusers better by making source available.
As far as this book is concerned, most of the code is freelyredistributable, either in source or binary form, and neither we norO’Reilly & Associates retain any right on any derived works. Allthe programs are available through FTP fromftp://ftp.ora.com/pub/examples/linux/drivers/,and the exact license terms are stated in the fileLICENSE
in the same directory.
When sample programs include parts of the kernel code, the GPLapplies: the comments accompanying source code are very clear aboutthat. This only happens for a pair of source files that are veryminor to the topic of this book.