提交 02bafd96 编写于 作者: L Linus Torvalds

Merge tag 'docs-4.9' of git://git.lwn.net/linux

Pull documentation updates from Jonathan Corbet:
 "This is the documentation update pull for the 4.9 merge window.

  The Sphinx transition is still creating a fair amount of work. Here we
  have a number of fixes and, importantly, a proper PDF output solution,
  thanks to Jani Nikula, Mauro Carvalho Chehab and Markus Heiser.

  I've started a couple of new books: a driver API book (based on the
  old device-drivers.tmpl) and a development tools book. Both are meant
  to show how we can integrate together our existing documentation into
  a more coherent and accessible whole. It involves moving some stuff
  around and formatting changes, but, I think, the results are worth it.
  The good news is that most of our existing Documentation/*.txt files
  are *almost* in RST format already; the amount of messing around
  required is minimal.

  And, of course, there's the usual set of updates, typo fixes, and
  more"

* tag 'docs-4.9' of git://git.lwn.net/linux: (120 commits)
  URL changed for Linux Foundation TAB
  dax : Fix documentation with respect to struct pages
  iio: Documentation: Correct the path used to create triggers.
  docs: Remove space-before-label guidance from CodingStyle
  docs-rst: add inter-document cross references
  Documentation/email-clients.txt: convert it to ReST markup
  Documentation/kernel-docs.txt: reorder based on timestamp
  Documentation/kernel-docs.txt: Add dates for online docs
  Documentation/kernel-docs.txt: get rid of broken docs
  Documentation/kernel-docs.txt: move in-kernel docs
  Documentation/kernel-docs.txt: remove more legacy references
  Documentation/kernel-docs.txt: add two published books
  Documentation/kernel-docs.txt: sort books per publication date
  Documentation/kernel-docs.txt: adjust LDD references
  Documentation/kernel-docs.txt: some improvements on the ReST output
  Documentation/kernel-docs.txt: Consistent indenting: 4 spaces
  Documentation/kernel-docs.txt: Add 4 paper/book references
  Documentation/kernel-docs.txt: Improve layouting of book list
  Documentation/kernel-docs.txt: Remove offline or outdated entries
  docs: Clean up bare :: lines
  ...
.. _changes:
Minimal requerements to compile the Kernel
++++++++++++++++++++++++++++++++++++++++++
Intro Intro
===== =====
This document is designed to provide a list of the minimum levels of This document is designed to provide a list of the minimum levels of
software necessary to run the 3.0 kernels. software necessary to run the 4.x kernels.
This document is originally based on my "Changes" file for 2.0.x kernels This document is originally based on my "Changes" file for 2.0.x kernels
and therefore owes credit to the same people as that file (Jared Mauch, and therefore owes credit to the same people as that file (Jared Mauch,
...@@ -10,9 +15,9 @@ Axel Boldt, Alessandro Sigala, and countless other users all over the ...@@ -10,9 +15,9 @@ Axel Boldt, Alessandro Sigala, and countless other users all over the
'net). 'net).
Current Minimal Requirements Current Minimal Requirements
============================ ****************************
Upgrade to at *least* these software revisions before thinking you've Upgrade to at **least** these software revisions before thinking you've
encountered a bug! If you're unsure what version you're currently encountered a bug! If you're unsure what version you're currently
running, the suggested command should tell you. running, the suggested command should tell you.
...@@ -21,34 +26,40 @@ running a Linux kernel. Also, not all tools are necessary on all ...@@ -21,34 +26,40 @@ running a Linux kernel. Also, not all tools are necessary on all
systems; obviously, if you don't have any ISDN hardware, for example, systems; obviously, if you don't have any ISDN hardware, for example,
you probably needn't concern yourself with isdn4k-utils. you probably needn't concern yourself with isdn4k-utils.
o GNU C 3.2 # gcc --version ====================== =============== ========================================
o GNU make 3.80 # make --version Program Minimal version Command to check the version
o binutils 2.12 # ld -v ====================== =============== ========================================
o util-linux 2.10o # fdformat --version GNU C 3.2 gcc --version
o module-init-tools 0.9.10 # depmod -V GNU make 3.80 make --version
o e2fsprogs 1.41.4 # e2fsck -V binutils 2.12 ld -v
o jfsutils 1.1.3 # fsck.jfs -V util-linux 2.10o fdformat --version
o reiserfsprogs 3.6.3 # reiserfsck -V module-init-tools 0.9.10 depmod -V
o xfsprogs 2.6.0 # xfs_db -V e2fsprogs 1.41.4 e2fsck -V
o squashfs-tools 4.0 # mksquashfs -version jfsutils 1.1.3 fsck.jfs -V
o btrfs-progs 0.18 # btrfsck reiserfsprogs 3.6.3 reiserfsck -V
o pcmciautils 004 # pccardctl -V xfsprogs 2.6.0 xfs_db -V
o quota-tools 3.09 # quota -V squashfs-tools 4.0 mksquashfs -version
o PPP 2.4.0 # pppd --version btrfs-progs 0.18 btrfsck
o isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version pcmciautils 004 pccardctl -V
o nfs-utils 1.0.5 # showmount --version quota-tools 3.09 quota -V
o procps 3.2.0 # ps --version PPP 2.4.0 pppd --version
o oprofile 0.9 # oprofiled --version isdn4k-utils 3.1pre1 isdnctrl 2>&1|grep version
o udev 081 # udevd --version nfs-utils 1.0.5 showmount --version
o grub 0.93 # grub --version || grub-install --version procps 3.2.0 ps --version
o mcelog 0.6 # mcelog --version oprofile 0.9 oprofiled --version
o iptables 1.4.2 # iptables -V udev 081 udevd --version
o openssl & libcrypto 1.0.0 # openssl version grub 0.93 grub --version || grub-install --version
o bc 1.06.95 # bc --version mcelog 0.6 mcelog --version
iptables 1.4.2 iptables -V
openssl & libcrypto 1.0.0 openssl version
bc 1.06.95 bc --version
Sphinx\ [#f1]_ 1.2 sphinx-build --version
====================== =============== ========================================
.. [#f1] Sphinx is needed only to build the Kernel documentation
Kernel compilation Kernel compilation
================== ******************
GCC GCC
--- ---
...@@ -64,16 +75,16 @@ You will need GNU make 3.80 or later to build the kernel. ...@@ -64,16 +75,16 @@ You will need GNU make 3.80 or later to build the kernel.
Binutils Binutils
-------- --------
Linux on IA-32 has recently switched from using as86 to using gas for Linux on IA-32 has recently switched from using ``as86`` to using ``gas`` for
assembling the 16-bit boot code, removing the need for as86 to compile assembling the 16-bit boot code, removing the need for ``as86`` to compile
your kernel. This change does, however, mean that you need a recent your kernel. This change does, however, mean that you need a recent
release of binutils. release of binutils.
Perl Perl
---- ----
You will need perl 5 and the following modules: Getopt::Long, Getopt::Std, You will need perl 5 and the following modules: ``Getopt::Long``,
File::Basename, and File::Find to build the kernel. ``Getopt::Std``, ``File::Basename``, and ``File::Find`` to build the kernel.
BC BC
-- --
...@@ -93,7 +104,7 @@ and higher. ...@@ -93,7 +104,7 @@ and higher.
System utilities System utilities
================ ****************
Architectural changes Architectural changes
--------------------- ---------------------
...@@ -115,7 +126,7 @@ well as the desired DocBook stylesheets. ...@@ -115,7 +126,7 @@ well as the desired DocBook stylesheets.
Util-linux Util-linux
---------- ----------
New versions of util-linux provide *fdisk support for larger disks, New versions of util-linux provide ``fdisk`` support for larger disks,
support new options to mount, recognize more supported partition support new options to mount, recognize more supported partition
types, have a fdformat which works with 2.4 kernels, and similar goodies. types, have a fdformat which works with 2.4 kernels, and similar goodies.
You'll probably want to upgrade. You'll probably want to upgrade.
...@@ -125,54 +136,57 @@ Ksymoops ...@@ -125,54 +136,57 @@ Ksymoops
If the unthinkable happens and your kernel oopses, you may need the If the unthinkable happens and your kernel oopses, you may need the
ksymoops tool to decode it, but in most cases you don't. ksymoops tool to decode it, but in most cases you don't.
It is generally preferred to build the kernel with CONFIG_KALLSYMS so It is generally preferred to build the kernel with ``CONFIG_KALLSYMS`` so
that it produces readable dumps that can be used as-is (this also that it produces readable dumps that can be used as-is (this also
produces better output than ksymoops). If for some reason your kernel produces better output than ksymoops). If for some reason your kernel
is not build with CONFIG_KALLSYMS and you have no way to rebuild and is not build with ``CONFIG_KALLSYMS`` and you have no way to rebuild and
reproduce the Oops with that option, then you can still decode that Oops reproduce the Oops with that option, then you can still decode that Oops
with ksymoops. with ksymoops.
Module-Init-Tools Module-Init-Tools
----------------- -----------------
A new module loader is now in the kernel that requires module-init-tools A new module loader is now in the kernel that requires ``module-init-tools``
to use. It is backward compatible with the 2.4.x series kernels. to use. It is backward compatible with the 2.4.x series kernels.
Mkinitrd Mkinitrd
-------- --------
These changes to the /lib/modules file tree layout also require that These changes to the ``/lib/modules`` file tree layout also require that
mkinitrd be upgraded. mkinitrd be upgraded.
E2fsprogs E2fsprogs
--------- ---------
The latest version of e2fsprogs fixes several bugs in fsck and The latest version of ``e2fsprogs`` fixes several bugs in fsck and
debugfs. Obviously, it's a good idea to upgrade. debugfs. Obviously, it's a good idea to upgrade.
JFSutils JFSutils
-------- --------
The jfsutils package contains the utilities for the file system. The ``jfsutils`` package contains the utilities for the file system.
The following utilities are available: The following utilities are available:
o fsck.jfs - initiate replay of the transaction log, and check
- ``fsck.jfs`` - initiate replay of the transaction log, and check
and repair a JFS formatted partition. and repair a JFS formatted partition.
o mkfs.jfs - create a JFS formatted partition.
o other file system utilities are also available in this package. - ``mkfs.jfs`` - create a JFS formatted partition.
- other file system utilities are also available in this package.
Reiserfsprogs Reiserfsprogs
------------- -------------
The reiserfsprogs package should be used for reiserfs-3.6.x The reiserfsprogs package should be used for reiserfs-3.6.x
(Linux kernels 2.4.x). It is a combined package and contains working (Linux kernels 2.4.x). It is a combined package and contains working
versions of mkreiserfs, resize_reiserfs, debugreiserfs and versions of ``mkreiserfs``, ``resize_reiserfs``, ``debugreiserfs`` and
reiserfsck. These utils work on both i386 and alpha platforms. ``reiserfsck``. These utils work on both i386 and alpha platforms.
Xfsprogs Xfsprogs
-------- --------
The latest version of xfsprogs contains mkfs.xfs, xfs_db, and the The latest version of ``xfsprogs`` contains ``mkfs.xfs``, ``xfs_db``, and the
xfs_repair utilities, among others, for the XFS filesystem. It is ``xfs_repair`` utilities, among others, for the XFS filesystem. It is
architecture independent and any version from 2.0.0 onward should architecture independent and any version from 2.0.0 onward should
work correctly with this version of the XFS kernel code (2.6.0 or work correctly with this version of the XFS kernel code (2.6.0 or
later is recommended, due to some significant improvements). later is recommended, due to some significant improvements).
...@@ -180,7 +194,7 @@ later is recommended, due to some significant improvements). ...@@ -180,7 +194,7 @@ later is recommended, due to some significant improvements).
PCMCIAutils PCMCIAutils
----------- -----------
PCMCIAutils replaces pcmcia-cs. It properly sets up PCMCIAutils replaces ``pcmcia-cs``. It properly sets up
PCMCIA sockets at system startup and loads the appropriate modules PCMCIA sockets at system startup and loads the appropriate modules
for 16-bit PCMCIA devices if the kernel is modularized and the hotplug for 16-bit PCMCIA devices if the kernel is modularized and the hotplug
subsystem is used. subsystem is used.
...@@ -198,19 +212,20 @@ Intel IA32 microcode ...@@ -198,19 +212,20 @@ Intel IA32 microcode
A driver has been added to allow updating of Intel IA32 microcode, A driver has been added to allow updating of Intel IA32 microcode,
accessible as a normal (misc) character device. If you are not using accessible as a normal (misc) character device. If you are not using
udev you may need to: udev you may need to::
mkdir /dev/cpu mkdir /dev/cpu
mknod /dev/cpu/microcode c 10 184 mknod /dev/cpu/microcode c 10 184
chmod 0644 /dev/cpu/microcode chmod 0644 /dev/cpu/microcode
as root before you can use this. You'll probably also want to as root before you can use this. You'll probably also want to
get the user-space microcode_ctl utility to use with this. get the user-space microcode_ctl utility to use with this.
udev udev
---- ----
udev is a userspace application for populating /dev dynamically with
only entries for devices actually present. udev replaces the basic ``udev`` is a userspace application for populating ``/dev`` dynamically with
only entries for devices actually present. ``udev`` replaces the basic
functionality of devfs, while allowing persistent device naming for functionality of devfs, while allowing persistent device naming for
devices. devices.
...@@ -218,10 +233,10 @@ FUSE ...@@ -218,10 +233,10 @@ FUSE
---- ----
Needs libfuse 2.4.0 or later. Absolute minimum is 2.3.0 but mount Needs libfuse 2.4.0 or later. Absolute minimum is 2.3.0 but mount
options 'direct_io' and 'kernel_cache' won't work. options ``direct_io`` and ``kernel_cache`` won't work.
Networking Networking
========== **********
General changes General changes
--------------- ---------------
...@@ -243,9 +258,9 @@ enable it to operate over diverse media layers. If you use PPP, ...@@ -243,9 +258,9 @@ enable it to operate over diverse media layers. If you use PPP,
upgrade pppd to at least 2.4.0. upgrade pppd to at least 2.4.0.
If you are not using udev, you must have the device file /dev/ppp If you are not using udev, you must have the device file /dev/ppp
which can be made by: which can be made by::
mknod /dev/ppp c 108 0 mknod /dev/ppp c 108 0
as root. as root.
...@@ -260,22 +275,22 @@ NFS-utils ...@@ -260,22 +275,22 @@ NFS-utils
In ancient (2.4 and earlier) kernels, the nfs server needed to know In ancient (2.4 and earlier) kernels, the nfs server needed to know
about any client that expected to be able to access files via NFS. This about any client that expected to be able to access files via NFS. This
information would be given to the kernel by "mountd" when the client information would be given to the kernel by ``mountd`` when the client
mounted the filesystem, or by "exportfs" at system startup. exportfs mounted the filesystem, or by ``exportfs`` at system startup. exportfs
would take information about active clients from /var/lib/nfs/rmtab. would take information about active clients from ``/var/lib/nfs/rmtab``.
This approach is quite fragile as it depends on rmtab being correct This approach is quite fragile as it depends on rmtab being correct
which is not always easy, particularly when trying to implement which is not always easy, particularly when trying to implement
fail-over. Even when the system is working well, rmtab suffers from fail-over. Even when the system is working well, ``rmtab`` suffers from
getting lots of old entries that never get removed. getting lots of old entries that never get removed.
With modern kernels we have the option of having the kernel tell mountd With modern kernels we have the option of having the kernel tell mountd
when it gets a request from an unknown host, and mountd can give when it gets a request from an unknown host, and mountd can give
appropriate export information to the kernel. This removes the appropriate export information to the kernel. This removes the
dependency on rmtab and means that the kernel only needs to know about dependency on ``rmtab`` and means that the kernel only needs to know about
currently active clients. currently active clients.
To enable this new functionality, you need to: To enable this new functionality, you need to::
mount -t nfsd nfsd /proc/fs/nfsd mount -t nfsd nfsd /proc/fs/nfsd
...@@ -287,8 +302,32 @@ mcelog ...@@ -287,8 +302,32 @@ mcelog
------ ------
On x86 kernels the mcelog utility is needed to process and log machine check On x86 kernels the mcelog utility is needed to process and log machine check
events when CONFIG_X86_MCE is enabled. Machine check events are errors reported events when ``CONFIG_X86_MCE`` is enabled. Machine check events are errors
by the CPU. Processing them is strongly encouraged. reported by the CPU. Processing them is strongly encouraged.
Kernel documentation
********************
Sphinx
------
The ReST markups currently used by the Documentation/ files are meant to be
built with ``Sphinx`` version 1.2 or upper. If you're desiring to build
PDF outputs, it is recommended to use version 1.4.6.
.. note::
Please notice that, for PDF and LaTeX output, you'll also need ``XeLaTeX``
version 3.14159265. Depending on the distribution, you may also need
to install a series of ``texlive`` packages that provide the minimal
set of functionalities required for ``XeLaTex`` to work.
Other tools
-----------
In order to produce documentation from DocBook, you'll also need ``xmlto``.
Please notice, however, that we're currently migrating all documents to use
``Sphinx``.
Getting updated software Getting updated software
======================== ========================
...@@ -298,114 +337,149 @@ Kernel compilation ...@@ -298,114 +337,149 @@ Kernel compilation
gcc gcc
--- ---
o <ftp://ftp.gnu.org/gnu/gcc/>
- <ftp://ftp.gnu.org/gnu/gcc/>
Make Make
---- ----
o <ftp://ftp.gnu.org/gnu/make/>
- <ftp://ftp.gnu.org/gnu/make/>
Binutils Binutils
-------- --------
o <ftp://ftp.kernel.org/pub/linux/devel/binutils/>
- <ftp://ftp.kernel.org/pub/linux/devel/binutils/>
OpenSSL OpenSSL
------- -------
o <https://www.openssl.org/>
- <https://www.openssl.org/>
System utilities System utilities
**************** ****************
Util-linux Util-linux
---------- ----------
o <ftp://ftp.kernel.org/pub/linux/utils/util-linux/>
- <ftp://ftp.kernel.org/pub/linux/utils/util-linux/>
Ksymoops Ksymoops
-------- --------
o <ftp://ftp.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/>
- <ftp://ftp.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/>
Module-Init-Tools Module-Init-Tools
----------------- -----------------
o <ftp://ftp.kernel.org/pub/linux/kernel/people/rusty/modules/>
- <ftp://ftp.kernel.org/pub/linux/kernel/people/rusty/modules/>
Mkinitrd Mkinitrd
-------- --------
o <https://code.launchpad.net/initrd-tools/main>
- <https://code.launchpad.net/initrd-tools/main>
E2fsprogs E2fsprogs
--------- ---------
o <http://prdownloads.sourceforge.net/e2fsprogs/e2fsprogs-1.29.tar.gz>
- <http://prdownloads.sourceforge.net/e2fsprogs/e2fsprogs-1.29.tar.gz>
JFSutils JFSutils
-------- --------
o <http://jfs.sourceforge.net/>
- <http://jfs.sourceforge.net/>
Reiserfsprogs Reiserfsprogs
------------- -------------
o <http://www.kernel.org/pub/linux/utils/fs/reiserfs/>
- <http://www.kernel.org/pub/linux/utils/fs/reiserfs/>
Xfsprogs Xfsprogs
-------- --------
o <ftp://oss.sgi.com/projects/xfs/>
- <ftp://oss.sgi.com/projects/xfs/>
Pcmciautils Pcmciautils
----------- -----------
o <ftp://ftp.kernel.org/pub/linux/utils/kernel/pcmcia/>
- <ftp://ftp.kernel.org/pub/linux/utils/kernel/pcmcia/>
Quota-tools Quota-tools
---------- -----------
o <http://sourceforge.net/projects/linuxquota/>
- <http://sourceforge.net/projects/linuxquota/>
DocBook Stylesheets DocBook Stylesheets
------------------- -------------------
o <http://sourceforge.net/projects/docbook/files/docbook-dsssl/>
- <http://sourceforge.net/projects/docbook/files/docbook-dsssl/>
XMLTO XSLT Frontend XMLTO XSLT Frontend
------------------- -------------------
o <http://cyberelk.net/tim/xmlto/>
- <http://cyberelk.net/tim/xmlto/>
Intel P6 microcode Intel P6 microcode
------------------ ------------------
o <https://downloadcenter.intel.com/>
- <https://downloadcenter.intel.com/>
udev udev
---- ----
o <http://www.freedesktop.org/software/systemd/man/udev.html>
- <http://www.freedesktop.org/software/systemd/man/udev.html>
FUSE FUSE
---- ----
o <http://sourceforge.net/projects/fuse>
- <http://sourceforge.net/projects/fuse>
mcelog mcelog
------ ------
o <http://www.mcelog.org/>
- <http://www.mcelog.org/>
Networking Networking
********** **********
PPP PPP
--- ---
o <ftp://ftp.samba.org/pub/ppp/>
- <ftp://ftp.samba.org/pub/ppp/>
Isdn4k-utils Isdn4k-utils
------------ ------------
o <ftp://ftp.isdn4linux.de/pub/isdn4linux/utils/>
- <ftp://ftp.isdn4linux.de/pub/isdn4linux/utils/>
NFS-utils NFS-utils
--------- ---------
o <http://sourceforge.net/project/showfiles.php?group_id=14>
- <http://sourceforge.net/project/showfiles.php?group_id=14>
Iptables Iptables
-------- --------
o <http://www.iptables.org/downloads.html>
- <http://www.iptables.org/downloads.html>
Ip-route2 Ip-route2
--------- ---------
o <https://www.kernel.org/pub/linux/utils/net/iproute2/>
- <https://www.kernel.org/pub/linux/utils/net/iproute2/>
OProfile OProfile
-------- --------
o <http://oprofile.sf.net/download/>
- <http://oprofile.sf.net/download/>
NFS-Utils NFS-Utils
--------- ---------
o <http://nfs.sourceforge.net/>
- <http://nfs.sourceforge.net/>
Kernel documentation
********************
Sphinx
------
- <http://www.sphinx-doc.org/>
...@@ -19,7 +19,7 @@ please contact the Linux Foundation's Technical Advisory Board at ...@@ -19,7 +19,7 @@ please contact the Linux Foundation's Technical Advisory Board at
will work to resolve the issue to the best of their ability. For more will work to resolve the issue to the best of their ability. For more
information on who is on the Technical Advisory Board and what their information on who is on the Technical Advisory Board and what their
role is, please see: role is, please see:
http://www.linuxfoundation.org/programs/advisory-councils/tab http://www.linuxfoundation.org/projects/linux/tab
As a reviewer of code, please strive to keep things civil and focused on As a reviewer of code, please strive to keep things civil and focused on
the technical issues involved. We are all humans, and frustrations can the technical issues involved. We are all humans, and frustrations can
......
此差异已折叠。
...@@ -699,7 +699,7 @@ to use the dma_sync_*() interfaces. ...@@ -699,7 +699,7 @@ to use the dma_sync_*() interfaces.
dma_addr_t mapping; dma_addr_t mapping;
mapping = dma_map_single(cp->dev, buffer, len, DMA_FROM_DEVICE); mapping = dma_map_single(cp->dev, buffer, len, DMA_FROM_DEVICE);
if (dma_mapping_error(cp->dev, dma_handle)) { if (dma_mapping_error(cp->dev, mapping)) {
/* /*
* reduce current DMA mapping usage, * reduce current DMA mapping usage,
* delay and try again later or * delay and try again later or
...@@ -931,10 +931,8 @@ to "Closing". ...@@ -931,10 +931,8 @@ to "Closing".
1) Struct scatterlist requirements. 1) Struct scatterlist requirements.
Don't invent the architecture specific struct scatterlist; just use You need to enable CONFIG_NEED_SG_DMA_LENGTH if the architecture
<asm-generic/scatterlist.h>. You need to enable supports IOMMUs (including software IOMMU).
CONFIG_NEED_SG_DMA_LENGTH if the architecture supports IOMMUs
(including software IOMMU).
2) ARCH_DMA_MINALIGN 2) ARCH_DMA_MINALIGN
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# To add a new book the only step required is to add the book to the # To add a new book the only step required is to add the book to the
# list of DOCBOOKS. # list of DOCBOOKS.
DOCBOOKS := z8530book.xml device-drivers.xml \ DOCBOOKS := z8530book.xml \
kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ kernel-hacking.xml kernel-locking.xml deviceiobook.xml \
writing_usb_driver.xml networking.xml \ writing_usb_driver.xml networking.xml \
kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \ kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \
...@@ -22,9 +22,15 @@ ifeq ($(DOCBOOKS),) ...@@ -22,9 +22,15 @@ ifeq ($(DOCBOOKS),)
# Skip DocBook build if the user explicitly requested no DOCBOOKS. # Skip DocBook build if the user explicitly requested no DOCBOOKS.
.DEFAULT: .DEFAULT:
@echo " SKIP DocBook $@ target (DOCBOOKS=\"\" specified)." @echo " SKIP DocBook $@ target (DOCBOOKS=\"\" specified)."
else
ifneq ($(SPHINXDIRS),)
# Skip DocBook build if the user explicitly requested a sphinx dir
.DEFAULT:
@echo " SKIP DocBook $@ target (SPHINXDIRS specified)."
else else
### ###
# The build process is as follows (targets): # The build process is as follows (targets):
# (xmldocs) [by docproc] # (xmldocs) [by docproc]
...@@ -66,6 +72,7 @@ installmandocs: mandocs ...@@ -66,6 +72,7 @@ installmandocs: mandocs
# no-op for the DocBook toolchain # no-op for the DocBook toolchain
epubdocs: epubdocs:
latexdocs:
### ###
#External programs used #External programs used
...@@ -221,6 +228,7 @@ silent_gen_xml = : ...@@ -221,6 +228,7 @@ silent_gen_xml = :
echo "</programlisting>") > $@ echo "</programlisting>") > $@
endif # DOCBOOKS="" endif # DOCBOOKS=""
endif # SPHINDIR=...
### ###
# Help targets as used by the top-level makefile # Help targets as used by the top-level makefile
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
<book id="LinuxDriversAPI">
<bookinfo>
<title>Linux Device Drivers</title>
<legalnotice>
<para>
This documentation is free software; you can redistribute
it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later
version.
</para>
<para>
This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
</para>
<para>
You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
</para>
<para>
For more details see the file COPYING in the source
distribution of Linux.
</para>
</legalnotice>
</bookinfo>
<toc></toc>
<chapter id="Basics">
<title>Driver Basics</title>
<sect1><title>Driver Entry and Exit points</title>
!Iinclude/linux/init.h
</sect1>
<sect1><title>Atomic and pointer manipulation</title>
!Iarch/x86/include/asm/atomic.h
</sect1>
<sect1><title>Delaying, scheduling, and timer routines</title>
!Iinclude/linux/sched.h
!Ekernel/sched/core.c
!Ikernel/sched/cpupri.c
!Ikernel/sched/fair.c
!Iinclude/linux/completion.h
!Ekernel/time/timer.c
</sect1>
<sect1><title>Wait queues and Wake events</title>
!Iinclude/linux/wait.h
!Ekernel/sched/wait.c
</sect1>
<sect1><title>High-resolution timers</title>
!Iinclude/linux/ktime.h
!Iinclude/linux/hrtimer.h
!Ekernel/time/hrtimer.c
</sect1>
<sect1><title>Workqueues and Kevents</title>
!Iinclude/linux/workqueue.h
!Ekernel/workqueue.c
</sect1>
<sect1><title>Internal Functions</title>
!Ikernel/exit.c
!Ikernel/signal.c
!Iinclude/linux/kthread.h
!Ekernel/kthread.c
</sect1>
<sect1><title>Kernel objects manipulation</title>
<!--
X!Iinclude/linux/kobject.h
-->
!Elib/kobject.c
</sect1>
<sect1><title>Kernel utility functions</title>
!Iinclude/linux/kernel.h
!Ekernel/printk/printk.c
!Ekernel/panic.c
!Ekernel/sys.c
!Ekernel/rcu/srcu.c
!Ekernel/rcu/tree.c
!Ekernel/rcu/tree_plugin.h
!Ekernel/rcu/update.c
</sect1>
<sect1><title>Device Resource Management</title>
!Edrivers/base/devres.c
</sect1>
</chapter>
<chapter id="devdrivers">
<title>Device drivers infrastructure</title>
<sect1><title>The Basic Device Driver-Model Structures </title>
!Iinclude/linux/device.h
</sect1>
<sect1><title>Device Drivers Base</title>
!Idrivers/base/init.c
!Edrivers/base/driver.c
!Edrivers/base/core.c
!Edrivers/base/syscore.c
!Edrivers/base/class.c
!Idrivers/base/node.c
!Edrivers/base/firmware_class.c
!Edrivers/base/transport_class.c
<!-- Cannot be included, because
attribute_container_add_class_device_adapter
and attribute_container_classdev_to_container
exceed allowed 44 characters maximum
X!Edrivers/base/attribute_container.c
-->
!Edrivers/base/dd.c
<!--
X!Edrivers/base/interface.c
-->
!Iinclude/linux/platform_device.h
!Edrivers/base/platform.c
!Edrivers/base/bus.c
</sect1>
<sect1>
<title>Buffer Sharing and Synchronization</title>
<para>
The dma-buf subsystem provides the framework for sharing buffers
for hardware (DMA) access across multiple device drivers and
subsystems, and for synchronizing asynchronous hardware access.
</para>
<para>
This is used, for example, by drm "prime" multi-GPU support, but
is of course not limited to GPU use cases.
</para>
<para>
The three main components of this are: (1) dma-buf, representing
a sg_table and exposed to userspace as a file descriptor to allow
passing between devices, (2) fence, which provides a mechanism
to signal when one device as finished access, and (3) reservation,
which manages the shared or exclusive fence(s) associated with
the buffer.
</para>
<sect2><title>dma-buf</title>
!Edrivers/dma-buf/dma-buf.c
!Iinclude/linux/dma-buf.h
</sect2>
<sect2><title>reservation</title>
!Pdrivers/dma-buf/reservation.c Reservation Object Overview
!Edrivers/dma-buf/reservation.c
!Iinclude/linux/reservation.h
</sect2>
<sect2><title>fence</title>
!Edrivers/dma-buf/fence.c
!Iinclude/linux/fence.h
!Edrivers/dma-buf/seqno-fence.c
!Iinclude/linux/seqno-fence.h
!Edrivers/dma-buf/fence-array.c
!Iinclude/linux/fence-array.h
!Edrivers/dma-buf/reservation.c
!Iinclude/linux/reservation.h
!Edrivers/dma-buf/sync_file.c
!Iinclude/linux/sync_file.h
</sect2>
</sect1>
<sect1><title>Device Drivers DMA Management</title>
!Edrivers/base/dma-coherent.c
!Edrivers/base/dma-mapping.c
</sect1>
<sect1><title>Device Drivers Power Management</title>
!Edrivers/base/power/main.c
</sect1>
<sect1><title>Device Drivers ACPI Support</title>
<!-- Internal functions only
X!Edrivers/acpi/sleep/main.c
X!Edrivers/acpi/sleep/wakeup.c
X!Edrivers/acpi/motherboard.c
X!Edrivers/acpi/bus.c
-->
!Edrivers/acpi/scan.c
!Idrivers/acpi/scan.c
<!-- No correct structured comments
X!Edrivers/acpi/pci_bind.c
-->
</sect1>
<sect1><title>Device drivers PnP support</title>
!Idrivers/pnp/core.c
<!-- No correct structured comments
X!Edrivers/pnp/system.c
-->
!Edrivers/pnp/card.c
!Idrivers/pnp/driver.c
!Edrivers/pnp/manager.c
!Edrivers/pnp/support.c
</sect1>
<sect1><title>Userspace IO devices</title>
!Edrivers/uio/uio.c
!Iinclude/linux/uio_driver.h
</sect1>
</chapter>
<chapter id="parportdev">
<title>Parallel Port Devices</title>
!Iinclude/linux/parport.h
!Edrivers/parport/ieee1284.c
!Edrivers/parport/share.c
!Idrivers/parport/daisy.c
</chapter>
<chapter id="message_devices">
<title>Message-based devices</title>
<sect1><title>Fusion message devices</title>
!Edrivers/message/fusion/mptbase.c
!Idrivers/message/fusion/mptbase.c
!Edrivers/message/fusion/mptscsih.c
!Idrivers/message/fusion/mptscsih.c
!Idrivers/message/fusion/mptctl.c
!Idrivers/message/fusion/mptspi.c
!Idrivers/message/fusion/mptfc.c
!Idrivers/message/fusion/mptlan.c
</sect1>
</chapter>
<chapter id="snddev">
<title>Sound Devices</title>
!Iinclude/sound/core.h
!Esound/sound_core.c
!Iinclude/sound/pcm.h
!Esound/core/pcm.c
!Esound/core/device.c
!Esound/core/info.c
!Esound/core/rawmidi.c
!Esound/core/sound.c
!Esound/core/memory.c
!Esound/core/pcm_memory.c
!Esound/core/init.c
!Esound/core/isadma.c
!Esound/core/control.c
!Esound/core/pcm_lib.c
!Esound/core/hwdep.c
!Esound/core/pcm_native.c
!Esound/core/memalloc.c
<!-- FIXME: Removed for now since no structured comments in source
X!Isound/sound_firmware.c
-->
</chapter>
<chapter id="uart16x50">
<title>16x50 UART Driver</title>
!Edrivers/tty/serial/serial_core.c
!Edrivers/tty/serial/8250/8250_core.c
</chapter>
<chapter id="fbdev">
<title>Frame Buffer Library</title>
<para>
The frame buffer drivers depend heavily on four data structures.
These structures are declared in include/linux/fb.h. They are
fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
The last three can be made available to and from userland.
</para>
<para>
fb_info defines the current state of a particular video card.
Inside fb_info, there exists a fb_ops structure which is a
collection of needed functions to make fbdev and fbcon work.
fb_info is only visible to the kernel.
</para>
<para>
fb_var_screeninfo is used to describe the features of a video card
that are user defined. With fb_var_screeninfo, things such as
depth and the resolution may be defined.
</para>
<para>
The next structure is fb_fix_screeninfo. This defines the
properties of a card that are created when a mode is set and can't
be changed otherwise. A good example of this is the start of the
frame buffer memory. This "locks" the address of the frame buffer
memory, so that it cannot be changed or moved.
</para>
<para>
The last structure is fb_monospecs. In the old API, there was
little importance for fb_monospecs. This allowed for forbidden things
such as setting a mode of 800x600 on a fix frequency monitor. With
the new API, fb_monospecs prevents such things, and if used
correctly, can prevent a monitor from being cooked. fb_monospecs
will not be useful until kernels 2.5.x.
</para>
<sect1><title>Frame Buffer Memory</title>
!Edrivers/video/fbdev/core/fbmem.c
</sect1>
<!--
<sect1><title>Frame Buffer Console</title>
X!Edrivers/video/console/fbcon.c
</sect1>
-->
<sect1><title>Frame Buffer Colormap</title>
!Edrivers/video/fbdev/core/fbcmap.c
</sect1>
<!-- FIXME:
drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment
out until somebody adds docs. KAO
<sect1><title>Frame Buffer Generic Functions</title>
X!Idrivers/video/fbgen.c
</sect1>
KAO -->
<sect1><title>Frame Buffer Video Mode Database</title>
!Idrivers/video/fbdev/core/modedb.c
!Edrivers/video/fbdev/core/modedb.c
</sect1>
<sect1><title>Frame Buffer Macintosh Video Mode Database</title>
!Edrivers/video/fbdev/macmodes.c
</sect1>
<sect1><title>Frame Buffer Fonts</title>
<para>
Refer to the file lib/fonts/fonts.c for more information.
</para>
<!-- FIXME: Removed for now since no structured comments in source
X!Ilib/fonts/fonts.c
-->
</sect1>
</chapter>
<chapter id="input_subsystem">
<title>Input Subsystem</title>
<sect1><title>Input core</title>
!Iinclude/linux/input.h
!Edrivers/input/input.c
!Edrivers/input/ff-core.c
!Edrivers/input/ff-memless.c
</sect1>
<sect1><title>Multitouch Library</title>
!Iinclude/linux/input/mt.h
!Edrivers/input/input-mt.c
</sect1>
<sect1><title>Polled input devices</title>
!Iinclude/linux/input-polldev.h
!Edrivers/input/input-polldev.c
</sect1>
<sect1><title>Matrix keyboards/keypads</title>
!Iinclude/linux/input/matrix_keypad.h
</sect1>
<sect1><title>Sparse keymap support</title>
!Iinclude/linux/input/sparse-keymap.h
!Edrivers/input/sparse-keymap.c
</sect1>
</chapter>
<chapter id="spi">
<title>Serial Peripheral Interface (SPI)</title>
<para>
SPI is the "Serial Peripheral Interface", widely used with
embedded systems because it is a simple and efficient
interface: basically a multiplexed shift register.
Its three signal wires hold a clock (SCK, often in the range
of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and
a "Master In, Slave Out" (MISO) data line.
SPI is a full duplex protocol; for each bit shifted out the
MOSI line (one per clock) another is shifted in on the MISO line.
Those bits are assembled into words of various sizes on the
way to and from system memory.
An additional chipselect line is usually active-low (nCS);
four signals are normally used for each peripheral, plus
sometimes an interrupt.
</para>
<para>
The SPI bus facilities listed here provide a generalized
interface to declare SPI busses and devices, manage them
according to the standard Linux driver model, and perform
input/output operations.
At this time, only "master" side interfaces are supported,
where Linux talks to SPI peripherals and does not implement
such a peripheral itself.
(Interfaces to support implementing SPI slaves would
necessarily look different.)
</para>
<para>
The programming interface is structured around two kinds of driver,
and two kinds of device.
A "Controller Driver" abstracts the controller hardware, which may
be as simple as a set of GPIO pins or as complex as a pair of FIFOs
connected to dual DMA engines on the other side of the SPI shift
register (maximizing throughput). Such drivers bridge between
whatever bus they sit on (often the platform bus) and SPI, and
expose the SPI side of their device as a
<structname>struct spi_master</structname>.
SPI devices are children of that master, represented as a
<structname>struct spi_device</structname> and manufactured from
<structname>struct spi_board_info</structname> descriptors which
are usually provided by board-specific initialization code.
A <structname>struct spi_driver</structname> is called a
"Protocol Driver", and is bound to a spi_device using normal
driver model calls.
</para>
<para>
The I/O model is a set of queued messages. Protocol drivers
submit one or more <structname>struct spi_message</structname>
objects, which are processed and completed asynchronously.
(There are synchronous wrappers, however.) Messages are
built from one or more <structname>struct spi_transfer</structname>
objects, each of which wraps a full duplex SPI transfer.
A variety of protocol tweaking options are needed, because
different chips adopt very different policies for how they
use the bits transferred with SPI.
</para>
!Iinclude/linux/spi/spi.h
!Fdrivers/spi/spi.c spi_register_board_info
!Edrivers/spi/spi.c
</chapter>
<chapter id="i2c">
<title>I<superscript>2</superscript>C and SMBus Subsystem</title>
<para>
I<superscript>2</superscript>C (or without fancy typography, "I2C")
is an acronym for the "Inter-IC" bus, a simple bus protocol which is
widely used where low data rate communications suffice.
Since it's also a licensed trademark, some vendors use another
name (such as "Two-Wire Interface", TWI) for the same bus.
I2C only needs two signals (SCL for clock, SDA for data), conserving
board real estate and minimizing signal quality issues.
Most I2C devices use seven bit addresses, and bus speeds of up
to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet
found wide use.
I2C is a multi-master bus; open drain signaling is used to
arbitrate between masters, as well as to handshake and to
synchronize clocks from slower clients.
</para>
<para>
The Linux I2C programming interfaces support only the master
side of bus interactions, not the slave side.
The programming interface is structured around two kinds of driver,
and two kinds of device.
An I2C "Adapter Driver" abstracts the controller hardware; it binds
to a physical device (perhaps a PCI device or platform_device) and
exposes a <structname>struct i2c_adapter</structname> representing
each I2C bus segment it manages.
On each I2C bus segment will be I2C devices represented by a
<structname>struct i2c_client</structname>. Those devices will
be bound to a <structname>struct i2c_driver</structname>,
which should follow the standard Linux driver model.
(At this writing, a legacy model is more widely used.)
There are functions to perform various I2C protocol operations; at
this writing all such functions are usable only from task context.
</para>
<para>
The System Management Bus (SMBus) is a sibling protocol. Most SMBus
systems are also I2C conformant. The electrical constraints are
tighter for SMBus, and it standardizes particular protocol messages
and idioms. Controllers that support I2C can also support most
SMBus operations, but SMBus controllers don't support all the protocol
options that an I2C controller will.
There are functions to perform various SMBus protocol operations,
either using I2C primitives or by issuing SMBus commands to
i2c_adapter devices which don't support those I2C operations.
</para>
!Iinclude/linux/i2c.h
!Fdrivers/i2c/i2c-boardinfo.c i2c_register_board_info
!Edrivers/i2c/i2c-core.c
</chapter>
<chapter id="hsi">
<title>High Speed Synchronous Serial Interface (HSI)</title>
<para>
High Speed Synchronous Serial Interface (HSI) is a
serial interface mainly used for connecting application
engines (APE) with cellular modem engines (CMT) in cellular
handsets.
HSI provides multiplexing for up to 16 logical channels,
low-latency and full duplex communication.
</para>
!Iinclude/linux/hsi/hsi.h
!Edrivers/hsi/hsi_core.c
</chapter>
<chapter id="pwm">
<title>Pulse-Width Modulation (PWM)</title>
<para>
Pulse-width modulation is a modulation technique primarily used to
control power supplied to electrical devices.
</para>
<para>
The PWM framework provides an abstraction for providers and consumers
of PWM signals. A controller that provides one or more PWM signals is
registered as <structname>struct pwm_chip</structname>. Providers are
expected to embed this structure in a driver-specific structure. This
structure contains fields that describe a particular chip.
</para>
<para>
A chip exposes one or more PWM signal sources, each of which exposed
as a <structname>struct pwm_device</structname>. Operations can be
performed on PWM devices to control the period, duty cycle, polarity
and active state of the signal.
</para>
<para>
Note that PWM devices are exclusive resources: they can always only be
used by one consumer at a time.
</para>
!Iinclude/linux/pwm.h
!Edrivers/pwm/core.c
</chapter>
</book>
HOWTO do Linux kernel development HOWTO do Linux kernel development
--------------------------------- =================================
This is the be-all, end-all document on this topic. It contains This is the be-all, end-all document on this topic. It contains
instructions on how to become a Linux kernel developer and how to learn instructions on how to become a Linux kernel developer and how to learn
...@@ -28,6 +28,7 @@ kernel development. Assembly (any architecture) is not required unless ...@@ -28,6 +28,7 @@ kernel development. Assembly (any architecture) is not required unless
you plan to do low-level development for that architecture. Though they you plan to do low-level development for that architecture. Though they
are not a good substitute for a solid C education and/or years of are not a good substitute for a solid C education and/or years of
experience, the following books are good for, if anything, reference: experience, the following books are good for, if anything, reference:
- "The C Programming Language" by Kernighan and Ritchie [Prentice Hall] - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall]
- "Practical C Programming" by Steve Oualline [O'Reilly] - "Practical C Programming" by Steve Oualline [O'Reilly]
- "C: A Reference Manual" by Harbison and Steele [Prentice Hall] - "C: A Reference Manual" by Harbison and Steele [Prentice Hall]
...@@ -64,7 +65,8 @@ people on the mailing lists are not lawyers, and you should not rely on ...@@ -64,7 +65,8 @@ people on the mailing lists are not lawyers, and you should not rely on
their statements on legal matters. their statements on legal matters.
For common questions and answers about the GPL, please see: For common questions and answers about the GPL, please see:
http://www.gnu.org/licenses/gpl-faq.html
https://www.gnu.org/licenses/gpl-faq.html
Documentation Documentation
...@@ -82,96 +84,118 @@ linux-api@vger.kernel.org. ...@@ -82,96 +84,118 @@ linux-api@vger.kernel.org.
Here is a list of files that are in the kernel source tree that are Here is a list of files that are in the kernel source tree that are
required reading: required reading:
README README
This file gives a short background on the Linux kernel and describes This file gives a short background on the Linux kernel and describes
what is necessary to do to configure and build the kernel. People what is necessary to do to configure and build the kernel. People
who are new to the kernel should start here. who are new to the kernel should start here.
Documentation/Changes :ref:`Documentation/Changes <changes>`
This file gives a list of the minimum levels of various software This file gives a list of the minimum levels of various software
packages that are necessary to build and run the kernel packages that are necessary to build and run the kernel
successfully. successfully.
Documentation/CodingStyle :ref:`Documentation/CodingStyle <codingstyle>`
This describes the Linux kernel coding style, and some of the This describes the Linux kernel coding style, and some of the
rationale behind it. All new code is expected to follow the rationale behind it. All new code is expected to follow the
guidelines in this document. Most maintainers will only accept guidelines in this document. Most maintainers will only accept
patches if these rules are followed, and many people will only patches if these rules are followed, and many people will only
review code if it is in the proper style. review code if it is in the proper style.
Documentation/SubmittingPatches :ref:`Documentation/SubmittingPatches <submittingpatches>` and :ref:`Documentation/SubmittingDrivers <submittingdrivers>`
Documentation/SubmittingDrivers
These files describe in explicit detail how to successfully create These files describe in explicit detail how to successfully create
and send a patch, including (but not limited to): and send a patch, including (but not limited to):
- Email contents - Email contents
- Email format - Email format
- Who to send it to - Who to send it to
Following these rules will not guarantee success (as all patches are Following these rules will not guarantee success (as all patches are
subject to scrutiny for content and style), but not following them subject to scrutiny for content and style), but not following them
will almost always prevent it. will almost always prevent it.
Other excellent descriptions of how to create patches properly are: Other excellent descriptions of how to create patches properly are:
"The Perfect Patch" "The Perfect Patch"
http://www.ozlabs.org/~akpm/stuff/tpp.txt https://www.ozlabs.org/~akpm/stuff/tpp.txt
"Linux kernel patch submission format" "Linux kernel patch submission format"
http://linux.yyz.us/patch-format.html http://linux.yyz.us/patch-format.html
Documentation/stable_api_nonsense.txt :ref:`Documentation/stable_api_nonsense.txt <stable_api_nonsense>`
This file describes the rationale behind the conscious decision to This file describes the rationale behind the conscious decision to
not have a stable API within the kernel, including things like: not have a stable API within the kernel, including things like:
- Subsystem shim-layers (for compatibility?) - Subsystem shim-layers (for compatibility?)
- Driver portability between Operating Systems. - Driver portability between Operating Systems.
- Mitigating rapid change within the kernel source tree (or - Mitigating rapid change within the kernel source tree (or
preventing rapid change) preventing rapid change)
This document is crucial for understanding the Linux development This document is crucial for understanding the Linux development
philosophy and is very important for people moving to Linux from philosophy and is very important for people moving to Linux from
development on other Operating Systems. development on other Operating Systems.
Documentation/SecurityBugs :ref:`Documentation/SecurityBugs <securitybugs>`
If you feel you have found a security problem in the Linux kernel, If you feel you have found a security problem in the Linux kernel,
please follow the steps in this document to help notify the kernel please follow the steps in this document to help notify the kernel
developers, and help solve the issue. developers, and help solve the issue.
Documentation/ManagementStyle :ref:`Documentation/ManagementStyle <managementstyle>`
This document describes how Linux kernel maintainers operate and the This document describes how Linux kernel maintainers operate and the
shared ethos behind their methodologies. This is important reading shared ethos behind their methodologies. This is important reading
for anyone new to kernel development (or anyone simply curious about for anyone new to kernel development (or anyone simply curious about
it), as it resolves a lot of common misconceptions and confusion it), as it resolves a lot of common misconceptions and confusion
about the unique behavior of kernel maintainers. about the unique behavior of kernel maintainers.
Documentation/stable_kernel_rules.txt :ref:`Documentation/stable_kernel_rules.txt <stable_kernel_rules>`
This file describes the rules on how the stable kernel releases This file describes the rules on how the stable kernel releases
happen, and what to do if you want to get a change into one of these happen, and what to do if you want to get a change into one of these
releases. releases.
Documentation/kernel-docs.txt :ref:`Documentation/kernel-docs.txt <kernel_docs>`
A list of external documentation that pertains to kernel A list of external documentation that pertains to kernel
development. Please consult this list if you do not find what you development. Please consult this list if you do not find what you
are looking for within the in-kernel documentation. are looking for within the in-kernel documentation.
Documentation/applying-patches.txt :ref:`Documentation/applying-patches.txt <applying_patches>`
A good introduction describing exactly what a patch is and how to A good introduction describing exactly what a patch is and how to
apply it to the different development branches of the kernel. apply it to the different development branches of the kernel.
The kernel also has a large number of documents that can be The kernel also has a large number of documents that can be
automatically generated from the source code itself. This includes a automatically generated from the source code itself or from
ReStructuredText markups (ReST), like this one. This includes a
full description of the in-kernel API, and rules on how to handle full description of the in-kernel API, and rules on how to handle
locking properly. The documents will be created in the locking properly.
Documentation/DocBook/ directory and can be generated as PDF,
Postscript, HTML, and man pages by running: All such documents can be generated as PDF or HTML by running::
make pdfdocs make pdfdocs
make psdocs
make htmldocs make htmldocs
make mandocs
respectively from the main kernel source directory. respectively from the main kernel source directory.
The documents that uses ReST markup will be generated at Documentation/output.
They can also be generated on LaTeX and ePub formats with::
make latexdocs
make epubdocs
Currently, there are some documents written on DocBook that are in
the process of conversion to ReST. Such documents will be created in the
Documentation/DocBook/ directory and can be generated also as
Postscript or man pages by running::
make psdocs
make mandocs
Becoming A Kernel Developer Becoming A Kernel Developer
--------------------------- ---------------------------
If you do not know anything about Linux kernel development, you should If you do not know anything about Linux kernel development, you should
look at the Linux KernelNewbies project: look at the Linux KernelNewbies project:
http://kernelnewbies.org
https://kernelnewbies.org
It consists of a helpful mailing list where you can ask almost any type It consists of a helpful mailing list where you can ask almost any type
of basic kernel development question (make sure to search the archives of basic kernel development question (make sure to search the archives
first, before asking something that has already been answered in the first, before asking something that has already been answered in the
...@@ -187,7 +211,9 @@ apply a patch. ...@@ -187,7 +211,9 @@ apply a patch.
If you do not know where you want to start, but you want to look for If you do not know where you want to start, but you want to look for
some task to start doing to join into the kernel development community, some task to start doing to join into the kernel development community,
go to the Linux Kernel Janitor's project: go to the Linux Kernel Janitor's project:
http://kernelnewbies.org/KernelJanitors
https://kernelnewbies.org/KernelJanitors
It is a great place to start. It describes a list of relatively simple It is a great place to start. It describes a list of relatively simple
problems that need to be cleaned up and fixed within the Linux kernel problems that need to be cleaned up and fixed within the Linux kernel
source tree. Working with the developers in charge of this project, you source tree. Working with the developers in charge of this project, you
...@@ -199,7 +225,8 @@ If you already have a chunk of code that you want to put into the kernel ...@@ -199,7 +225,8 @@ If you already have a chunk of code that you want to put into the kernel
tree, but need some help getting it in the proper form, the tree, but need some help getting it in the proper form, the
kernel-mentors project was created to help you out with this. It is a kernel-mentors project was created to help you out with this. It is a
mailing list, and can be found at: mailing list, and can be found at:
http://selenic.com/mailman/listinfo/kernel-mentors
https://selenic.com/mailman/listinfo/kernel-mentors
Before making any actual modifications to the Linux kernel code, it is Before making any actual modifications to the Linux kernel code, it is
imperative to understand how the code in question works. For this imperative to understand how the code in question works. For this
...@@ -209,6 +236,7 @@ tools. One such tool that is particularly recommended is the Linux ...@@ -209,6 +236,7 @@ tools. One such tool that is particularly recommended is the Linux
Cross-Reference project, which is able to present source code in a Cross-Reference project, which is able to present source code in a
self-referential, indexed webpage format. An excellent up-to-date self-referential, indexed webpage format. An excellent up-to-date
repository of the kernel code may be found at: repository of the kernel code may be found at:
http://lxr.free-electrons.com/ http://lxr.free-electrons.com/
...@@ -218,6 +246,7 @@ The development process ...@@ -218,6 +246,7 @@ The development process
Linux kernel development process currently consists of a few different Linux kernel development process currently consists of a few different
main kernel "branches" and lots of different subsystem-specific kernel main kernel "branches" and lots of different subsystem-specific kernel
branches. These different branches are: branches. These different branches are:
- main 4.x kernel tree - main 4.x kernel tree
- 4.x.y -stable kernel tree - 4.x.y -stable kernel tree
- 4.x -git kernel patches - 4.x -git kernel patches
...@@ -227,14 +256,15 @@ branches. These different branches are: ...@@ -227,14 +256,15 @@ branches. These different branches are:
4.x kernel tree 4.x kernel tree
----------------- -----------------
4.x kernels are maintained by Linus Torvalds, and can be found on 4.x kernels are maintained by Linus Torvalds, and can be found on
kernel.org in the pub/linux/kernel/v4.x/ directory. Its development https://kernel.org in the pub/linux/kernel/v4.x/ directory. Its development
process is as follows: process is as follows:
- As soon as a new kernel is released a two weeks window is open, - As soon as a new kernel is released a two weeks window is open,
during this period of time maintainers can submit big diffs to during this period of time maintainers can submit big diffs to
Linus, usually the patches that have already been included in the Linus, usually the patches that have already been included in the
-next kernel for a few weeks. The preferred way to submit big changes -next kernel for a few weeks. The preferred way to submit big changes
is using git (the kernel's source management tool, more information is using git (the kernel's source management tool, more information
can be found at http://git-scm.com/) but plain patches are also just can be found at https://git-scm.com/) but plain patches are also just
fine. fine.
- After two weeks a -rc1 kernel is released it is now possible to push - After two weeks a -rc1 kernel is released it is now possible to push
only patches that do not include new features that could affect the only patches that do not include new features that could affect the
...@@ -253,9 +283,10 @@ process is as follows: ...@@ -253,9 +283,10 @@ process is as follows:
It is worth mentioning what Andrew Morton wrote on the linux-kernel It is worth mentioning what Andrew Morton wrote on the linux-kernel
mailing list about kernel releases: mailing list about kernel releases:
"Nobody knows when a kernel will be released, because it's
*"Nobody knows when a kernel will be released, because it's
released according to perceived bug status, not according to a released according to perceived bug status, not according to a
preconceived timeline." preconceived timeline."*
4.x.y -stable kernel tree 4.x.y -stable kernel tree
------------------------- -------------------------
...@@ -301,7 +332,7 @@ submission and other already ongoing work are avoided. ...@@ -301,7 +332,7 @@ submission and other already ongoing work are avoided.
Most of these repositories are git trees, but there are also other SCMs Most of these repositories are git trees, but there are also other SCMs
in use, or patch queues being published as quilt series. Addresses of in use, or patch queues being published as quilt series. Addresses of
these subsystem repositories are listed in the MAINTAINERS file. Many these subsystem repositories are listed in the MAINTAINERS file. Many
of them can be browsed at http://git.kernel.org/. of them can be browsed at https://git.kernel.org/.
Before a proposed patch is committed to such a subsystem tree, it is Before a proposed patch is committed to such a subsystem tree, it is
subject to review which primarily happens on mailing lists (see the subject to review which primarily happens on mailing lists (see the
...@@ -310,7 +341,7 @@ process is tracked with the tool patchwork. Patchwork offers a web ...@@ -310,7 +341,7 @@ process is tracked with the tool patchwork. Patchwork offers a web
interface which shows patch postings, any comments on a patch or interface which shows patch postings, any comments on a patch or
revisions to it, and maintainers can mark patches as under review, revisions to it, and maintainers can mark patches as under review,
accepted, or rejected. Most of these patchwork sites are listed at accepted, or rejected. Most of these patchwork sites are listed at
http://patchwork.kernel.org/. https://patchwork.kernel.org/.
4.x -next kernel tree for integration tests 4.x -next kernel tree for integration tests
------------------------------------------- -------------------------------------------
...@@ -318,7 +349,8 @@ Before updates from subsystem trees are merged into the mainline 4.x ...@@ -318,7 +349,8 @@ Before updates from subsystem trees are merged into the mainline 4.x
tree, they need to be integration-tested. For this purpose, a special tree, they need to be integration-tested. For this purpose, a special
testing repository exists into which virtually all subsystem trees are testing repository exists into which virtually all subsystem trees are
pulled on an almost daily basis: pulled on an almost daily basis:
http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git
https://git.kernel.org/?p=linux/kernel/git/next/linux-next.git
This way, the -next kernel gives a summary outlook onto what will be This way, the -next kernel gives a summary outlook onto what will be
expected to go into the mainline kernel at the next merge period. expected to go into the mainline kernel at the next merge period.
...@@ -328,10 +360,11 @@ Adventurous testers are very welcome to runtime-test the -next kernel. ...@@ -328,10 +360,11 @@ Adventurous testers are very welcome to runtime-test the -next kernel.
Bug Reporting Bug Reporting
------------- -------------
bugzilla.kernel.org is where the Linux kernel developers track kernel https://bugzilla.kernel.org is where the Linux kernel developers track kernel
bugs. Users are encouraged to report all bugs that they find in this bugs. Users are encouraged to report all bugs that they find in this
tool. For details on how to use the kernel bugzilla, please see: tool. For details on how to use the kernel bugzilla, please see:
http://bugzilla.kernel.org/page.cgi?id=faq.html
https://bugzilla.kernel.org/page.cgi?id=faq.html
The file REPORTING-BUGS in the main kernel source directory has a good The file REPORTING-BUGS in the main kernel source directory has a good
template for how to report a possible kernel bug, and details what kind template for how to report a possible kernel bug, and details what kind
...@@ -349,13 +382,14 @@ your skills, and other developers will be aware of your presence. Fixing ...@@ -349,13 +382,14 @@ your skills, and other developers will be aware of your presence. Fixing
bugs is one of the best ways to get merits among other developers, because bugs is one of the best ways to get merits among other developers, because
not many people like wasting time fixing other people's bugs. not many people like wasting time fixing other people's bugs.
To work in the already reported bug reports, go to http://bugzilla.kernel.org. To work in the already reported bug reports, go to https://bugzilla.kernel.org.
If you want to be advised of the future bug reports, you can subscribe to the If you want to be advised of the future bug reports, you can subscribe to the
bugme-new mailing list (only new bug reports are mailed here) or to the bugme-new mailing list (only new bug reports are mailed here) or to the
bugme-janitor mailing list (every change in the bugzilla is mailed here) bugme-janitor mailing list (every change in the bugzilla is mailed here)
http://lists.linux-foundation.org/mailman/listinfo/bugme-new https://lists.linux-foundation.org/mailman/listinfo/bugme-new
http://lists.linux-foundation.org/mailman/listinfo/bugme-janitors
https://lists.linux-foundation.org/mailman/listinfo/bugme-janitors
...@@ -365,10 +399,14 @@ Mailing lists ...@@ -365,10 +399,14 @@ Mailing lists
As some of the above documents describe, the majority of the core kernel As some of the above documents describe, the majority of the core kernel
developers participate on the Linux Kernel Mailing list. Details on how developers participate on the Linux Kernel Mailing list. Details on how
to subscribe and unsubscribe from the list can be found at: to subscribe and unsubscribe from the list can be found at:
http://vger.kernel.org/vger-lists.html#linux-kernel http://vger.kernel.org/vger-lists.html#linux-kernel
There are archives of the mailing list on the web in many different There are archives of the mailing list on the web in many different
places. Use a search engine to find these archives. For example: places. Use a search engine to find these archives. For example:
http://dir.gmane.org/gmane.linux.kernel http://dir.gmane.org/gmane.linux.kernel
It is highly recommended that you search the archives about the topic It is highly recommended that you search the archives about the topic
you want to bring up, before you post it to the list. A lot of things you want to bring up, before you post it to the list. A lot of things
already discussed in detail are only recorded at the mailing list already discussed in detail are only recorded at the mailing list
...@@ -381,11 +419,13 @@ groups. ...@@ -381,11 +419,13 @@ groups.
Many of the lists are hosted on kernel.org. Information on them can be Many of the lists are hosted on kernel.org. Information on them can be
found at: found at:
http://vger.kernel.org/vger-lists.html http://vger.kernel.org/vger-lists.html
Please remember to follow good behavioral habits when using the lists. Please remember to follow good behavioral habits when using the lists.
Though a bit cheesy, the following URL has some simple guidelines for Though a bit cheesy, the following URL has some simple guidelines for
interacting with the list (or any list): interacting with the list (or any list):
http://www.albion.com/netiquette/ http://www.albion.com/netiquette/
If multiple people respond to your mail, the CC: list of recipients may If multiple people respond to your mail, the CC: list of recipients may
...@@ -400,13 +440,14 @@ add your statements between the individual quoted sections instead of ...@@ -400,13 +440,14 @@ add your statements between the individual quoted sections instead of
writing at the top of the mail. writing at the top of the mail.
If you add patches to your mail, make sure they are plain readable text If you add patches to your mail, make sure they are plain readable text
as stated in Documentation/SubmittingPatches. Kernel developers don't as stated in Documentation/SubmittingPatches.
want to deal with attachments or compressed patches; they may want Kernel developers don't want to deal with
to comment on individual lines of your patch, which works only that way. attachments or compressed patches; they may want to comment on
Make sure you use a mail program that does not mangle spaces and tab individual lines of your patch, which works only that way. Make sure you
characters. A good first test is to send the mail to yourself and try use a mail program that does not mangle spaces and tab characters. A
to apply your own patch by yourself. If that doesn't work, get your good first test is to send the mail to yourself and try to apply your
mail program fixed or change it until it works. own patch by yourself. If that doesn't work, get your mail program fixed
or change it until it works.
Above all, please remember to show respect to other subscribers. Above all, please remember to show respect to other subscribers.
...@@ -418,6 +459,7 @@ The goal of the kernel community is to provide the best possible kernel ...@@ -418,6 +459,7 @@ The goal of the kernel community is to provide the best possible kernel
there is. When you submit a patch for acceptance, it will be reviewed there is. When you submit a patch for acceptance, it will be reviewed
on its technical merits and those alone. So, what should you be on its technical merits and those alone. So, what should you be
expecting? expecting?
- criticism - criticism
- comments - comments
- requests for change - requests for change
...@@ -432,6 +474,7 @@ If there are no responses to your posting, wait a few days and try ...@@ -432,6 +474,7 @@ If there are no responses to your posting, wait a few days and try
again, sometimes things get lost in the huge volume. again, sometimes things get lost in the huge volume.
What should you not do? What should you not do?
- expect your patch to be accepted without question - expect your patch to be accepted without question
- become defensive - become defensive
- ignore comments - ignore comments
...@@ -445,8 +488,8 @@ Remember, being wrong is acceptable as long as you are willing to work ...@@ -445,8 +488,8 @@ Remember, being wrong is acceptable as long as you are willing to work
toward a solution that is right. toward a solution that is right.
It is normal that the answers to your first patch might simply be a list It is normal that the answers to your first patch might simply be a list
of a dozen things you should correct. This does _not_ imply that your of a dozen things you should correct. This does **not** imply that your
patch will not be accepted, and it is _not_ meant against you patch will not be accepted, and it is **not** meant against you
personally. Simply correct all issues raised against your patch and personally. Simply correct all issues raised against your patch and
resend it. resend it.
...@@ -457,7 +500,9 @@ Differences between the kernel community and corporate structures ...@@ -457,7 +500,9 @@ Differences between the kernel community and corporate structures
The kernel community works differently than most traditional corporate The kernel community works differently than most traditional corporate
development environments. Here are a list of things that you can try to development environments. Here are a list of things that you can try to
do to avoid problems: do to avoid problems:
Good things to say regarding your proposed changes: Good things to say regarding your proposed changes:
- "This solves multiple problems." - "This solves multiple problems."
- "This deletes 2000 lines of code." - "This deletes 2000 lines of code."
- "Here is a patch that explains what I am trying to describe." - "Here is a patch that explains what I am trying to describe."
...@@ -466,6 +511,7 @@ do to avoid problems: ...@@ -466,6 +511,7 @@ do to avoid problems:
- "This increases performance on typical machines..." - "This increases performance on typical machines..."
Bad things you should avoid saying: Bad things you should avoid saying:
- "We did it this way in AIX/ptx/Solaris, so therefore it must be - "We did it this way in AIX/ptx/Solaris, so therefore it must be
good..." good..."
- "I've being doing this for 20 years, so..." - "I've being doing this for 20 years, so..."
...@@ -527,17 +573,18 @@ The reasons for breaking things up are the following: ...@@ -527,17 +573,18 @@ The reasons for breaking things up are the following:
and simplify (or simply re-order) patches before submitting them. and simplify (or simply re-order) patches before submitting them.
Here is an analogy from kernel developer Al Viro: Here is an analogy from kernel developer Al Viro:
"Think of a teacher grading homework from a math student. The
*"Think of a teacher grading homework from a math student. The
teacher does not want to see the student's trials and errors teacher does not want to see the student's trials and errors
before they came up with the solution. They want to see the before they came up with the solution. They want to see the
cleanest, most elegant answer. A good student knows this, and cleanest, most elegant answer. A good student knows this, and
would never submit her intermediate work before the final would never submit her intermediate work before the final
solution." solution.*
The same is true of kernel development. The maintainers and *The same is true of kernel development. The maintainers and
reviewers do not want to see the thought process behind the reviewers do not want to see the thought process behind the
solution to the problem one is solving. They want to see a solution to the problem one is solving. They want to see a
simple and elegant solution." simple and elegant solution."*
It may be challenging to keep the balance between presenting an elegant It may be challenging to keep the balance between presenting an elegant
solution and working together with the community and discussing your solution and working together with the community and discussing your
...@@ -565,6 +612,7 @@ When sending in your patches, pay special attention to what you say in ...@@ -565,6 +612,7 @@ When sending in your patches, pay special attention to what you say in
the text in your email. This information will become the ChangeLog the text in your email. This information will become the ChangeLog
information for the patch, and will be preserved for everyone to see for information for the patch, and will be preserved for everyone to see for
all time. It should describe the patch completely, containing: all time. It should describe the patch completely, containing:
- why the change is necessary - why the change is necessary
- the overall design approach in the patch - the overall design approach in the patch
- implementation details - implementation details
...@@ -572,12 +620,11 @@ all time. It should describe the patch completely, containing: ...@@ -572,12 +620,11 @@ all time. It should describe the patch completely, containing:
For more details on what this should all look like, please see the For more details on what this should all look like, please see the
ChangeLog section of the document: ChangeLog section of the document:
"The Perfect Patch" "The Perfect Patch"
http://www.ozlabs.org/~akpm/stuff/tpp.txt http://www.ozlabs.org/~akpm/stuff/tpp.txt
All of these things are sometimes very hard to do. It can take years to All of these things are sometimes very hard to do. It can take years to
perfect these practices (if at all). It's a continuous process of perfect these practices (if at all). It's a continuous process of
improvement that requires a lot of patience and determination. But improvement that requires a lot of patience and determination. But
...@@ -588,8 +635,9 @@ start exactly where you are now. ...@@ -588,8 +635,9 @@ start exactly where you are now.
---------- ----------
Thanks to Paolo Ciarrocchi who allowed the "Development Process" Thanks to Paolo Ciarrocchi who allowed the "Development Process"
(http://lwn.net/Articles/94386/) section (https://lwn.net/Articles/94386/) section
to be based on text he had written, and to Randy Dunlap and Gerrit to be based on text he had written, and to Randy Dunlap and Gerrit
Huizenga for some of the list of things you should and should not say. Huizenga for some of the list of things you should and should not say.
Also thanks to Pat Mochel, Hanna Linder, Randy Dunlap, Kay Sievers, Also thanks to Pat Mochel, Hanna Linder, Randy Dunlap, Kay Sievers,
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
# You can set these variables from the command line. # You can set these variables from the command line.
SPHINXBUILD = sphinx-build SPHINXBUILD = sphinx-build
SPHINXOPTS = SPHINXOPTS =
SPHINXDIRS = .
_SPHINXDIRS = $(patsubst $(srctree)/Documentation/%/conf.py,%,$(wildcard $(srctree)/Documentation/*/conf.py))
SPHINX_CONF = conf.py
PAPER = PAPER =
BUILDDIR = $(obj)/output BUILDDIR = $(obj)/output
...@@ -25,38 +28,62 @@ else ifneq ($(DOCBOOKS),) ...@@ -25,38 +28,62 @@ else ifneq ($(DOCBOOKS),)
else # HAVE_SPHINX else # HAVE_SPHINX
# User-friendly check for rst2pdf # User-friendly check for pdflatex
HAVE_RST2PDF := $(shell if python -c "import rst2pdf" >/dev/null 2>&1; then echo 1; else echo 0; fi) HAVE_PDFLATEX := $(shell if which xelatex >/dev/null 2>&1; then echo 1; else echo 0; fi)
# Internal variables. # Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter PAPEROPT_letter = -D latex_paper_size=letter
KERNELDOC = $(srctree)/scripts/kernel-doc KERNELDOC = $(srctree)/scripts/kernel-doc
KERNELDOC_CONF = -D kerneldoc_srctree=$(srctree) -D kerneldoc_bin=$(KERNELDOC) KERNELDOC_CONF = -D kerneldoc_srctree=$(srctree) -D kerneldoc_bin=$(KERNELDOC)
ALLSPHINXOPTS = -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) -d $(BUILDDIR)/.doctrees $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) -c $(srctree)/$(src) $(SPHINXOPTS) $(srctree)/$(src) ALLSPHINXOPTS = $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS)
# the i18n builder cannot share the environment and doctrees with the others # the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
quiet_cmd_sphinx = SPHINX $@ # commands; the 'cmd' from scripts/Kbuild.include is not *loopable*
cmd_sphinx = BUILDDIR=$(BUILDDIR) $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(BUILDDIR)/$2 loop_cmd = $(echo-cmd) $(cmd_$(1))
# $2 sphinx builder e.g. "html"
# $3 name of the build subfolder / e.g. "media", used as:
# * dest folder relative to $(BUILDDIR) and
# * cache folder relative to $(BUILDDIR)/.doctrees
# $4 dest subfolder e.g. "man" for man pages at media/man
# $5 reST source folder relative to $(srctree)/$(src),
# e.g. "media" for the linux-tv book-set at ./Documentation/media
quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4);
cmd_sphinx = $(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/media all;\
BUILDDIR=$(abspath $(BUILDDIR)) SPHINX_CONF=$(abspath $(srctree)/$(src)/$5/$(SPHINX_CONF)) \
$(SPHINXBUILD) \
-b $2 \
-c $(abspath $(srctree)/$(src)) \
-d $(abspath $(BUILDDIR)/.doctrees/$3) \
-D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) \
$(ALLSPHINXOPTS) \
$(abspath $(srctree)/$(src)/$5) \
$(abspath $(BUILDDIR)/$3/$4);
htmldocs: htmldocs:
$(MAKE) BUILDDIR=$(BUILDDIR) -f $(srctree)/Documentation/media/Makefile $@ @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
$(call cmd,sphinx,html)
pdfdocs: latexdocs:
ifeq ($(HAVE_RST2PDF),0) ifeq ($(HAVE_PDFLATEX),0)
$(warning The Python 'rst2pdf' module was not found. Make sure you have the module installed to produce PDF output.) $(warning The 'xelatex' command was not found. Make sure you have it installed and in PATH to produce PDF output.)
@echo " SKIP Sphinx $@ target." @echo " SKIP Sphinx $@ target."
else # HAVE_RST2PDF else # HAVE_PDFLATEX
$(call cmd,sphinx,pdf) @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var)))
endif # HAVE_RST2PDF endif # HAVE_PDFLATEX
pdfdocs: latexdocs
ifneq ($(HAVE_PDFLATEX),0)
$(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX=xelatex LATEXOPTS="-interaction=nonstopmode" -C $(BUILDDIR)/$(var)/latex)
endif # HAVE_PDFLATEX
epubdocs: epubdocs:
$(call cmd,sphinx,epub) @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var)))
xmldocs: xmldocs:
$(call cmd,sphinx,xml) @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,xml,$(var),xml,$(var)))
# no-ops for the Sphinx toolchain # no-ops for the Sphinx toolchain
sgmldocs: sgmldocs:
...@@ -72,7 +99,14 @@ endif # HAVE_SPHINX ...@@ -72,7 +99,14 @@ endif # HAVE_SPHINX
dochelp: dochelp:
@echo ' Linux kernel internal documentation in different formats (Sphinx):' @echo ' Linux kernel internal documentation in different formats (Sphinx):'
@echo ' htmldocs - HTML' @echo ' htmldocs - HTML'
@echo ' latexdocs - LaTeX'
@echo ' pdfdocs - PDF' @echo ' pdfdocs - PDF'
@echo ' epubdocs - EPUB' @echo ' epubdocs - EPUB'
@echo ' xmldocs - XML' @echo ' xmldocs - XML'
@echo ' cleandocs - clean all generated files' @echo ' cleandocs - clean all generated files'
@echo
@echo ' make SPHINXDIRS="s1 s2" [target] Generate only docs of folder s1, s2'
@echo ' valid values for SPHINXDIRS are: $(_SPHINXDIRS)'
@echo
@echo ' make SPHINX_CONF={conf-file} [target] use *additional* sphinx-build'
@echo ' configuration. This is e.g. useful to build with nit-picking config.'
.. _managementstyle:
Linux kernel management style Linux kernel management style
=============================
This is a short document describing the preferred (or made up, depending This is a short document describing the preferred (or made up, depending
on who you ask) management style for the linux kernel. It's meant to on who you ask) management style for the linux kernel. It's meant to
mirror the CodingStyle document to some degree, and mainly written to mirror the CodingStyle document to some degree, and mainly written to
avoid answering (*) the same (or similar) questions over and over again. avoid answering [#f1]_ the same (or similar) questions over and over again.
Management style is very personal and much harder to quantify than Management style is very personal and much harder to quantify than
simple coding style rules, so this document may or may not have anything simple coding style rules, so this document may or may not have anything
...@@ -14,50 +16,52 @@ might not actually be true. You'll have to decide for yourself. ...@@ -14,50 +16,52 @@ might not actually be true. You'll have to decide for yourself.
Btw, when talking about "kernel manager", it's all about the technical Btw, when talking about "kernel manager", it's all about the technical
lead persons, not the people who do traditional management inside lead persons, not the people who do traditional management inside
companies. If you sign purchase orders or you have any clue about the companies. If you sign purchase orders or you have any clue about the
budget of your group, you're almost certainly not a kernel manager. budget of your group, you're almost certainly not a kernel manager.
These suggestions may or may not apply to you. These suggestions may or may not apply to you.
First off, I'd suggest buying "Seven Habits of Highly Effective First off, I'd suggest buying "Seven Habits of Highly Effective
People", and NOT read it. Burn it, it's a great symbolic gesture. People", and NOT read it. Burn it, it's a great symbolic gesture.
(*) This document does so not so much by answering the question, but by .. [#f1] This document does so not so much by answering the question, but by
making it painfully obvious to the questioner that we don't have a clue making it painfully obvious to the questioner that we don't have a clue
to what the answer is. to what the answer is.
Anyway, here goes: Anyway, here goes:
.. _decisions:
Chapter 1: Decisions 1) Decisions
------------
Everybody thinks managers make decisions, and that decision-making is Everybody thinks managers make decisions, and that decision-making is
important. The bigger and more painful the decision, the bigger the important. The bigger and more painful the decision, the bigger the
manager must be to make it. That's very deep and obvious, but it's not manager must be to make it. That's very deep and obvious, but it's not
actually true. actually true.
The name of the game is to _avoid_ having to make a decision. In The name of the game is to **avoid** having to make a decision. In
particular, if somebody tells you "choose (a) or (b), we really need you particular, if somebody tells you "choose (a) or (b), we really need you
to decide on this", you're in trouble as a manager. The people you to decide on this", you're in trouble as a manager. The people you
manage had better know the details better than you, so if they come to manage had better know the details better than you, so if they come to
you for a technical decision, you're screwed. You're clearly not you for a technical decision, you're screwed. You're clearly not
competent to make that decision for them. competent to make that decision for them.
(Corollary:if the people you manage don't know the details better than (Corollary:if the people you manage don't know the details better than
you, you're also screwed, although for a totally different reason. you, you're also screwed, although for a totally different reason.
Namely that you are in the wrong job, and that _they_ should be managing Namely that you are in the wrong job, and that **they** should be managing
your brilliance instead). your brilliance instead).
So the name of the game is to _avoid_ decisions, at least the big and So the name of the game is to **avoid** decisions, at least the big and
painful ones. Making small and non-consequential decisions is fine, and painful ones. Making small and non-consequential decisions is fine, and
makes you look like you know what you're doing, so what a kernel manager makes you look like you know what you're doing, so what a kernel manager
needs to do is to turn the big and painful ones into small things where needs to do is to turn the big and painful ones into small things where
nobody really cares. nobody really cares.
It helps to realize that the key difference between a big decision and a It helps to realize that the key difference between a big decision and a
small one is whether you can fix your decision afterwards. Any decision small one is whether you can fix your decision afterwards. Any decision
can be made small by just always making sure that if you were wrong (and can be made small by just always making sure that if you were wrong (and
you _will_ be wrong), you can always undo the damage later by you **will** be wrong), you can always undo the damage later by
backtracking. Suddenly, you get to be doubly managerial for making backtracking. Suddenly, you get to be doubly managerial for making
_two_ inconsequential decisions - the wrong one _and_ the right one. **two** inconsequential decisions - the wrong one **and** the right one.
And people will even see that as true leadership (*cough* bullshit And people will even see that as true leadership (*cough* bullshit
*cough*). *cough*).
...@@ -65,10 +69,10 @@ And people will even see that as true leadership (*cough* bullshit ...@@ -65,10 +69,10 @@ And people will even see that as true leadership (*cough* bullshit
Thus the key to avoiding big decisions becomes to just avoiding to do Thus the key to avoiding big decisions becomes to just avoiding to do
things that can't be undone. Don't get ushered into a corner from which things that can't be undone. Don't get ushered into a corner from which
you cannot escape. A cornered rat may be dangerous - a cornered manager you cannot escape. A cornered rat may be dangerous - a cornered manager
is just pitiful. is just pitiful.
It turns out that since nobody would be stupid enough to ever really let It turns out that since nobody would be stupid enough to ever really let
a kernel manager have huge fiscal responsibility _anyway_, it's usually a kernel manager have huge fiscal responsibility **anyway**, it's usually
fairly easy to backtrack. Since you're not going to be able to waste fairly easy to backtrack. Since you're not going to be able to waste
huge amounts of money that you might not be able to repay, the only huge amounts of money that you might not be able to repay, the only
thing you can backtrack on is a technical decision, and there thing you can backtrack on is a technical decision, and there
...@@ -76,113 +80,118 @@ back-tracking is very easy: just tell everybody that you were an ...@@ -76,113 +80,118 @@ back-tracking is very easy: just tell everybody that you were an
incompetent nincompoop, say you're sorry, and undo all the worthless incompetent nincompoop, say you're sorry, and undo all the worthless
work you had people work on for the last year. Suddenly the decision work you had people work on for the last year. Suddenly the decision
you made a year ago wasn't a big decision after all, since it could be you made a year ago wasn't a big decision after all, since it could be
easily undone. easily undone.
It turns out that some people have trouble with this approach, for two It turns out that some people have trouble with this approach, for two
reasons: reasons:
- admitting you were an idiot is harder than it looks. We all like to - admitting you were an idiot is harder than it looks. We all like to
maintain appearances, and coming out in public to say that you were maintain appearances, and coming out in public to say that you were
wrong is sometimes very hard indeed. wrong is sometimes very hard indeed.
- having somebody tell you that what you worked on for the last year - having somebody tell you that what you worked on for the last year
wasn't worthwhile after all can be hard on the poor lowly engineers wasn't worthwhile after all can be hard on the poor lowly engineers
too, and while the actual _work_ was easy enough to undo by just too, and while the actual **work** was easy enough to undo by just
deleting it, you may have irrevocably lost the trust of that deleting it, you may have irrevocably lost the trust of that
engineer. And remember: "irrevocable" was what we tried to avoid in engineer. And remember: "irrevocable" was what we tried to avoid in
the first place, and your decision ended up being a big one after the first place, and your decision ended up being a big one after
all. all.
Happily, both of these reasons can be mitigated effectively by just Happily, both of these reasons can be mitigated effectively by just
admitting up-front that you don't have a friggin' clue, and telling admitting up-front that you don't have a friggin' clue, and telling
people ahead of the fact that your decision is purely preliminary, and people ahead of the fact that your decision is purely preliminary, and
might be the wrong thing. You should always reserve the right to change might be the wrong thing. You should always reserve the right to change
your mind, and make people very _aware_ of that. And it's much easier your mind, and make people very **aware** of that. And it's much easier
to admit that you are stupid when you haven't _yet_ done the really to admit that you are stupid when you haven't **yet** done the really
stupid thing. stupid thing.
Then, when it really does turn out to be stupid, people just roll their Then, when it really does turn out to be stupid, people just roll their
eyes and say "Oops, he did it again". eyes and say "Oops, he did it again".
This preemptive admission of incompetence might also make the people who This preemptive admission of incompetence might also make the people who
actually do the work also think twice about whether it's worth doing or actually do the work also think twice about whether it's worth doing or
not. After all, if _they_ aren't certain whether it's a good idea, you not. After all, if **they** aren't certain whether it's a good idea, you
sure as hell shouldn't encourage them by promising them that what they sure as hell shouldn't encourage them by promising them that what they
work on will be included. Make them at least think twice before they work on will be included. Make them at least think twice before they
embark on a big endeavor. embark on a big endeavor.
Remember: they'd better know more about the details than you do, and Remember: they'd better know more about the details than you do, and
they usually already think they have the answer to everything. The best they usually already think they have the answer to everything. The best
thing you can do as a manager is not to instill confidence, but rather a thing you can do as a manager is not to instill confidence, but rather a
healthy dose of critical thinking on what they do. healthy dose of critical thinking on what they do.
Btw, another way to avoid a decision is to plaintively just whine "can't Btw, another way to avoid a decision is to plaintively just whine "can't
we just do both?" and look pitiful. Trust me, it works. If it's not we just do both?" and look pitiful. Trust me, it works. If it's not
clear which approach is better, they'll eventually figure it out. The clear which approach is better, they'll eventually figure it out. The
answer may end up being that both teams get so frustrated by the answer may end up being that both teams get so frustrated by the
situation that they just give up. situation that they just give up.
That may sound like a failure, but it's usually a sign that there was That may sound like a failure, but it's usually a sign that there was
something wrong with both projects, and the reason the people involved something wrong with both projects, and the reason the people involved
couldn't decide was that they were both wrong. You end up coming up couldn't decide was that they were both wrong. You end up coming up
smelling like roses, and you avoided yet another decision that you could smelling like roses, and you avoided yet another decision that you could
have screwed up on. have screwed up on.
Chapter 2: People 2) People
---------
Most people are idiots, and being a manager means you'll have to deal Most people are idiots, and being a manager means you'll have to deal
with it, and perhaps more importantly, that _they_ have to deal with with it, and perhaps more importantly, that **they** have to deal with
_you_. **you**.
It turns out that while it's easy to undo technical mistakes, it's not It turns out that while it's easy to undo technical mistakes, it's not
as easy to undo personality disorders. You just have to live with as easy to undo personality disorders. You just have to live with
theirs - and yours. theirs - and yours.
However, in order to prepare yourself as a kernel manager, it's best to However, in order to prepare yourself as a kernel manager, it's best to
remember not to burn any bridges, bomb any innocent villagers, or remember not to burn any bridges, bomb any innocent villagers, or
alienate too many kernel developers. It turns out that alienating people alienate too many kernel developers. It turns out that alienating people
is fairly easy, and un-alienating them is hard. Thus "alienating" is fairly easy, and un-alienating them is hard. Thus "alienating"
immediately falls under the heading of "not reversible", and becomes a immediately falls under the heading of "not reversible", and becomes a
no-no according to Chapter 1. no-no according to :ref:`decisions`.
There's just a few simple rules here: There's just a few simple rules here:
(1) don't call people d*ckheads (at least not in public) (1) don't call people d*ckheads (at least not in public)
(2) learn how to apologize when you forgot rule (1) (2) learn how to apologize when you forgot rule (1)
The problem with #1 is that it's very easy to do, since you can say The problem with #1 is that it's very easy to do, since you can say
"you're a d*ckhead" in millions of different ways (*), sometimes without "you're a d*ckhead" in millions of different ways [#f2]_, sometimes without
even realizing it, and almost always with a white-hot conviction that even realizing it, and almost always with a white-hot conviction that
you are right. you are right.
And the more convinced you are that you are right (and let's face it, And the more convinced you are that you are right (and let's face it,
you can call just about _anybody_ a d*ckhead, and you often _will_ be you can call just about **anybody** a d*ckhead, and you often **will** be
right), the harder it ends up being to apologize afterwards. right), the harder it ends up being to apologize afterwards.
To solve this problem, you really only have two options: To solve this problem, you really only have two options:
- get really good at apologies - get really good at apologies
- spread the "love" out so evenly that nobody really ends up feeling - spread the "love" out so evenly that nobody really ends up feeling
like they get unfairly targeted. Make it inventive enough, and they like they get unfairly targeted. Make it inventive enough, and they
might even be amused. might even be amused.
The option of being unfailingly polite really doesn't exist. Nobody will The option of being unfailingly polite really doesn't exist. Nobody will
trust somebody who is so clearly hiding his true character. trust somebody who is so clearly hiding his true character.
(*) Paul Simon sang "Fifty Ways to Leave Your Lover", because quite .. [#f2] Paul Simon sang "Fifty Ways to Leave Your Lover", because quite
frankly, "A Million Ways to Tell a Developer He Is a D*ckhead" doesn't frankly, "A Million Ways to Tell a Developer He Is a D*ckhead" doesn't
scan nearly as well. But I'm sure he thought about it. scan nearly as well. But I'm sure he thought about it.
Chapter 3: People II - the Good Kind 3) People II - the Good Kind
----------------------------
While it turns out that most people are idiots, the corollary to that is While it turns out that most people are idiots, the corollary to that is
sadly that you are one too, and that while we can all bask in the secure sadly that you are one too, and that while we can all bask in the secure
knowledge that we're better than the average person (let's face it, knowledge that we're better than the average person (let's face it,
nobody ever believes that they're average or below-average), we should nobody ever believes that they're average or below-average), we should
also admit that we're not the sharpest knife around, and there will be also admit that we're not the sharpest knife around, and there will be
other people that are less of an idiot than you are. other people that are less of an idiot than you are.
Some people react badly to smart people. Others take advantage of them. Some people react badly to smart people. Others take advantage of them.
Make sure that you, as a kernel maintainer, are in the second group. Make sure that you, as a kernel maintainer, are in the second group.
Suck up to them, because they are the people who will make your job Suck up to them, because they are the people who will make your job
easier. In particular, they'll be able to make your decisions for you, easier. In particular, they'll be able to make your decisions for you,
which is what the game is all about. which is what the game is all about.
...@@ -191,7 +200,7 @@ So when you find somebody smarter than you are, just coast along. Your ...@@ -191,7 +200,7 @@ So when you find somebody smarter than you are, just coast along. Your
management responsibilities largely become ones of saying "Sounds like a management responsibilities largely become ones of saying "Sounds like a
good idea - go wild", or "That sounds good, but what about xxx?". The good idea - go wild", or "That sounds good, but what about xxx?". The
second version in particular is a great way to either learn something second version in particular is a great way to either learn something
new about "xxx" or seem _extra_ managerial by pointing out something the new about "xxx" or seem **extra** managerial by pointing out something the
smarter person hadn't thought about. In either case, you win. smarter person hadn't thought about. In either case, you win.
One thing to look out for is to realize that greatness in one area does One thing to look out for is to realize that greatness in one area does
...@@ -199,47 +208,49 @@ not necessarily translate to other areas. So you might prod people in ...@@ -199,47 +208,49 @@ not necessarily translate to other areas. So you might prod people in
specific directions, but let's face it, they might be good at what they specific directions, but let's face it, they might be good at what they
do, and suck at everything else. The good news is that people tend to do, and suck at everything else. The good news is that people tend to
naturally gravitate back to what they are good at, so it's not like you naturally gravitate back to what they are good at, so it's not like you
are doing something irreversible when you _do_ prod them in some are doing something irreversible when you **do** prod them in some
direction, just don't push too hard. direction, just don't push too hard.
Chapter 4: Placing blame 4) Placing blame
----------------
Things will go wrong, and people want somebody to blame. Tag, you're it. Things will go wrong, and people want somebody to blame. Tag, you're it.
It's not actually that hard to accept the blame, especially if people It's not actually that hard to accept the blame, especially if people
kind of realize that it wasn't _all_ your fault. Which brings us to the kind of realize that it wasn't **all** your fault. Which brings us to the
best way of taking the blame: do it for another guy. You'll feel good best way of taking the blame: do it for another guy. You'll feel good
for taking the fall, he'll feel good about not getting blamed, and the for taking the fall, he'll feel good about not getting blamed, and the
guy who lost his whole 36GB porn-collection because of your incompetence guy who lost his whole 36GB porn-collection because of your incompetence
will grudgingly admit that you at least didn't try to weasel out of it. will grudgingly admit that you at least didn't try to weasel out of it.
Then make the developer who really screwed up (if you can find him) know Then make the developer who really screwed up (if you can find him) know
_in_private_ that he screwed up. Not just so he can avoid it in the **in_private** that he screwed up. Not just so he can avoid it in the
future, but so that he knows he owes you one. And, perhaps even more future, but so that he knows he owes you one. And, perhaps even more
importantly, he's also likely the person who can fix it. Because, let's importantly, he's also likely the person who can fix it. Because, let's
face it, it sure ain't you. face it, it sure ain't you.
Taking the blame is also why you get to be manager in the first place. Taking the blame is also why you get to be manager in the first place.
It's part of what makes people trust you, and allow you the potential It's part of what makes people trust you, and allow you the potential
glory, because you're the one who gets to say "I screwed up". And if glory, because you're the one who gets to say "I screwed up". And if
you've followed the previous rules, you'll be pretty good at saying that you've followed the previous rules, you'll be pretty good at saying that
by now. by now.
Chapter 5: Things to avoid 5) Things to avoid
------------------
There's one thing people hate even more than being called "d*ckhead", There's one thing people hate even more than being called "d*ckhead",
and that is being called a "d*ckhead" in a sanctimonious voice. The and that is being called a "d*ckhead" in a sanctimonious voice. The
first you can apologize for, the second one you won't really get the first you can apologize for, the second one you won't really get the
chance. They likely will no longer be listening even if you otherwise chance. They likely will no longer be listening even if you otherwise
do a good job. do a good job.
We all think we're better than anybody else, which means that when We all think we're better than anybody else, which means that when
somebody else puts on airs, it _really_ rubs us the wrong way. You may somebody else puts on airs, it **really** rubs us the wrong way. You may
be morally and intellectually superior to everybody around you, but be morally and intellectually superior to everybody around you, but
don't try to make it too obvious unless you really _intend_ to irritate don't try to make it too obvious unless you really **intend** to irritate
somebody (*). somebody [#f3]_.
Similarly, don't be too polite or subtle about things. Politeness easily Similarly, don't be too polite or subtle about things. Politeness easily
ends up going overboard and hiding the problem, and as they say, "On the ends up going overboard and hiding the problem, and as they say, "On the
...@@ -251,15 +262,16 @@ Some humor can help pad both the bluntness and the moralizing. Going ...@@ -251,15 +262,16 @@ Some humor can help pad both the bluntness and the moralizing. Going
overboard to the point of being ridiculous can drive a point home overboard to the point of being ridiculous can drive a point home
without making it painful to the recipient, who just thinks you're being without making it painful to the recipient, who just thinks you're being
silly. It can thus help get through the personal mental block we all silly. It can thus help get through the personal mental block we all
have about criticism. have about criticism.
(*) Hint: internet newsgroups that are not directly related to your work .. [#f3] Hint: internet newsgroups that are not directly related to your work
are great ways to take out your frustrations at other people. Write are great ways to take out your frustrations at other people. Write
insulting posts with a sneer just to get into a good flame every once in insulting posts with a sneer just to get into a good flame every once in
a while, and you'll feel cleansed. Just don't crap too close to home. a while, and you'll feel cleansed. Just don't crap too close to home.
Chapter 6: Why me? 6) Why me?
----------
Since your main responsibility seems to be to take the blame for other Since your main responsibility seems to be to take the blame for other
peoples mistakes, and make it painfully obvious to everybody else that peoples mistakes, and make it painfully obvious to everybody else that
...@@ -268,9 +280,9 @@ first place? ...@@ -268,9 +280,9 @@ first place?
First off, while you may or may not get screaming teenage girls (or First off, while you may or may not get screaming teenage girls (or
boys, let's not be judgmental or sexist here) knocking on your dressing boys, let's not be judgmental or sexist here) knocking on your dressing
room door, you _will_ get an immense feeling of personal accomplishment room door, you **will** get an immense feeling of personal accomplishment
for being "in charge". Never mind the fact that you're really leading for being "in charge". Never mind the fact that you're really leading
by trying to keep up with everybody else and running after them as fast by trying to keep up with everybody else and running after them as fast
as you can. Everybody will still think you're the person in charge. as you can. Everybody will still think you're the person in charge.
It's a great job if you can hack it. It's a great job if you can hack it.
.. _securitybugs:
Security bugs
=============
Linux kernel developers take security very seriously. As such, we'd Linux kernel developers take security very seriously. As such, we'd
like to know when a security bug is found so that it can be fixed and like to know when a security bug is found so that it can be fixed and
disclosed as quickly as possible. Please report security bugs to the disclosed as quickly as possible. Please report security bugs to the
Linux kernel security team. Linux kernel security team.
1) Contact 1) Contact
----------
The Linux kernel security team can be contacted by email at The Linux kernel security team can be contacted by email at
<security@kernel.org>. This is a private list of security officers <security@kernel.org>. This is a private list of security officers
...@@ -18,6 +24,7 @@ Any exploit code is very helpful and will not be released without ...@@ -18,6 +24,7 @@ Any exploit code is very helpful and will not be released without
consent from the reporter unless it has already been made public. consent from the reporter unless it has already been made public.
2) Disclosure 2) Disclosure
-------------
The goal of the Linux kernel security team is to work with the The goal of the Linux kernel security team is to work with the
bug submitter to bug resolution as well as disclosure. We prefer bug submitter to bug resolution as well as disclosure. We prefer
...@@ -33,6 +40,7 @@ to a few weeks. As a basic default policy, we expect report date to ...@@ -33,6 +40,7 @@ to a few weeks. As a basic default policy, we expect report date to
disclosure date to be on the order of 7 days. disclosure date to be on the order of 7 days.
3) Non-disclosure agreements 3) Non-disclosure agreements
----------------------------
The Linux kernel security team is not a formal body and therefore unable The Linux kernel security team is not a formal body and therefore unable
to enter any non-disclosure agreements. to enter any non-disclosure agreements.
.. _submitchecklist:
Linux Kernel patch submission checklist Linux Kernel patch submission checklist
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here are some basic things that developers should do if they want to see their Here are some basic things that developers should do if they want to see their
kernel patch submissions accepted more quickly. kernel patch submissions accepted more quickly.
These are all above and beyond the documentation that is provided in These are all above and beyond the documentation that is provided in
Documentation/SubmittingPatches and elsewhere regarding submitting Linux :ref:`Documentation/SubmittingPatches <submittingpatches>`
kernel patches. and elsewhere regarding submitting Linux kernel patches.
1: If you use a facility then #include the file that defines/declares 1) If you use a facility then #include the file that defines/declares
that facility. Don't depend on other header files pulling in ones that facility. Don't depend on other header files pulling in ones
that you use. that you use.
2: Builds cleanly with applicable or modified CONFIG options =y, =m, and 2) Builds cleanly:
=n. No gcc warnings/errors, no linker warnings/errors.
a) with applicable or modified ``CONFIG`` options ``=y``, ``=m``, and
``=n``. No ``gcc`` warnings/errors, no linker warnings/errors.
2b: Passes allnoconfig, allmodconfig b) Passes ``allnoconfig``, ``allmodconfig``
2c: Builds successfully when using O=builddir c) Builds successfully when using ``O=builddir``
3: Builds on multiple CPU architectures by using local cross-compile tools 3) Builds on multiple CPU architectures by using local cross-compile tools
or some other build farm. or some other build farm.
4: ppc64 is a good architecture for cross-compilation checking because it 4) ppc64 is a good architecture for cross-compilation checking because it
tends to use `unsigned long' for 64-bit quantities. tends to use ``unsigned long`` for 64-bit quantities.
5: Check your patch for general style as detailed in 5) Check your patch for general style as detailed in
Documentation/CodingStyle. Check for trivial violations with the :ref:`Documentation/CodingStyle <codingstyle>`.
patch style checker prior to submission (scripts/checkpatch.pl). Check for trivial violations with the patch style checker prior to
submission (``scripts/checkpatch.pl``).
You should be able to justify all violations that remain in You should be able to justify all violations that remain in
your patch. your patch.
6: Any new or modified CONFIG options don't muck up the config menu. 6) Any new or modified ``CONFIG`` options don't muck up the config menu.
7: All new Kconfig options have help text. 7) All new ``Kconfig`` options have help text.
8: Has been carefully reviewed with respect to relevant Kconfig 8) Has been carefully reviewed with respect to relevant ``Kconfig``
combinations. This is very hard to get right with testing -- brainpower combinations. This is very hard to get right with testing -- brainpower
pays off here. pays off here.
9: Check cleanly with sparse. 9) Check cleanly with sparse.
10) Use ``make checkstack`` and ``make namespacecheck`` and fix any problems
that they find.
.. note::
10: Use 'make checkstack' and 'make namespacecheck' and fix any problems ``checkstack`` does not point out problems explicitly,
that they find. Note: checkstack does not point out problems explicitly, but any one function that uses more than 512 bytes on the stack is a
but any one function that uses more than 512 bytes on the stack is a candidate for change.
candidate for change.
11: Include kernel-doc to document global kernel APIs. (Not required for 11) Include :ref:`kernel-doc <kernel_doc>` to document global kernel APIs.
static functions, but OK there also.) Use 'make htmldocs' or 'make (Not required for static functions, but OK there also.) Use
mandocs' to check the kernel-doc and fix any issues. ``make htmldocs`` or ``make pdfdocs`` to check the
:ref:`kernel-doc <kernel_doc>` and fix any issues.
12: Has been tested with CONFIG_PREEMPT, CONFIG_DEBUG_PREEMPT, 12) Has been tested with ``CONFIG_PREEMPT``, ``CONFIG_DEBUG_PREEMPT``,
CONFIG_DEBUG_SLAB, CONFIG_DEBUG_PAGEALLOC, CONFIG_DEBUG_MUTEXES, ``CONFIG_DEBUG_SLAB``, ``CONFIG_DEBUG_PAGEALLOC``, ``CONFIG_DEBUG_MUTEXES``,
CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_ATOMIC_SLEEP, CONFIG_PROVE_RCU ``CONFIG_DEBUG_SPINLOCK``, ``CONFIG_DEBUG_ATOMIC_SLEEP``,
and CONFIG_DEBUG_OBJECTS_RCU_HEAD all simultaneously enabled. ``CONFIG_PROVE_RCU`` and ``CONFIG_DEBUG_OBJECTS_RCU_HEAD`` all
simultaneously enabled.
13: Has been build- and runtime tested with and without CONFIG_SMP and 13) Has been build- and runtime tested with and without ``CONFIG_SMP`` and
CONFIG_PREEMPT. ``CONFIG_PREEMPT.``
14: If the patch affects IO/Disk, etc: has been tested with and without 14) If the patch affects IO/Disk, etc: has been tested with and without
CONFIG_LBDAF. ``CONFIG_LBDAF.``
15: All codepaths have been exercised with all lockdep features enabled. 15) All codepaths have been exercised with all lockdep features enabled.
16: All new /proc entries are documented under Documentation/ 16) All new ``/proc`` entries are documented under ``Documentation/``
17: All new kernel boot parameters are documented in 17) All new kernel boot parameters are documented in
Documentation/kernel-parameters.txt. ``Documentation/kernel-parameters.txt``.
18: All new module parameters are documented with MODULE_PARM_DESC() 18) All new module parameters are documented with ``MODULE_PARM_DESC()``
19: All new userspace interfaces are documented in Documentation/ABI/. 19) All new userspace interfaces are documented in ``Documentation/ABI/``.
See Documentation/ABI/README for more information. See ``Documentation/ABI/README`` for more information.
Patches that change userspace interfaces should be CCed to Patches that change userspace interfaces should be CCed to
linux-api@vger.kernel.org. linux-api@vger.kernel.org.
20: Check that it all passes `make headers_check'. 20) Check that it all passes ``make headers_check``.
21: Has been checked with injection of at least slab and page-allocation 21) Has been checked with injection of at least slab and page-allocation
failures. See Documentation/fault-injection/. failures. See ``Documentation/fault-injection/``.
If the new code is substantial, addition of subsystem-specific fault If the new code is substantial, addition of subsystem-specific fault
injection might be appropriate. injection might be appropriate.
22: Newly-added code has been compiled with `gcc -W' (use "make 22) Newly-added code has been compiled with ``gcc -W`` (use
EXTRA_CFLAGS=-W"). This will generate lots of noise, but is good for ``make EXTRA_CFLAGS=-W``). This will generate lots of noise, but is good
finding bugs like "warning: comparison between signed and unsigned". for finding bugs like "warning: comparison between signed and unsigned".
23: Tested after it has been merged into the -mm patchset to make sure 23) Tested after it has been merged into the -mm patchset to make sure
that it still works with all of the other queued patches and various that it still works with all of the other queued patches and various
changes in the VM, VFS, and other subsystems. changes in the VM, VFS, and other subsystems.
24: All memory barriers {e.g., barrier(), rmb(), wmb()} need a comment in the 24) All memory barriers {e.g., ``barrier()``, ``rmb()``, ``wmb()``} need a
source code that explains the logic of what they are doing and why. comment in the source code that explains the logic of what they are doing
and why.
25: If any ioctl's are added by the patch, then also update 25) If any ioctl's are added by the patch, then also update
Documentation/ioctl/ioctl-number.txt. ``Documentation/ioctl/ioctl-number.txt``.
26: If your modified source code depends on or uses any of the kernel 26) If your modified source code depends on or uses any of the kernel
APIs or features that are related to the following kconfig symbols, APIs or features that are related to the following ``Kconfig`` symbols,
then test multiple builds with the related kconfig symbols disabled then test multiple builds with the related ``Kconfig`` symbols disabled
and/or =m (if that option is available) [not all of these at the and/or ``=m`` (if that option is available) [not all of these at the
same time, just various/random combinations of them]: same time, just various/random combinations of them]:
CONFIG_SMP, CONFIG_SYSFS, CONFIG_PROC_FS, CONFIG_INPUT, CONFIG_PCI, ``CONFIG_SMP``, ``CONFIG_SYSFS``, ``CONFIG_PROC_FS``, ``CONFIG_INPUT``, ``CONFIG_PCI``, ``CONFIG_BLOCK``, ``CONFIG_PM``, ``CONFIG_MAGIC_SYSRQ``,
CONFIG_BLOCK, CONFIG_PM, CONFIG_MAGIC_SYSRQ, ``CONFIG_NET``, ``CONFIG_INET=n`` (but latter with ``CONFIG_NET=y``).
CONFIG_NET, CONFIG_INET=n (but latter with CONFIG_NET=y)
.. _submittingdrivers:
Submitting Drivers For The Linux Kernel Submitting Drivers For The Linux Kernel
--------------------------------------- =======================================
This document is intended to explain how to submit device drivers to the This document is intended to explain how to submit device drivers to the
various kernel trees. Note that if you are interested in video card drivers various kernel trees. Note that if you are interested in video card drivers
...@@ -38,42 +40,48 @@ Linux 2.4: ...@@ -38,42 +40,48 @@ Linux 2.4:
maintainer does not respond or you cannot find the appropriate maintainer does not respond or you cannot find the appropriate
maintainer then please contact Willy Tarreau <w@1wt.eu>. maintainer then please contact Willy Tarreau <w@1wt.eu>.
Linux 2.6: Linux 2.6 and upper:
The same rules apply as 2.4 except that you should follow linux-kernel The same rules apply as 2.4 except that you should follow linux-kernel
to track changes in API's. The final contact point for Linux 2.6 to track changes in API's. The final contact point for Linux 2.6+
submissions is Andrew Morton. submissions is Andrew Morton.
What Criteria Determine Acceptance What Criteria Determine Acceptance
---------------------------------- ----------------------------------
Licensing: The code must be released to us under the Licensing:
The code must be released to us under the
GNU General Public License. We don't insist on any kind GNU General Public License. We don't insist on any kind
of exclusive GPL licensing, and if you wish the driver of exclusive GPL licensing, and if you wish the driver
to be useful to other communities such as BSD you may well to be useful to other communities such as BSD you may well
wish to release under multiple licenses. wish to release under multiple licenses.
See accepted licenses at include/linux/module.h See accepted licenses at include/linux/module.h
Copyright: The copyright owner must agree to use of GPL. Copyright:
The copyright owner must agree to use of GPL.
It's best if the submitter and copyright owner It's best if the submitter and copyright owner
are the same person/entity. If not, the name of are the same person/entity. If not, the name of
the person/entity authorizing use of GPL should be the person/entity authorizing use of GPL should be
listed in case it's necessary to verify the will of listed in case it's necessary to verify the will of
the copyright owner. the copyright owner.
Interfaces: If your driver uses existing interfaces and behaves like Interfaces:
If your driver uses existing interfaces and behaves like
other drivers in the same class it will be much more likely other drivers in the same class it will be much more likely
to be accepted than if it invents gratuitous new ones. to be accepted than if it invents gratuitous new ones.
If you need to implement a common API over Linux and NT If you need to implement a common API over Linux and NT
drivers do it in userspace. drivers do it in userspace.
Code: Please use the Linux style of code formatting as documented Code:
in Documentation/CodingStyle. If you have sections of code Please use the Linux style of code formatting as documented
in :ref:`Documentation/CodingStyle <codingStyle>`.
If you have sections of code
that need to be in other formats, for example because they that need to be in other formats, for example because they
are shared with a windows driver kit and you want to are shared with a windows driver kit and you want to
maintain them just once separate them out nicely and note maintain them just once separate them out nicely and note
this fact. this fact.
Portability: Pointers are not always 32bits, not all computers are little Portability:
Pointers are not always 32bits, not all computers are little
endian, people do not all have floating point and you endian, people do not all have floating point and you
shouldn't use inline x86 assembler in your driver without shouldn't use inline x86 assembler in your driver without
careful thought. Pure x86 drivers generally are not popular. careful thought. Pure x86 drivers generally are not popular.
...@@ -81,12 +89,14 @@ Portability: Pointers are not always 32bits, not all computers are little ...@@ -81,12 +89,14 @@ Portability: Pointers are not always 32bits, not all computers are little
but it is easy to make sure the code can easily be made but it is easy to make sure the code can easily be made
portable. portable.
Clarity: It helps if anyone can see how to fix the driver. It helps Clarity:
It helps if anyone can see how to fix the driver. It helps
you because you get patches not bug reports. If you submit a you because you get patches not bug reports. If you submit a
driver that intentionally obfuscates how the hardware works driver that intentionally obfuscates how the hardware works
it will go in the bitbucket. it will go in the bitbucket.
PM support: Since Linux is used on many portable and desktop systems, your PM support:
Since Linux is used on many portable and desktop systems, your
driver is likely to be used on such a system and therefore it driver is likely to be used on such a system and therefore it
should support basic power management by implementing, if should support basic power management by implementing, if
necessary, the .suspend and .resume methods used during the necessary, the .suspend and .resume methods used during the
...@@ -101,7 +111,8 @@ PM support: Since Linux is used on many portable and desktop systems, your ...@@ -101,7 +111,8 @@ PM support: Since Linux is used on many portable and desktop systems, your
complete overview of the power management issues related to complete overview of the power management issues related to
drivers see Documentation/power/devices.txt . drivers see Documentation/power/devices.txt .
Control: In general if there is active maintenance of a driver by Control:
In general if there is active maintenance of a driver by
the author then patches will be redirected to them unless the author then patches will be redirected to them unless
they are totally obvious and without need of checking. they are totally obvious and without need of checking.
If you want to be the contact and update point for the If you want to be the contact and update point for the
...@@ -111,13 +122,15 @@ Control: In general if there is active maintenance of a driver by ...@@ -111,13 +122,15 @@ Control: In general if there is active maintenance of a driver by
What Criteria Do Not Determine Acceptance What Criteria Do Not Determine Acceptance
----------------------------------------- -----------------------------------------
Vendor: Being the hardware vendor and maintaining the driver is Vendor:
Being the hardware vendor and maintaining the driver is
often a good thing. If there is a stable working driver from often a good thing. If there is a stable working driver from
other people already in the tree don't expect 'we are the other people already in the tree don't expect 'we are the
vendor' to get your driver chosen. Ideally work with the vendor' to get your driver chosen. Ideally work with the
existing driver author to build a single perfect driver. existing driver author to build a single perfect driver.
Author: It doesn't matter if a large Linux company wrote the driver, Author:
It doesn't matter if a large Linux company wrote the driver,
or you did. Nobody has any special access to the kernel or you did. Nobody has any special access to the kernel
tree. Anyone who tells you otherwise isn't telling the tree. Anyone who tells you otherwise isn't telling the
whole story. whole story.
...@@ -127,8 +140,10 @@ Resources ...@@ -127,8 +140,10 @@ Resources
--------- ---------
Linux kernel master tree: Linux kernel master tree:
ftp.??.kernel.org:/pub/linux/kernel/... ftp.\ *country_code*\ .kernel.org:/pub/linux/kernel/...
?? == your country code, such as "us", "uk", "fr", etc.
where *country_code* == your country code, such as
**us**, **uk**, **fr**, etc.
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git
...@@ -141,14 +156,19 @@ Linux Device Drivers, Third Edition (covers 2.6.10): ...@@ -141,14 +156,19 @@ Linux Device Drivers, Third Edition (covers 2.6.10):
LWN.net: LWN.net:
Weekly summary of kernel development activity - http://lwn.net/ Weekly summary of kernel development activity - http://lwn.net/
2.6 API changes: 2.6 API changes:
http://lwn.net/Articles/2.6-kernel-api/ http://lwn.net/Articles/2.6-kernel-api/
Porting drivers from prior kernels to 2.6: Porting drivers from prior kernels to 2.6:
http://lwn.net/Articles/driver-porting/ http://lwn.net/Articles/driver-porting/
KernelNewbies: KernelNewbies:
Documentation and assistance for new kernel programmers Documentation and assistance for new kernel programmers
http://kernelnewbies.org/
http://kernelnewbies.org/
Linux USB project: Linux USB project:
http://www.linux-usb.org/ http://www.linux-usb.org/
......
此差异已折叠。
此差异已折叠。
...@@ -73,4 +73,13 @@ SunXi family ...@@ -73,4 +73,13 @@ SunXi family
* Octa ARM Cortex-A7 based SoCs * Octa ARM Cortex-A7 based SoCs
- Allwinner A83T - Allwinner A83T
+ Datasheet + Datasheet
http://dl.linux-sunxi.org/A83T/A83T_datasheet_Revision_1.1.pdf https://github.com/allwinner-zh/documents/raw/master/A83T/A83T_Datasheet_v1.3_20150510.pdf
+ User Manual
https://github.com/allwinner-zh/documents/raw/master/A83T/A83T_User_Manual_v1.5.1_20150513.pdf
* Quad ARM Cortex-A53 based SoCs
- Allwinner A64
+ Datasheet
http://dl.linux-sunxi.org/A64/A64_Datasheet_V1.1.pdf
+ User Manual
http://dl.linux-sunxi.org/A64/Allwinner%20A64%20User%20Manual%20v1.0.pdf
...@@ -31,24 +31,25 @@ serve as a convenient shorthand for the implementation of the ...@@ -31,24 +31,25 @@ serve as a convenient shorthand for the implementation of the
hardware-specific bits for the hypothetical "foo" hardware. hardware-specific bits for the hypothetical "foo" hardware.
Tying the two halves of this interface together is struct clk_hw, which Tying the two halves of this interface together is struct clk_hw, which
is defined in struct clk_foo and pointed to within struct clk. This is defined in struct clk_foo and pointed to within struct clk_core. This
allows for easy navigation between the two discrete halves of the common allows for easy navigation between the two discrete halves of the common
clock interface. clock interface.
Part 2 - common data structures and api Part 2 - common data structures and api
Below is the common struct clk definition from Below is the common struct clk_core definition from
include/linux/clk-private.h, modified for brevity: drivers/clk/clk.c, modified for brevity:
struct clk { struct clk_core {
const char *name; const char *name;
const struct clk_ops *ops; const struct clk_ops *ops;
struct clk_hw *hw; struct clk_hw *hw;
char **parent_names; struct module *owner;
struct clk **parents; struct clk_core *parent;
struct clk *parent; const char **parent_names;
struct hlist_head children; struct clk_core **parents;
struct hlist_node child_node; u8 num_parents;
u8 new_parent_index;
... ...
}; };
...@@ -56,16 +57,19 @@ The members above make up the core of the clk tree topology. The clk ...@@ -56,16 +57,19 @@ The members above make up the core of the clk tree topology. The clk
api itself defines several driver-facing functions which operate on api itself defines several driver-facing functions which operate on
struct clk. That api is documented in include/linux/clk.h. struct clk. That api is documented in include/linux/clk.h.
Platforms and devices utilizing the common struct clk use the struct Platforms and devices utilizing the common struct clk_core use the struct
clk_ops pointer in struct clk to perform the hardware-specific parts of clk_ops pointer in struct clk_core to perform the hardware-specific parts of
the operations defined in clk.h: the operations defined in clk-provider.h:
struct clk_ops { struct clk_ops {
int (*prepare)(struct clk_hw *hw); int (*prepare)(struct clk_hw *hw);
void (*unprepare)(struct clk_hw *hw); void (*unprepare)(struct clk_hw *hw);
int (*is_prepared)(struct clk_hw *hw);
void (*unprepare_unused)(struct clk_hw *hw);
int (*enable)(struct clk_hw *hw); int (*enable)(struct clk_hw *hw);
void (*disable)(struct clk_hw *hw); void (*disable)(struct clk_hw *hw);
int (*is_enabled)(struct clk_hw *hw); int (*is_enabled)(struct clk_hw *hw);
void (*disable_unused)(struct clk_hw *hw);
unsigned long (*recalc_rate)(struct clk_hw *hw, unsigned long (*recalc_rate)(struct clk_hw *hw,
unsigned long parent_rate); unsigned long parent_rate);
long (*round_rate)(struct clk_hw *hw, long (*round_rate)(struct clk_hw *hw,
...@@ -84,6 +88,8 @@ the operations defined in clk.h: ...@@ -84,6 +88,8 @@ the operations defined in clk.h:
u8 index); u8 index);
unsigned long (*recalc_accuracy)(struct clk_hw *hw, unsigned long (*recalc_accuracy)(struct clk_hw *hw,
unsigned long parent_accuracy); unsigned long parent_accuracy);
int (*get_phase)(struct clk_hw *hw);
int (*set_phase)(struct clk_hw *hw, int degrees);
void (*init)(struct clk_hw *hw); void (*init)(struct clk_hw *hw);
int (*debug_init)(struct clk_hw *hw, int (*debug_init)(struct clk_hw *hw,
struct dentry *dentry); struct dentry *dentry);
...@@ -91,7 +97,7 @@ the operations defined in clk.h: ...@@ -91,7 +97,7 @@ the operations defined in clk.h:
Part 3 - hardware clk implementations Part 3 - hardware clk implementations
The strength of the common struct clk comes from its .ops and .hw pointers The strength of the common struct clk_core comes from its .ops and .hw pointers
which abstract the details of struct clk from the hardware-specific bits, and which abstract the details of struct clk from the hardware-specific bits, and
vice versa. To illustrate consider the simple gateable clk implementation in vice versa. To illustrate consider the simple gateable clk implementation in
drivers/clk/clk-gate.c: drivers/clk/clk-gate.c:
...@@ -107,7 +113,7 @@ struct clk_gate contains struct clk_hw hw as well as hardware-specific ...@@ -107,7 +113,7 @@ struct clk_gate contains struct clk_hw hw as well as hardware-specific
knowledge about which register and bit controls this clk's gating. knowledge about which register and bit controls this clk's gating.
Nothing about clock topology or accounting, such as enable_count or Nothing about clock topology or accounting, such as enable_count or
notifier_count, is needed here. That is all handled by the common notifier_count, is needed here. That is all handled by the common
framework code and struct clk. framework code and struct clk_core.
Let's walk through enabling this clk from driver code: Let's walk through enabling this clk from driver code:
...@@ -139,22 +145,18 @@ static void clk_gate_set_bit(struct clk_gate *gate) ...@@ -139,22 +145,18 @@ static void clk_gate_set_bit(struct clk_gate *gate)
Note that to_clk_gate is defined as: Note that to_clk_gate is defined as:
#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, clk) #define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
This pattern of abstraction is used for every clock hardware This pattern of abstraction is used for every clock hardware
representation. representation.
Part 4 - supporting your own clk hardware Part 4 - supporting your own clk hardware
When implementing support for a new type of clock it only necessary to When implementing support for a new type of clock it is only necessary to
include the following header: include the following header:
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
include/linux/clk.h is included within that header and clk-private.h
must never be included from the code which implements the operations for
a clock. More on that below in Part 5.
To construct a clk hardware structure for your platform you must define To construct a clk hardware structure for your platform you must define
the following: the following:
......
...@@ -14,11 +14,17 @@ ...@@ -14,11 +14,17 @@
import sys import sys
import os import os
import sphinx
# Get Sphinx version
major, minor, patch = map(int, sphinx.__version__.split("."))
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('sphinx')) sys.path.insert(0, os.path.abspath('sphinx'))
from load_config import loadConfig
# -- General configuration ------------------------------------------------ # -- General configuration ------------------------------------------------
...@@ -28,14 +34,13 @@ sys.path.insert(0, os.path.abspath('sphinx')) ...@@ -28,14 +34,13 @@ sys.path.insert(0, os.path.abspath('sphinx'))
# Add any Sphinx extension module names here, as strings. They can be # Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = ['kernel-doc', 'rstFlatTable', 'kernel_include'] extensions = ['kernel-doc', 'rstFlatTable', 'kernel_include', 'cdomain']
# Gracefully handle missing rst2pdf. # The name of the math extension changed on Sphinx 1.4
try: if minor > 3:
import rst2pdf extensions.append("sphinx.ext.imgmath")
extensions += ['rst2pdf.pdfbuilder'] else:
except ImportError: extensions.append("sphinx.ext.pngmath")
pass
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']
...@@ -252,23 +257,90 @@ htmlhelp_basename = 'TheLinuxKerneldoc' ...@@ -252,23 +257,90 @@ htmlhelp_basename = 'TheLinuxKerneldoc'
latex_elements = { latex_elements = {
# The paper size ('letterpaper' or 'a4paper'). # The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper', 'papersize': 'a4paper',
# The font size ('10pt', '11pt' or '12pt'). # The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt', 'pointsize': '8pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment # Latex figure (float) alignment
#'figure_align': 'htbp', #'figure_align': 'htbp',
# Don't mangle with UTF-8 chars
'inputenc': '',
'utf8extra': '',
# Additional stuff for the LaTeX preamble.
'preamble': '''
% Adjust margins
\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}
% Allow generate some pages in landscape
\\usepackage{lscape}
% Put notes in color and let them be inside a table
\\definecolor{NoteColor}{RGB}{204,255,255}
\\definecolor{WarningColor}{RGB}{255,204,204}
\\definecolor{AttentionColor}{RGB}{255,255,204}
\\definecolor{OtherColor}{RGB}{204,204,204}
\\newlength{\\mynoticelength}
\\makeatletter\\newenvironment{coloredbox}[1]{%
\\setlength{\\fboxrule}{1pt}
\\setlength{\\fboxsep}{7pt}
\\setlength{\\mynoticelength}{\\linewidth}
\\addtolength{\\mynoticelength}{-2\\fboxsep}
\\addtolength{\\mynoticelength}{-2\\fboxrule}
\\begin{lrbox}{\\@tempboxa}\\begin{minipage}{\\mynoticelength}}{\\end{minipage}\\end{lrbox}%
\\ifthenelse%
{\\equal{\\py@noticetype}{note}}%
{\\colorbox{NoteColor}{\\usebox{\\@tempboxa}}}%
{%
\\ifthenelse%
{\\equal{\\py@noticetype}{warning}}%
{\\colorbox{WarningColor}{\\usebox{\\@tempboxa}}}%
{%
\\ifthenelse%
{\\equal{\\py@noticetype}{attention}}%
{\\colorbox{AttentionColor}{\\usebox{\\@tempboxa}}}%
{\\colorbox{OtherColor}{\\usebox{\\@tempboxa}}}%
}%
}%
}\\makeatother
\\makeatletter
\\renewenvironment{notice}[2]{%
\\def\\py@noticetype{#1}
\\begin{coloredbox}{#1}
\\bf\\it
\\par\\strong{#2}
\\csname py@noticestart@#1\\endcsname
}
{
\\csname py@noticeend@\\py@noticetype\\endcsname
\\end{coloredbox}
}
\\makeatother
% Use some font with UTF-8 support with XeLaTeX
\\usepackage{fontspec}
\\setsansfont{DejaVu Serif}
\\setromanfont{DejaVu Sans}
\\setmonofont{DejaVu Sans Mono}
% To allow adjusting table sizes
\\usepackage{adjustbox}
'''
} }
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, # (source start file, target name, title,
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
(master_doc, 'TheLinuxKernel.tex', 'The Linux Kernel Documentation', ('kernel-documentation', 'kernel-documentation.tex', 'The Linux Kernel Documentation',
'The kernel development community', 'manual'),
('development-process/index', 'development-process.tex', 'Linux Kernel Development Documentation',
'The kernel development community', 'manual'),
('gpu/index', 'gpu.tex', 'Linux GPU Driver Developer\'s Guide',
'The kernel development community', 'manual'), 'The kernel development community', 'manual'),
] ]
...@@ -419,3 +491,9 @@ pdf_documents = [ ...@@ -419,3 +491,9 @@ pdf_documents = [
# line arguments. # line arguments.
kerneldoc_bin = '../scripts/kernel-doc' kerneldoc_bin = '../scripts/kernel-doc'
kerneldoc_srctree = '..' kerneldoc_srctree = '..'
# ------------------------------------------------------------------------------
# Since loadConfig overwrites settings from the global namespace, it has to be
# the last statement in the conf.py file
# ------------------------------------------------------------------------------
loadConfig(globals())
.. highlight:: none
Debugging kernel and modules via gdb Debugging kernel and modules via gdb
==================================== ====================================
...@@ -13,54 +15,58 @@ be transferred to the other gdb stubs as well. ...@@ -13,54 +15,58 @@ be transferred to the other gdb stubs as well.
Requirements Requirements
------------ ------------
o gdb 7.2+ (recommended: 7.4+) with python support enabled (typically true - gdb 7.2+ (recommended: 7.4+) with python support enabled (typically true
for distributions) for distributions)
Setup Setup
----- -----
o Create a virtual Linux machine for QEMU/KVM (see www.linux-kvm.org and - Create a virtual Linux machine for QEMU/KVM (see www.linux-kvm.org and
www.qemu.org for more details). For cross-development, www.qemu.org for more details). For cross-development,
http://landley.net/aboriginal/bin keeps a pool of machine images and http://landley.net/aboriginal/bin keeps a pool of machine images and
toolchains that can be helpful to start from. toolchains that can be helpful to start from.
o Build the kernel with CONFIG_GDB_SCRIPTS enabled, but leave - Build the kernel with CONFIG_GDB_SCRIPTS enabled, but leave
CONFIG_DEBUG_INFO_REDUCED off. If your architecture supports CONFIG_DEBUG_INFO_REDUCED off. If your architecture supports
CONFIG_FRAME_POINTER, keep it enabled. CONFIG_FRAME_POINTER, keep it enabled.
o Install that kernel on the guest. - Install that kernel on the guest.
Alternatively, QEMU allows to boot the kernel directly using -kernel,
-append, -initrd command line switches. This is generally only useful if
you do not depend on modules. See QEMU documentation for more details on
this mode.
Alternatively, QEMU allows to boot the kernel directly using -kernel, - Enable the gdb stub of QEMU/KVM, either
-append, -initrd command line switches. This is generally only useful if
you do not depend on modules. See QEMU documentation for more details on
this mode.
o Enable the gdb stub of QEMU/KVM, either
- at VM startup time by appending "-s" to the QEMU command line - at VM startup time by appending "-s" to the QEMU command line
or
or
- during runtime by issuing "gdbserver" from the QEMU monitor - during runtime by issuing "gdbserver" from the QEMU monitor
console console
o cd /path/to/linux-build - cd /path/to/linux-build
o Start gdb: gdb vmlinux - Start gdb: gdb vmlinux
Note: Some distros may restrict auto-loading of gdb scripts to known safe Note: Some distros may restrict auto-loading of gdb scripts to known safe
directories. In case gdb reports to refuse loading vmlinux-gdb.py, add directories. In case gdb reports to refuse loading vmlinux-gdb.py, add::
add-auto-load-safe-path /path/to/linux-build add-auto-load-safe-path /path/to/linux-build
to ~/.gdbinit. See gdb help for more details. to ~/.gdbinit. See gdb help for more details.
- Attach to the booted guest::
o Attach to the booted guest:
(gdb) target remote :1234 (gdb) target remote :1234
Examples of using the Linux-provided gdb helpers Examples of using the Linux-provided gdb helpers
------------------------------------------------ ------------------------------------------------
o Load module (and main kernel) symbols: - Load module (and main kernel) symbols::
(gdb) lx-symbols (gdb) lx-symbols
loading vmlinux loading vmlinux
scanning for modules in /home/user/linux/build scanning for modules in /home/user/linux/build
...@@ -72,17 +78,20 @@ Examples of using the Linux-provided gdb helpers ...@@ -72,17 +78,20 @@ Examples of using the Linux-provided gdb helpers
... ...
loading @0xffffffffa0000000: /home/user/linux/build/drivers/ata/ata_generic.ko loading @0xffffffffa0000000: /home/user/linux/build/drivers/ata/ata_generic.ko
o Set a breakpoint on some not yet loaded module function, e.g.: - Set a breakpoint on some not yet loaded module function, e.g.::
(gdb) b btrfs_init_sysfs (gdb) b btrfs_init_sysfs
Function "btrfs_init_sysfs" not defined. Function "btrfs_init_sysfs" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (btrfs_init_sysfs) pending. Breakpoint 1 (btrfs_init_sysfs) pending.
o Continue the target - Continue the target::
(gdb) c (gdb) c
o Load the module on the target and watch the symbols being loaded as well as - Load the module on the target and watch the symbols being loaded as well as
the breakpoint hit: the breakpoint hit::
loading @0xffffffffa0034000: /home/user/linux/build/lib/libcrc32c.ko loading @0xffffffffa0034000: /home/user/linux/build/lib/libcrc32c.ko
loading @0xffffffffa0050000: /home/user/linux/build/lib/lzo/lzo_compress.ko loading @0xffffffffa0050000: /home/user/linux/build/lib/lzo/lzo_compress.ko
loading @0xffffffffa006e000: /home/user/linux/build/lib/zlib_deflate/zlib_deflate.ko loading @0xffffffffa006e000: /home/user/linux/build/lib/zlib_deflate/zlib_deflate.ko
...@@ -91,7 +100,8 @@ Examples of using the Linux-provided gdb helpers ...@@ -91,7 +100,8 @@ Examples of using the Linux-provided gdb helpers
Breakpoint 1, btrfs_init_sysfs () at /home/user/linux/fs/btrfs/sysfs.c:36 Breakpoint 1, btrfs_init_sysfs () at /home/user/linux/fs/btrfs/sysfs.c:36
36 btrfs_kset = kset_create_and_add("btrfs", NULL, fs_kobj); 36 btrfs_kset = kset_create_and_add("btrfs", NULL, fs_kobj);
o Dump the log buffer of the target kernel: - Dump the log buffer of the target kernel::
(gdb) lx-dmesg (gdb) lx-dmesg
[ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Initializing cgroup subsys cpu
...@@ -102,19 +112,22 @@ Examples of using the Linux-provided gdb helpers ...@@ -102,19 +112,22 @@ Examples of using the Linux-provided gdb helpers
[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved [ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
.... ....
o Examine fields of the current task struct: - Examine fields of the current task struct::
(gdb) p $lx_current().pid (gdb) p $lx_current().pid
$1 = 4998 $1 = 4998
(gdb) p $lx_current().comm (gdb) p $lx_current().comm
$2 = "modprobe\000\000\000\000\000\000\000" $2 = "modprobe\000\000\000\000\000\000\000"
o Make use of the per-cpu function for the current or a specified CPU: - Make use of the per-cpu function for the current or a specified CPU::
(gdb) p $lx_per_cpu("runqueues").nr_running (gdb) p $lx_per_cpu("runqueues").nr_running
$3 = 1 $3 = 1
(gdb) p $lx_per_cpu("runqueues", 2).nr_running (gdb) p $lx_per_cpu("runqueues", 2).nr_running
$4 = 0 $4 = 0
o Dig into hrtimers using the container_of helper: - Dig into hrtimers using the container_of helper::
(gdb) set $next = $lx_per_cpu("hrtimer_bases").clock_base[0].active.next (gdb) set $next = $lx_per_cpu("hrtimer_bases").clock_base[0].active.next
(gdb) p *$container_of($next, "struct hrtimer", "node") (gdb) p *$container_of($next, "struct hrtimer", "node")
$5 = { $5 = {
...@@ -144,7 +157,7 @@ List of commands and functions ...@@ -144,7 +157,7 @@ List of commands and functions
------------------------------ ------------------------------
The number of commands and convenience functions may evolve over the time, The number of commands and convenience functions may evolve over the time,
this is just a snapshot of the initial version: this is just a snapshot of the initial version::
(gdb) apropos lx (gdb) apropos lx
function lx_current -- Return current task function lx_current -- Return current task
......
================================
Development tools for the kernel
================================
This document is a collection of documents about development tools that can
be used to work on the kernel. For now, the documents have been pulled
together without any significant effot to integrate them into a coherent
whole; patches welcome!
.. class:: toc-title
Table of contents
.. toctree::
:maxdepth: 2
coccinelle
sparse
kcov
gcov
kasan
ubsan
kmemleak
kmemcheck
gdb-kernel-debugging
3: EARLY-STAGE PLANNING .. _development_early_stage:
Early-stage planning
====================
When contemplating a Linux kernel development project, it can be tempting When contemplating a Linux kernel development project, it can be tempting
to jump right in and start coding. As with any significant project, to jump right in and start coding. As with any significant project,
...@@ -7,7 +10,8 @@ line of code is written. Some time spent in early planning and ...@@ -7,7 +10,8 @@ line of code is written. Some time spent in early planning and
communication can save far more time later on. communication can save far more time later on.
3.1: SPECIFYING THE PROBLEM Specifying the problem
----------------------
Like any engineering project, a successful kernel enhancement starts with a Like any engineering project, a successful kernel enhancement starts with a
clear description of the problem to be solved. In some cases, this step is clear description of the problem to be solved. In some cases, this step is
...@@ -64,7 +68,8 @@ answers to a short set of questions: ...@@ -64,7 +68,8 @@ answers to a short set of questions:
Only then does it make sense to start considering possible solutions. Only then does it make sense to start considering possible solutions.
3.2: EARLY DISCUSSION Early discussion
----------------
When planning a kernel development project, it makes great sense to hold When planning a kernel development project, it makes great sense to hold
discussions with the community before launching into implementation. Early discussions with the community before launching into implementation. Early
...@@ -117,7 +122,8 @@ In each of these cases, a great deal of pain and extra work could have been ...@@ -117,7 +122,8 @@ In each of these cases, a great deal of pain and extra work could have been
avoided with some early discussion with the kernel developers. avoided with some early discussion with the kernel developers.
3.3: WHO DO YOU TALK TO? Who do you talk to?
-------------------
When developers decide to take their plans public, the next question will When developers decide to take their plans public, the next question will
be: where do we start? The answer is to find the right mailing list(s) and be: where do we start? The answer is to find the right mailing list(s) and
...@@ -141,6 +147,8 @@ development project. ...@@ -141,6 +147,8 @@ development project.
The task of finding the right maintainer is sometimes challenging enough The task of finding the right maintainer is sometimes challenging enough
that the kernel developers have added a script to ease the process: that the kernel developers have added a script to ease the process:
::
.../scripts/get_maintainer.pl .../scripts/get_maintainer.pl
This script will return the current maintainer(s) for a given file or This script will return the current maintainer(s) for a given file or
...@@ -155,7 +163,8 @@ If all else fails, talking to Andrew Morton can be an effective way to ...@@ -155,7 +163,8 @@ If all else fails, talking to Andrew Morton can be an effective way to
track down a maintainer for a specific piece of code. track down a maintainer for a specific piece of code.
3.4: WHEN TO POST? When to post?
-------------
If possible, posting your plans during the early stages can only be If possible, posting your plans during the early stages can only be
helpful. Describe the problem being solved and any plans that have been helpful. Describe the problem being solved and any plans that have been
...@@ -179,7 +188,8 @@ idea. The best thing to do in this situation is to proceed, keeping the ...@@ -179,7 +188,8 @@ idea. The best thing to do in this situation is to proceed, keeping the
community informed as you go. community informed as you go.
3.5: GETTING OFFICIAL BUY-IN Getting official buy-in
-----------------------
If your work is being done in a corporate environment - as most Linux If your work is being done in a corporate environment - as most Linux
kernel work is - you must, obviously, have permission from suitably kernel work is - you must, obviously, have permission from suitably
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册