xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/README.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. _readme:
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunLinux kernel release 5.x <http://kernel.org/>
4*4882a593Smuzhiyun=============================================
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThese are the release notes for Linux version 5.  Read them carefully,
7*4882a593Smuzhiyunas they tell you what this is all about, explain how to install the
8*4882a593Smuzhiyunkernel, and what to do if something goes wrong.
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunWhat is Linux?
11*4882a593Smuzhiyun--------------
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun  Linux is a clone of the operating system Unix, written from scratch by
14*4882a593Smuzhiyun  Linus Torvalds with assistance from a loosely-knit team of hackers across
15*4882a593Smuzhiyun  the Net. It aims towards POSIX and Single UNIX Specification compliance.
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun  It has all the features you would expect in a modern fully-fledged Unix,
18*4882a593Smuzhiyun  including true multitasking, virtual memory, shared libraries, demand
19*4882a593Smuzhiyun  loading, shared copy-on-write executables, proper memory management,
20*4882a593Smuzhiyun  and multistack networking including IPv4 and IPv6.
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun  It is distributed under the GNU General Public License v2 - see the
23*4882a593Smuzhiyun  accompanying COPYING file for more details.
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunOn what hardware does it run?
26*4882a593Smuzhiyun-----------------------------
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun  Although originally developed first for 32-bit x86-based PCs (386 or higher),
29*4882a593Smuzhiyun  today Linux also runs on (at least) the Compaq Alpha AXP, Sun SPARC and
30*4882a593Smuzhiyun  UltraSPARC, Motorola 68000, PowerPC, PowerPC64, ARM, Hitachi SuperH, Cell,
31*4882a593Smuzhiyun  IBM S/390, MIPS, HP PA-RISC, Intel IA-64, DEC VAX, AMD x86-64 Xtensa, and
32*4882a593Smuzhiyun  ARC architectures.
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun  Linux is easily portable to most general-purpose 32- or 64-bit architectures
35*4882a593Smuzhiyun  as long as they have a paged memory management unit (PMMU) and a port of the
36*4882a593Smuzhiyun  GNU C compiler (gcc) (part of The GNU Compiler Collection, GCC). Linux has
37*4882a593Smuzhiyun  also been ported to a number of architectures without a PMMU, although
38*4882a593Smuzhiyun  functionality is then obviously somewhat limited.
39*4882a593Smuzhiyun  Linux has also been ported to itself. You can now run the kernel as a
40*4882a593Smuzhiyun  userspace application - this is called UserMode Linux (UML).
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunDocumentation
43*4882a593Smuzhiyun-------------
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun - There is a lot of documentation available both in electronic form on
46*4882a593Smuzhiyun   the Internet and in books, both Linux-specific and pertaining to
47*4882a593Smuzhiyun   general UNIX questions.  I'd recommend looking into the documentation
48*4882a593Smuzhiyun   subdirectories on any Linux FTP site for the LDP (Linux Documentation
49*4882a593Smuzhiyun   Project) books.  This README is not meant to be documentation on the
50*4882a593Smuzhiyun   system: there are much better sources available.
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun - There are various README files in the Documentation/ subdirectory:
53*4882a593Smuzhiyun   these typically contain kernel-specific installation notes for some
54*4882a593Smuzhiyun   drivers for example. Please read the
55*4882a593Smuzhiyun   :ref:`Documentation/process/changes.rst <changes>` file, as it
56*4882a593Smuzhiyun   contains information about the problems, which may result by upgrading
57*4882a593Smuzhiyun   your kernel.
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunInstalling the kernel source
60*4882a593Smuzhiyun----------------------------
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun - If you install the full sources, put the kernel tarball in a
63*4882a593Smuzhiyun   directory where you have permissions (e.g. your home directory) and
64*4882a593Smuzhiyun   unpack it::
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun     xz -cd linux-5.x.tar.xz | tar xvf -
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun   Replace "X" with the version number of the latest kernel.
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun   Do NOT use the /usr/src/linux area! This area has a (usually
71*4882a593Smuzhiyun   incomplete) set of kernel headers that are used by the library header
72*4882a593Smuzhiyun   files.  They should match the library, and not get messed up by
73*4882a593Smuzhiyun   whatever the kernel-du-jour happens to be.
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun - You can also upgrade between 5.x releases by patching.  Patches are
76*4882a593Smuzhiyun   distributed in the xz format.  To install by patching, get all the
77*4882a593Smuzhiyun   newer patch files, enter the top level directory of the kernel source
78*4882a593Smuzhiyun   (linux-5.x) and execute::
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun     xz -cd ../patch-5.x.xz | patch -p1
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun   Replace "x" for all versions bigger than the version "x" of your current
83*4882a593Smuzhiyun   source tree, **in_order**, and you should be ok.  You may want to remove
84*4882a593Smuzhiyun   the backup files (some-file-name~ or some-file-name.orig), and make sure
85*4882a593Smuzhiyun   that there are no failed patches (some-file-name# or some-file-name.rej).
86*4882a593Smuzhiyun   If there are, either you or I have made a mistake.
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun   Unlike patches for the 5.x kernels, patches for the 5.x.y kernels
89*4882a593Smuzhiyun   (also known as the -stable kernels) are not incremental but instead apply
90*4882a593Smuzhiyun   directly to the base 5.x kernel.  For example, if your base kernel is 5.0
91*4882a593Smuzhiyun   and you want to apply the 5.0.3 patch, you must not first apply the 5.0.1
92*4882a593Smuzhiyun   and 5.0.2 patches. Similarly, if you are running kernel version 5.0.2 and
93*4882a593Smuzhiyun   want to jump to 5.0.3, you must first reverse the 5.0.2 patch (that is,
94*4882a593Smuzhiyun   patch -R) **before** applying the 5.0.3 patch. You can read more on this in
95*4882a593Smuzhiyun   :ref:`Documentation/process/applying-patches.rst <applying_patches>`.
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun   Alternatively, the script patch-kernel can be used to automate this
98*4882a593Smuzhiyun   process.  It determines the current kernel version and applies any
99*4882a593Smuzhiyun   patches found::
100*4882a593Smuzhiyun
101*4882a593Smuzhiyun     linux/scripts/patch-kernel linux
102*4882a593Smuzhiyun
103*4882a593Smuzhiyun   The first argument in the command above is the location of the
104*4882a593Smuzhiyun   kernel source.  Patches are applied from the current directory, but
105*4882a593Smuzhiyun   an alternative directory can be specified as the second argument.
106*4882a593Smuzhiyun
107*4882a593Smuzhiyun - Make sure you have no stale .o files and dependencies lying around::
108*4882a593Smuzhiyun
109*4882a593Smuzhiyun     cd linux
110*4882a593Smuzhiyun     make mrproper
111*4882a593Smuzhiyun
112*4882a593Smuzhiyun   You should now have the sources correctly installed.
113*4882a593Smuzhiyun
114*4882a593SmuzhiyunSoftware requirements
115*4882a593Smuzhiyun---------------------
116*4882a593Smuzhiyun
117*4882a593Smuzhiyun   Compiling and running the 5.x kernels requires up-to-date
118*4882a593Smuzhiyun   versions of various software packages.  Consult
119*4882a593Smuzhiyun   :ref:`Documentation/process/changes.rst <changes>` for the minimum version numbers
120*4882a593Smuzhiyun   required and how to get updates for these packages.  Beware that using
121*4882a593Smuzhiyun   excessively old versions of these packages can cause indirect
122*4882a593Smuzhiyun   errors that are very difficult to track down, so don't assume that
123*4882a593Smuzhiyun   you can just update packages when obvious problems arise during
124*4882a593Smuzhiyun   build or operation.
125*4882a593Smuzhiyun
126*4882a593SmuzhiyunBuild directory for the kernel
127*4882a593Smuzhiyun------------------------------
128*4882a593Smuzhiyun
129*4882a593Smuzhiyun   When compiling the kernel, all output files will per default be
130*4882a593Smuzhiyun   stored together with the kernel source code.
131*4882a593Smuzhiyun   Using the option ``make O=output/dir`` allows you to specify an alternate
132*4882a593Smuzhiyun   place for the output files (including .config).
133*4882a593Smuzhiyun   Example::
134*4882a593Smuzhiyun
135*4882a593Smuzhiyun     kernel source code: /usr/src/linux-5.x
136*4882a593Smuzhiyun     build directory:    /home/name/build/kernel
137*4882a593Smuzhiyun
138*4882a593Smuzhiyun   To configure and build the kernel, use::
139*4882a593Smuzhiyun
140*4882a593Smuzhiyun     cd /usr/src/linux-5.x
141*4882a593Smuzhiyun     make O=/home/name/build/kernel menuconfig
142*4882a593Smuzhiyun     make O=/home/name/build/kernel
143*4882a593Smuzhiyun     sudo make O=/home/name/build/kernel modules_install install
144*4882a593Smuzhiyun
145*4882a593Smuzhiyun   Please note: If the ``O=output/dir`` option is used, then it must be
146*4882a593Smuzhiyun   used for all invocations of make.
147*4882a593Smuzhiyun
148*4882a593SmuzhiyunConfiguring the kernel
149*4882a593Smuzhiyun----------------------
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun   Do not skip this step even if you are only upgrading one minor
152*4882a593Smuzhiyun   version.  New configuration options are added in each release, and
153*4882a593Smuzhiyun   odd problems will turn up if the configuration files are not set up
154*4882a593Smuzhiyun   as expected.  If you want to carry your existing configuration to a
155*4882a593Smuzhiyun   new version with minimal work, use ``make oldconfig``, which will
156*4882a593Smuzhiyun   only ask you for the answers to new questions.
157*4882a593Smuzhiyun
158*4882a593Smuzhiyun - Alternative configuration commands are::
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun     "make config"      Plain text interface.
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun     "make menuconfig"  Text based color menus, radiolists & dialogs.
163*4882a593Smuzhiyun
164*4882a593Smuzhiyun     "make nconfig"     Enhanced text based color menus.
165*4882a593Smuzhiyun
166*4882a593Smuzhiyun     "make xconfig"     Qt based configuration tool.
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun     "make gconfig"     GTK+ based configuration tool.
169*4882a593Smuzhiyun
170*4882a593Smuzhiyun     "make oldconfig"   Default all questions based on the contents of
171*4882a593Smuzhiyun                        your existing ./.config file and asking about
172*4882a593Smuzhiyun                        new config symbols.
173*4882a593Smuzhiyun
174*4882a593Smuzhiyun     "make olddefconfig"
175*4882a593Smuzhiyun                        Like above, but sets new symbols to their default
176*4882a593Smuzhiyun                        values without prompting.
177*4882a593Smuzhiyun
178*4882a593Smuzhiyun     "make defconfig"   Create a ./.config file by using the default
179*4882a593Smuzhiyun                        symbol values from either arch/$ARCH/defconfig
180*4882a593Smuzhiyun                        or arch/$ARCH/configs/${PLATFORM}_defconfig,
181*4882a593Smuzhiyun                        depending on the architecture.
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun     "make ${PLATFORM}_defconfig"
184*4882a593Smuzhiyun                        Create a ./.config file by using the default
185*4882a593Smuzhiyun                        symbol values from
186*4882a593Smuzhiyun                        arch/$ARCH/configs/${PLATFORM}_defconfig.
187*4882a593Smuzhiyun                        Use "make help" to get a list of all available
188*4882a593Smuzhiyun                        platforms of your architecture.
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun     "make allyesconfig"
191*4882a593Smuzhiyun                        Create a ./.config file by setting symbol
192*4882a593Smuzhiyun                        values to 'y' as much as possible.
193*4882a593Smuzhiyun
194*4882a593Smuzhiyun     "make allmodconfig"
195*4882a593Smuzhiyun                        Create a ./.config file by setting symbol
196*4882a593Smuzhiyun                        values to 'm' as much as possible.
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun     "make allnoconfig" Create a ./.config file by setting symbol
199*4882a593Smuzhiyun                        values to 'n' as much as possible.
200*4882a593Smuzhiyun
201*4882a593Smuzhiyun     "make randconfig"  Create a ./.config file by setting symbol
202*4882a593Smuzhiyun                        values to random values.
203*4882a593Smuzhiyun
204*4882a593Smuzhiyun     "make localmodconfig" Create a config based on current config and
205*4882a593Smuzhiyun                           loaded modules (lsmod). Disables any module
206*4882a593Smuzhiyun                           option that is not needed for the loaded modules.
207*4882a593Smuzhiyun
208*4882a593Smuzhiyun                           To create a localmodconfig for another machine,
209*4882a593Smuzhiyun                           store the lsmod of that machine into a file
210*4882a593Smuzhiyun                           and pass it in as a LSMOD parameter.
211*4882a593Smuzhiyun
212*4882a593Smuzhiyun                           Also, you can preserve modules in certain folders
213*4882a593Smuzhiyun                           or kconfig files by specifying their paths in
214*4882a593Smuzhiyun                           parameter LMC_KEEP.
215*4882a593Smuzhiyun
216*4882a593Smuzhiyun                   target$ lsmod > /tmp/mylsmod
217*4882a593Smuzhiyun                   target$ scp /tmp/mylsmod host:/tmp
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun                   host$ make LSMOD=/tmp/mylsmod \
220*4882a593Smuzhiyun                           LMC_KEEP="drivers/usb:drivers/gpu:fs" \
221*4882a593Smuzhiyun                           localmodconfig
222*4882a593Smuzhiyun
223*4882a593Smuzhiyun                           The above also works when cross compiling.
224*4882a593Smuzhiyun
225*4882a593Smuzhiyun     "make localyesconfig" Similar to localmodconfig, except it will convert
226*4882a593Smuzhiyun                           all module options to built in (=y) options. You can
227*4882a593Smuzhiyun                           also preserve modules by LMC_KEEP.
228*4882a593Smuzhiyun
229*4882a593Smuzhiyun     "make kvmconfig"   Enable additional options for kvm guest kernel support.
230*4882a593Smuzhiyun
231*4882a593Smuzhiyun     "make xenconfig"   Enable additional options for xen dom0 guest kernel
232*4882a593Smuzhiyun                        support.
233*4882a593Smuzhiyun
234*4882a593Smuzhiyun     "make tinyconfig"  Configure the tiniest possible kernel.
235*4882a593Smuzhiyun
236*4882a593Smuzhiyun   You can find more information on using the Linux kernel config tools
237*4882a593Smuzhiyun   in Documentation/kbuild/kconfig.rst.
238*4882a593Smuzhiyun
239*4882a593Smuzhiyun - NOTES on ``make config``:
240*4882a593Smuzhiyun
241*4882a593Smuzhiyun    - Having unnecessary drivers will make the kernel bigger, and can
242*4882a593Smuzhiyun      under some circumstances lead to problems: probing for a
243*4882a593Smuzhiyun      nonexistent controller card may confuse your other controllers.
244*4882a593Smuzhiyun
245*4882a593Smuzhiyun    - A kernel with math-emulation compiled in will still use the
246*4882a593Smuzhiyun      coprocessor if one is present: the math emulation will just
247*4882a593Smuzhiyun      never get used in that case.  The kernel will be slightly larger,
248*4882a593Smuzhiyun      but will work on different machines regardless of whether they
249*4882a593Smuzhiyun      have a math coprocessor or not.
250*4882a593Smuzhiyun
251*4882a593Smuzhiyun    - The "kernel hacking" configuration details usually result in a
252*4882a593Smuzhiyun      bigger or slower kernel (or both), and can even make the kernel
253*4882a593Smuzhiyun      less stable by configuring some routines to actively try to
254*4882a593Smuzhiyun      break bad code to find kernel problems (kmalloc()).  Thus you
255*4882a593Smuzhiyun      should probably answer 'n' to the questions for "development",
256*4882a593Smuzhiyun      "experimental", or "debugging" features.
257*4882a593Smuzhiyun
258*4882a593SmuzhiyunCompiling the kernel
259*4882a593Smuzhiyun--------------------
260*4882a593Smuzhiyun
261*4882a593Smuzhiyun - Make sure you have at least gcc 4.9 available.
262*4882a593Smuzhiyun   For more information, refer to :ref:`Documentation/process/changes.rst <changes>`.
263*4882a593Smuzhiyun
264*4882a593Smuzhiyun   Please note that you can still run a.out user programs with this kernel.
265*4882a593Smuzhiyun
266*4882a593Smuzhiyun - Do a ``make`` to create a compressed kernel image. It is also
267*4882a593Smuzhiyun   possible to do ``make install`` if you have lilo installed to suit the
268*4882a593Smuzhiyun   kernel makefiles, but you may want to check your particular lilo setup first.
269*4882a593Smuzhiyun
270*4882a593Smuzhiyun   To do the actual install, you have to be root, but none of the normal
271*4882a593Smuzhiyun   build should require that. Don't take the name of root in vain.
272*4882a593Smuzhiyun
273*4882a593Smuzhiyun - If you configured any of the parts of the kernel as ``modules``, you
274*4882a593Smuzhiyun   will also have to do ``make modules_install``.
275*4882a593Smuzhiyun
276*4882a593Smuzhiyun - Verbose kernel compile/build output:
277*4882a593Smuzhiyun
278*4882a593Smuzhiyun   Normally, the kernel build system runs in a fairly quiet mode (but not
279*4882a593Smuzhiyun   totally silent).  However, sometimes you or other kernel developers need
280*4882a593Smuzhiyun   to see compile, link, or other commands exactly as they are executed.
281*4882a593Smuzhiyun   For this, use "verbose" build mode.  This is done by passing
282*4882a593Smuzhiyun   ``V=1`` to the ``make`` command, e.g.::
283*4882a593Smuzhiyun
284*4882a593Smuzhiyun     make V=1 all
285*4882a593Smuzhiyun
286*4882a593Smuzhiyun   To have the build system also tell the reason for the rebuild of each
287*4882a593Smuzhiyun   target, use ``V=2``.  The default is ``V=0``.
288*4882a593Smuzhiyun
289*4882a593Smuzhiyun - Keep a backup kernel handy in case something goes wrong.  This is
290*4882a593Smuzhiyun   especially true for the development releases, since each new release
291*4882a593Smuzhiyun   contains new code which has not been debugged.  Make sure you keep a
292*4882a593Smuzhiyun   backup of the modules corresponding to that kernel, as well.  If you
293*4882a593Smuzhiyun   are installing a new kernel with the same version number as your
294*4882a593Smuzhiyun   working kernel, make a backup of your modules directory before you
295*4882a593Smuzhiyun   do a ``make modules_install``.
296*4882a593Smuzhiyun
297*4882a593Smuzhiyun   Alternatively, before compiling, use the kernel config option
298*4882a593Smuzhiyun   "LOCALVERSION" to append a unique suffix to the regular kernel version.
299*4882a593Smuzhiyun   LOCALVERSION can be set in the "General Setup" menu.
300*4882a593Smuzhiyun
301*4882a593Smuzhiyun - In order to boot your new kernel, you'll need to copy the kernel
302*4882a593Smuzhiyun   image (e.g. .../linux/arch/x86/boot/bzImage after compilation)
303*4882a593Smuzhiyun   to the place where your regular bootable kernel is found.
304*4882a593Smuzhiyun
305*4882a593Smuzhiyun - Booting a kernel directly from a floppy without the assistance of a
306*4882a593Smuzhiyun   bootloader such as LILO, is no longer supported.
307*4882a593Smuzhiyun
308*4882a593Smuzhiyun   If you boot Linux from the hard drive, chances are you use LILO, which
309*4882a593Smuzhiyun   uses the kernel image as specified in the file /etc/lilo.conf.  The
310*4882a593Smuzhiyun   kernel image file is usually /vmlinuz, /boot/vmlinuz, /bzImage or
311*4882a593Smuzhiyun   /boot/bzImage.  To use the new kernel, save a copy of the old image
312*4882a593Smuzhiyun   and copy the new image over the old one.  Then, you MUST RERUN LILO
313*4882a593Smuzhiyun   to update the loading map! If you don't, you won't be able to boot
314*4882a593Smuzhiyun   the new kernel image.
315*4882a593Smuzhiyun
316*4882a593Smuzhiyun   Reinstalling LILO is usually a matter of running /sbin/lilo.
317*4882a593Smuzhiyun   You may wish to edit /etc/lilo.conf to specify an entry for your
318*4882a593Smuzhiyun   old kernel image (say, /vmlinux.old) in case the new one does not
319*4882a593Smuzhiyun   work.  See the LILO docs for more information.
320*4882a593Smuzhiyun
321*4882a593Smuzhiyun   After reinstalling LILO, you should be all set.  Shutdown the system,
322*4882a593Smuzhiyun   reboot, and enjoy!
323*4882a593Smuzhiyun
324*4882a593Smuzhiyun   If you ever need to change the default root device, video mode,
325*4882a593Smuzhiyun   etc. in the kernel image, use your bootloader's boot options
326*4882a593Smuzhiyun   where appropriate.  No need to recompile the kernel to change
327*4882a593Smuzhiyun   these parameters.
328*4882a593Smuzhiyun
329*4882a593Smuzhiyun - Reboot with the new kernel and enjoy.
330*4882a593Smuzhiyun
331*4882a593SmuzhiyunIf something goes wrong
332*4882a593Smuzhiyun-----------------------
333*4882a593Smuzhiyun
334*4882a593Smuzhiyun - If you have problems that seem to be due to kernel bugs, please check
335*4882a593Smuzhiyun   the file MAINTAINERS to see if there is a particular person associated
336*4882a593Smuzhiyun   with the part of the kernel that you are having trouble with. If there
337*4882a593Smuzhiyun   isn't anyone listed there, then the second best thing is to mail
338*4882a593Smuzhiyun   them to me (torvalds@linux-foundation.org), and possibly to any other
339*4882a593Smuzhiyun   relevant mailing-list or to the newsgroup.
340*4882a593Smuzhiyun
341*4882a593Smuzhiyun - In all bug-reports, *please* tell what kernel you are talking about,
342*4882a593Smuzhiyun   how to duplicate the problem, and what your setup is (use your common
343*4882a593Smuzhiyun   sense).  If the problem is new, tell me so, and if the problem is
344*4882a593Smuzhiyun   old, please try to tell me when you first noticed it.
345*4882a593Smuzhiyun
346*4882a593Smuzhiyun - If the bug results in a message like::
347*4882a593Smuzhiyun
348*4882a593Smuzhiyun     unable to handle kernel paging request at address C0000010
349*4882a593Smuzhiyun     Oops: 0002
350*4882a593Smuzhiyun     EIP:   0010:XXXXXXXX
351*4882a593Smuzhiyun     eax: xxxxxxxx   ebx: xxxxxxxx   ecx: xxxxxxxx   edx: xxxxxxxx
352*4882a593Smuzhiyun     esi: xxxxxxxx   edi: xxxxxxxx   ebp: xxxxxxxx
353*4882a593Smuzhiyun     ds: xxxx  es: xxxx  fs: xxxx  gs: xxxx
354*4882a593Smuzhiyun     Pid: xx, process nr: xx
355*4882a593Smuzhiyun     xx xx xx xx xx xx xx xx xx xx
356*4882a593Smuzhiyun
357*4882a593Smuzhiyun   or similar kernel debugging information on your screen or in your
358*4882a593Smuzhiyun   system log, please duplicate it *exactly*.  The dump may look
359*4882a593Smuzhiyun   incomprehensible to you, but it does contain information that may
360*4882a593Smuzhiyun   help debugging the problem.  The text above the dump is also
361*4882a593Smuzhiyun   important: it tells something about why the kernel dumped code (in
362*4882a593Smuzhiyun   the above example, it's due to a bad kernel pointer). More information
363*4882a593Smuzhiyun   on making sense of the dump is in Documentation/admin-guide/bug-hunting.rst
364*4882a593Smuzhiyun
365*4882a593Smuzhiyun - If you compiled the kernel with CONFIG_KALLSYMS you can send the dump
366*4882a593Smuzhiyun   as is, otherwise you will have to use the ``ksymoops`` program to make
367*4882a593Smuzhiyun   sense of the dump (but compiling with CONFIG_KALLSYMS is usually preferred).
368*4882a593Smuzhiyun   This utility can be downloaded from
369*4882a593Smuzhiyun   https://www.kernel.org/pub/linux/utils/kernel/ksymoops/ .
370*4882a593Smuzhiyun   Alternatively, you can do the dump lookup by hand:
371*4882a593Smuzhiyun
372*4882a593Smuzhiyun - In debugging dumps like the above, it helps enormously if you can
373*4882a593Smuzhiyun   look up what the EIP value means.  The hex value as such doesn't help
374*4882a593Smuzhiyun   me or anybody else very much: it will depend on your particular
375*4882a593Smuzhiyun   kernel setup.  What you should do is take the hex value from the EIP
376*4882a593Smuzhiyun   line (ignore the ``0010:``), and look it up in the kernel namelist to
377*4882a593Smuzhiyun   see which kernel function contains the offending address.
378*4882a593Smuzhiyun
379*4882a593Smuzhiyun   To find out the kernel function name, you'll need to find the system
380*4882a593Smuzhiyun   binary associated with the kernel that exhibited the symptom.  This is
381*4882a593Smuzhiyun   the file 'linux/vmlinux'.  To extract the namelist and match it against
382*4882a593Smuzhiyun   the EIP from the kernel crash, do::
383*4882a593Smuzhiyun
384*4882a593Smuzhiyun     nm vmlinux | sort | less
385*4882a593Smuzhiyun
386*4882a593Smuzhiyun   This will give you a list of kernel addresses sorted in ascending
387*4882a593Smuzhiyun   order, from which it is simple to find the function that contains the
388*4882a593Smuzhiyun   offending address.  Note that the address given by the kernel
389*4882a593Smuzhiyun   debugging messages will not necessarily match exactly with the
390*4882a593Smuzhiyun   function addresses (in fact, that is very unlikely), so you can't
391*4882a593Smuzhiyun   just 'grep' the list: the list will, however, give you the starting
392*4882a593Smuzhiyun   point of each kernel function, so by looking for the function that
393*4882a593Smuzhiyun   has a starting address lower than the one you are searching for but
394*4882a593Smuzhiyun   is followed by a function with a higher address you will find the one
395*4882a593Smuzhiyun   you want.  In fact, it may be a good idea to include a bit of
396*4882a593Smuzhiyun   "context" in your problem report, giving a few lines around the
397*4882a593Smuzhiyun   interesting one.
398*4882a593Smuzhiyun
399*4882a593Smuzhiyun   If you for some reason cannot do the above (you have a pre-compiled
400*4882a593Smuzhiyun   kernel image or similar), telling me as much about your setup as
401*4882a593Smuzhiyun   possible will help.  Please read the :ref:`admin-guide/reporting-bugs.rst <reportingbugs>`
402*4882a593Smuzhiyun   document for details.
403*4882a593Smuzhiyun
404*4882a593Smuzhiyun - Alternatively, you can use gdb on a running kernel. (read-only; i.e. you
405*4882a593Smuzhiyun   cannot change values or set break points.) To do this, first compile the
406*4882a593Smuzhiyun   kernel with -g; edit arch/x86/Makefile appropriately, then do a ``make
407*4882a593Smuzhiyun   clean``. You'll also need to enable CONFIG_PROC_FS (via ``make config``).
408*4882a593Smuzhiyun
409*4882a593Smuzhiyun   After you've rebooted with the new kernel, do ``gdb vmlinux /proc/kcore``.
410*4882a593Smuzhiyun   You can now use all the usual gdb commands. The command to look up the
411*4882a593Smuzhiyun   point where your system crashed is ``l *0xXXXXXXXX``. (Replace the XXXes
412*4882a593Smuzhiyun   with the EIP value.)
413*4882a593Smuzhiyun
414*4882a593Smuzhiyun   gdb'ing a non-running kernel currently fails because ``gdb`` (wrongly)
415*4882a593Smuzhiyun   disregards the starting offset for which the kernel is compiled.
416