|
版权声明
本文作者是一位自由软件和Linux系统爱好者,所以本文虽然不是软件,但是本着 GPL 的精神发布。任何人都可以自由使用、转载、复制和再分发,但必须保留作者署名,亦不得对声明中的任何条款作任何形式的修改,也不得附加任何其它条件。您可以自由链接、下载、传播此文档,但前提是必须保证全文完整转载,包括完整的版权信息和作译者声明。
原链接http://weiweiabc109.blog.163.com ... 357220121593937965/
博客链接http://weiweiabc109.blog.163.com
Linux kernel release 2.6.xx <http://kernel.org/>
These are the release notes for Linux version 2.6. Read them carefully,
这是一个linux 2.6版本的发布说明。仔细阅读它,
as they tell you what this is all about, explain how to install the
它会告诉你所有关于linux2.6的信息,和怎么安装内核的说明
kernel, and what to do if something goes wrong.
以及如果出现错误时你应该怎么做。
WHAT IS LINUX?
什么是linux
Linux is a clone of the operating system Unix, written from scratch by
linux是一个unix系统的克隆,由Linus Torvalds
Linus Torvalds with assistance from a loosely-knit team of hackers across
在loosely-knit的网络黑客团队的援助下从无到有地编写出来的。
the Net. It aims towards POSIX and Single UNIX Specification compliance.
它符合POSIX和单一UNIX规格条款。
It has all the features you would expect in a modern fully-fledged Unix,
它拥有你所期望的完全成熟的Unix特性,
including true multitasking, virtual memory, shared libraries, demand
包括真正的多重任务处理,虚拟内存,共享库,按需加载
loading, shared copy-on-write executables, proper memory management,
共享的写时拷贝可执行文件,适当的内存管理,
and multistack networking including IPv4 and IPv6.
和模块化?网络协议包括IPv4和IPv6。
It is distributed under the GNU General Public License - see the
它在GNU通用公共协议下被发行——查看附随的
accompanying COPYING file for more details.
副本文件可以获得更多的信息。
ON WHAT HARDWARE DOES IT RUN?
在什么硬件上运行它?
Although originally developed first for 32-bit x86-based PCs (386 or higher),
尽管它最初被开发的第一个版本是在32位的x86架构的PC机上(386或者更高),
today Linux also runs on (at least) the Compaq Alpha AXP, Sun SPARC and
但linux如今也能运行在(至少)Compaq Alpha AXP, Sun SPARC和
UltraSPARC, Motorola 68000, PowerPC, PowerPC64, ARM, Hitachi SuperH, Cell,
UltraSPARC, Motorola 68000, PowerPC, PowerPC64, ARM, Hitachi SuperH, Cell,
IBM S/390, MIPS, HP PA-RISC, Intel IA-64, DEC VAX, AMD x86-64, AXIS CRIS,
IBM S/390, MIPS, HP PA-RISC, Intel IA-64, DEC VAX, AMD x86-64, AXIS CRIS,
Xtensa, AVR32 and Renesas M32R architectures.
Xtensa, AVR32和 Renesas M32R架构的机器上。
Linux is easily portable to most general-purpose 32- or 64-bit architectures
Linux是简单便携的,对于大多数目的,应用32位或64位在架构的机器上
as long as they have a paged memory management unit (PMMU) and a port of the
只要它们有一片内存管理单元和一个GNU C编译器(gcc)端口。
GNU C compiler (gcc) (part of The GNU Compiler Collection, GCC). Linux has
also been ported to a number of architectures without a PMMU, although
Linux也可以移植到若干个没有PMMU的架构上,尽管
functionality is then obviously somewhat limited.
功能这样的架构在功能上会有一些限制。
Linux has also been ported to itself. You can now run the kernel as a
Linux也可以自我移植。你可以以现在运行的内核作为一个
userspace application - this is called UserMode Linux (UML).
用户空间应用——这叫做用户模式Linux。
DOCUMENTATION:
文档资料:
- There is a lot of documentation available both in electronic form on
这里有很多可用的资料文件既有电子版的也有
the Internet and in books, both Linux-specific and pertaining to
在书上的,既有Linux特性的,也有关于
general UNIX questions. I'd recommend looking into the documentation
一般的UNIX问题。我推荐在任何LDP(Linux 文档资料工程)
subdirectories on any Linux FTP site for the LDP (Linux Documentation
的Linux FTP站点文档资料的子目录查找需要的书籍。
Project) books. This README is not meant to be documentation on the
这个README(读我)并不是系统的文档。
system: there are much better sources available.
网站上会有更好地资源。
- There are various README files in the Documentation/ subdirectory:
在Documentation(文档)目录的子目录中有各种README(读我)文件
these typically contain kernel-specific installation notes for some
这些代表性地包含了内核特性,作为例子的一些驱动安装说明。
drivers for example. See Documentation/00-INDEX for a list of what
看Documentation目录中的00-INDEX来查看包含了各个文件的列表。
is contained in each file. Please read the Changes file, as it
请读更改日志,
contains information about the problems, which may result by upgrading
它包含了你升级内核后可能产生的问题。
your kernel.
- The Documentation/DocBook/ subdirectory contains several guides for
Documentation目录下的DocBook子目录包含很多内核开发者和使用者的向导。
kernel developers and users. These guides can be rendered in a
这些向导被写成很多
number of formats: PostScript (.ps), PDF, HTML, & man-pages, among others.
格式:PostScript (.ps), PDF, HTML, & man-pages(man手册页)的其中
After installation, "make psdocs", "make pdfdocs", "make htmldocs",
安装文档后,可以通过"make psdocs", "make pdfdocs", "make htmldocs"
or "make mandocs" will render the documentation in the requested format.
"make mandocs"命令来转换成你想要的格式的文档。
INSTALLING the kernel source:
安装内核源码:
- If you install the full sources, put the kernel tarball in a
如果你安装完整的源码,将内核的tarball放置到一个
directory where you have permissions (eg. your home directory) and
你拥有权限的目录中(例如,你的home目录)然后
unpack it:
加压它:
gzip -cd linux-2.6.XX.tar.gz | tar xvf -
or
或
bzip2 -dc linux-2.6.XX.tar.bz2 | tar xvf -
Replace "XX" with the version number of the latest kernel.
替换“XX”为实际的版本号。(不一定是最新的)
Do NOT use the /usr/src/linux area! This area has a (usually
不要使用/usr/src/linux区域!该区域(不完全)
incomplete) set of kernel headers that are used by the library header
被设置成放置用作库头文件的内核头。
files. They should match the library, and not get messed up by
他们应当与库匹配,并且无论发生什么样巧合都不应当使磁盘使用情况
whatever the kernel-du-jour happens to be.
发生混乱。
- You can also upgrade between 2.6.xx releases by patching. Patches are
你也可以通过补丁来升级2.6.xx的版本。补丁
distributed in the traditional gzip and the newer bzip2 format. To
被发行在传统的gzip或新的bzip2格式压缩包中。
install by patching, get all the newer patch files, enter the
要使用补丁安装,先得到所有更新的补丁文件,进入
top level directory of the kernel source (linux-2.6.xx) and execute:
内核源码的最上层目录然后执行:
gzip -cd ../patch-2.6.xx.gz | patch -p1
or
或
bzip2 -dc ../patch-2.6.xx.bz2 | patch -p1
(repeat xx for all versions bigger than the version of your current
(修改XX为大于你当前的内核
source tree, _in_order_) and you should be ok. You may want to remove
源码树,按顺序的)这样就可以了。你可能想移除那些
the backup files (xxx~ or xxx.orig), and make sure that there are no
备份文件,要确保没有
failed patches (xxx# or xxx.rej). If there are, either you or me has
失败的补丁。如果有失败的补丁,无论你还是我都会
made a mistake.
出现错误。
Unlike patches for the 2.6.x kernels, patches for the 2.6.x.y kernels
与2.6.x的内核补丁不同,2.6.x.y的内核
(also known as the -stable kernels) are not incremental but instead apply
(也被认为是-stable(稳定)内核)不是增强型的,但直接替代
directly to the base 2.6.x kernel. Please read
基于2.6.x的内核。请阅读
Documentation/applying-patches.txt for more information.
Documentation目录下的applying-patches.txt以获得更多信息。
Alternatively, the script patch-kernel can be used to automate this
或者,使用内核补丁脚本,它被用来自动完成这个
process. It determines the current kernel version and applies any
过程。它确定当前的内核版本然后应用
patches found.
找到的补丁。
linux/scripts/patch-kernel linux
The first argument in the command above is the location of the
上面的命令中的第一个参数内核源码的位置。
kernel source. Patches are applied from the current directory, but
补丁被应用在当前的路径,但是
an alternative directory can be specified as the second argument.
也可以使用第二个参数指定替代路径。
- If you are upgrading between releases using the stable series patches
如果你使用补丁从一个稳定版本升级到两一个稳定版
(for example, patch-2.6.xx.y), note that these "dot-releases" are
(例如,patch-2.6.xx.y),注意那些“圆点-release”
not incremental and must be applied to the 2.6.xx base tree. For
不是增强型的,并且必须被应用在2.6.xx基础树上。
example, if your base kernel is 2.6.12 and you want to apply the
例如,如果你的内核是2.6.12,并你想应用
2.6.12.3 patch, you do not and indeed must not first apply the
2.6.12.3的补丁,你不必应用
2.6.12.1 and 2.6.12.2 patches. Similarly, if you are running kernel
2.6.12.1和2.6.12.2的补丁。类似地,如果你运行的内核是
version 2.6.12.2 and want to jump to 2.6.12.3, you must first
版本是2.6.12.2并想要升级到2.6.12.3,你必须先
reverse the 2.6.12.2 patch (that is, patch -R) _before_ applying
还原2.6.12.2补丁(使用patch -R),然后再应用
the 2.6.12.3 patch.
2.6.12.3补丁。
You can read more on this in Documentation/applying-patches.txt
你可以在Documentation目录的applying-patches.txt上阅读更多信息。
- Make sure you have no stale .o files and dependencies lying around:
确定你没有陈旧的.o文件和他们的依赖文件。
cd linux
make mrproper
You should now have the sources correctly installed.
你应该已经正确地安装了源码。
SOFTWARE REQUIREMENTS
软件要求
Compiling and running the 2.6.xx kernels requires up-to-date
编译和运行2.6.xx内核要求
versions of various software packages. Consult
各种软件的最新版本。查阅
Documentation/Changes for the minimum version numbers required
Documentation目录中的Changes可以获得要求的最小版本
and how to get updates for these packages. Beware that using
和怎么样去获得他们的升级版本。当心使用
excessively old versions of these packages can cause indirect
过低版本的软件包,否则会引发非常难以捕捉的间接
errors that are very difficult to track down, so don't assume that
错误,所以不要假设
you can just update packages when obvious problems arise during
在编译和操作遇到明显错误引发时仅仅升级那些包就能够解决问题。
build or operation.
BUILD directory for the kernel:
为内核建立目录:
When compiling the kernel all output files will per default be
编译内核的所有输出文件会默认地
stored together with the kernel source code.
和内核源码存储在一起。
Using the option "make O=output/dir" allow you to specify an alternate
使用选项“make O=output/dir”允许你去指定一个替代路径
place for the output files (including .config).
去存放输出文件(包括.config)。
Example:
例如:
kernel source code: /usr/src/linux-2.6.N
内核源码: /usr/src/linux-2.6.N
build directory: /home/name/build/kernel
构建路径: /home/name/build/kernel
To configure and build the kernel use:
配置和构建内核使用命令:
cd /usr/src/linux-2.6.N
make O=/home/name/build/kernel menuconfig
make O=/home/name/build/kernel
sudo make O=/home/name/build/kernel modules_install install
Please note: If the 'O=output/dir' option is used then it must be
请注意:如果“O=output/dir”选项被使用,那么就必须
used for all invocations of make.
在所有的编译装置时使用该选项。
CONFIGURING the kernel:
配置内核:
Do not skip this step even if you are only upgrading one minor
不要跳过这一步甚至你只是升级一个次级版本。
version. New configuration options are added in each release, and
版本。新的配置选项被添加,
odd problems will turn up if the configuration files are not set up
如果配置文件没有预期得配置好,临时问题就会出现。
as expected. If you want to carry your existing configuration to a
如果你想使用一个存在的配置文件使得
new version with minimal work, use "make oldconfig", which will
新版本内核能最低限度工作,可以使用“make oldconfig”,这样
only ask you for the answers to new questions.
只会询问你新选项的答案。
- Alternate configuration commands are:
其他的配置命令是:
"make config" Plain text interface.
纯文版界面。
"make menuconfig" Text based color menus, radiolists & dialogs.
文本底色菜单,单选列表和对话框。
"make xconfig" X windows (Qt) based configuration tool.
x窗口(Qt)的配置工具。
"make gconfig" X windows (Gtk) based configuration tool.
x窗口(Gtk)的配置工具。
"make oldconfig" Default all questions based on the contents of
默认所有现存的.config中的选项,
your existing ./.config file and asking about
只询问新的选项。
new config symbols.
"make silentoldconfig"
Like above, but avoids cluttering the screen
跟上一个一样,但是避免了已经选好选项
with questions already answered.
使屏幕布局有些凌乱。
Additionally updates the dependencies.
另外升级了依赖性。
"make defconfig" Create a ./.config file by using the default
创建了.config文件,它使用arch/$ARCH/defconfig
symbol values from either arch/$ARCH/defconfig
或arch/$ARCH/configs/${PLATFORM}_defconfig
or arch/$ARCH/configs/${PLATFORM}_defconfig,
depending on the architecture.
的值,这取决于系统架构。
"make ${PLATFORM}_defconfig"
Create a ./.config file by using the default
创建一个.config文件,它使用
symbol values from
arch/$ARCH/configs/${PLATFORM}_defconfig的值
arch/$ARCH/configs/${PLATFORM}_defconfig.
Use "make help" to get a list of all available
使用“make help”可以得到所有平台的值的列表,
platforms of your architecture.
取决于你的机器架构。
"make allyesconfig"
Create a ./.config file by setting symbol
创建一个.config文件,尽可能的将
values to 'y' as much as possible.
选项的值设置为“y”。
"make allmodconfig"
Create a ./.config file by setting symbol
创建一个.config文件,尽可能的将
values to 'm' as much as possible.
选项的值设置为“m”
"make allnoconfig" Create a ./.config file by setting symbol
创建一个.config文件,尽可能的将
values to 'n' as much as possible.
选项的值设置为“n”
"make randconfig" Create a ./.config file by setting symbol
创建一个.config文件,将
values to random values.
选项的值随机设置。
You can find more information on using the Linux kernel config tools
你可以在Documentation/kbuild/kconfig.txt上找到更多关于使用Linux内核配置工具的信息
in Documentation/kbuild/kconfig.txt.
NOTES on "make config":
“make config”的说明:
- having unnecessary drivers will make the kernel bigger, and can
设置上没有用的驱动将会导致内核变得庞大,
under some circumstances lead to problems: probing for a
并会在某些情况下导致问题:搜索一个
nonexistent controller card may confuse your other controllers
不存在的控制器卡可能会使其他的控制器卡混乱(而不能正确驱动)。
- compiling the kernel with "rocessor type" set higher than 386
在编译内核时,“Processor type”(处理器类型)设置大于386的话
will result in a kernel that does NOT work on a 386. The
可能造成的结果是不能在386机器上工作。
kernel will detect this on bootup, and give up.
内核会在启动的时候判断处理器类型,如果不符合,会放弃启动。
- A kernel with math-emulation compiled in will still use the
一个将math-emulation编译进去的内核将仍会使用协处理器,如果
coprocessor if one is present: the math emulation will just
存在协处理器的话:数字仿真器将
never get used in that case. The kernel will be slightly larger,
从不被使用到。而内核会略微变大,
but will work on different machines regardless of whether they
但仍可以在不同的机器上工作,不管它们是否
have a math coprocessor or not.
有数字协处理器。
- the "kernel hacking" configuration details usually result in a
“kernel hacking”配置的选项很多的话,通常会致使
bigger or slower kernel (or both), and can even make the kernel
内核变大或变慢(或者又大又慢),甚至会使内核
less stable by configuring some routines to actively try to
不稳定。通常一些做法可以积极地试图
break bad code to find kernel problems (kmalloc()). Thus you
打破错误的代码从而找到内核问题。因此你
should probably answer 'n' to the questions for
或许应当回答“n”来实现不编译
"development", "experimental", or "debugging" features.
"development"(开发), "experimental"(试验),或"debugging"(调试)的特性
COMPILING the kernel:
编译内核
- Make sure you have at least gcc 3.2 available.
确定你有最新可用的gcc
For more information, refer to Documentation/Changes.
想知道更多信息,可以参考Documentation/Changes。
Please note that you can still run a.out user programs with this kernel.
请注意你仍然可以通过这个内核运行a.out的用户程序
- Do a "make" to create a compressed kernel image. It is also
使用“make”去创建一个压缩的内核镜像。
possible to do "make install" if you have lilo installed to suit the
如果你安装了lilo并适合内核的makefile,也可以使用“make install”命令
kernel makefiles, but you may want to check your particular lilo setup first.
但是,你应该先检查你自己的lilo配置。
To do the actual install you have to be root, but none of the normal
要实际安装内核,你必须是root用户,除此以外没有
build should require that. Don't take the name of root in vain.
别的要求。不要使root用户是空的。
- If you configured any of the parts of the kernel as `modules', you
如果你将内核的任何一个部分作为“modules”(模块)编译,
will also have to do "make modules_install".
你还必须使用“make modules_install”命令。
- Verbose kernel compile/build output:
详细的内核编译输出:
Normally the kernel build system runs in a fairly quiet mode (but not
通常内核编译选择安静模式进行运行(但不是完全的安静模式)。
totally silent). However, sometimes you or other kernel developers need
然而,有些适合你或其他的内核开发人员需要
to see compile, link, or other commands exactly as they are executed.
看到编译、链接或其他命令精确的信息。
For this, use "verbose" build mode. This is done by inserting
因此,使用“verbose”编译模块。这样做的方法是插入
"V=1" in the "make" command. E.g.:
“V=1”到“make”命令中。如:
make V=1 all
To have the build system also tell the reason for the rebuild of each
编译程序可以使用“V=2”参数来重建内核。
target, use "V=2". The default is "V=0".
默认的参数是“V=0”
- Keep a backup kernel handy in case something goes wrong. This is
保存一个内核副本,以防万一出现错误。对于开发版本来说,这是
especially true for the development releases, since each new release
非常正确的做法。当新的没有测试过的版本释放出以后就应该这样做。
contains new code which has not been debugged. Make sure you keep a
确保你有一个
backup of the modules corresponding to that kernel, as well. If you
备份好的与内核一直的模块副本。如果你
are installing a new kernel with the same version number as your
安装一个与你当前版本相同的新的内核作为你的工作内核,
working kernel, make a backup of your modules directory before you
首先要在使用“make modules_instal”命令前备份模块目录。
do a "make modules_install".
Alternatively, before compiling, use the kernel config option
另外,在编译内核的时候,可以使用内核配置选项
"LOCALVERSION" to append a unique suffix to the regular kernel version.
“LOCALVERSION”来添加一个符合内核版本号的独有的后缀。
LOCALVERSION can be set in the "General Setup" menu.
LOCALVERSION 可以在“General Setup”菜单中设置。
- In order to boot your new kernel, you'll need to copy the kernel
为了引导你的新内核,你需要复制内核
image (e.g. .../linux/arch/i386/boot/bzImage after compilation)
镜像(如:.../linux/arch/i386/boot/bzImage 编译后的文件)
to the place where your regular bootable kernel is found.
替换你平时引导的内核。
- Booting a kernel directly from a floppy without the assistance of a
直接从软驱引导内核而不借助诸如LILO这样的辅助工具
bootloader such as LILO, is no longer supported.
已经不再被支持了。
If you boot Linux from the hard drive, chances are you use LILO which
如果你引导Linux是从硬盘驱动器上,有可能你使用的LILO
uses the kernel image as specified in the file /etc/lilo.conf. The
的/etc/lilo.conf作为配置文件来引导内核。
kernel image file is usually /vmlinuz, /boot/vmlinuz, /bzImage or
内核镜像文件通常是 /vmlinuz、/boot/vmlinuz、/bzImage或者
/boot/bzImage. To use the new kernel, save a copy of the old image
/boot/bzImage。要使用新的内核前,先复制一个旧内核镜像的副本
and copy the new image over the old one. Then, you MUST RERUN LILO
然后复制新的内核镜像来覆盖旧的。然后,你需要重新运行LILO
to update the loading map!! If you don't, you won't be able to boot
来更新引导模块!!如果你不这样做,就不能使用新的内核引导系统。
the new kernel image.
Reinstalling LILO is usually a matter of running /sbin/lilo.
重新安装LILO通常运行/sbin/lilo命令。
You may wish to edit /etc/lilo.conf to specify an entry for your
你可能希望去编辑/etc/lilo.conf来指定进入你的
old kernel image (say, /vmlinux.old) in case the new one does not
旧的内核镜像(如:/vmlinux.old)这种情况新的内核则不会
work. See the LILO docs for more information.
工作。查看LILO的文档可以获得更多的信息。
After reinstalling LILO, you should be all set. Shutdown the system,
在重新安装LILO后,你应该将其设置好。关闭系统,
reboot, and enjoy!
重启,祝你愉快!
If you ever need to change the default root device, video mode,
如果你曾需要去改变默认的root装置、视频模式、
ramdisk size, etc. in the kernel image, use the 'rdev' program (or
虚拟内存大小等等,在内核镜像中,使用“rdev”指令(或
alternatively the LILO boot options when appropriate). No need to
在适当的时候用LILO引导选项)。不需要
recompile the kernel to change these parameters.
重新编译内核来改变这些参数。
- Reboot with the new kernel and enjoy.
重新引导新的内核愉快。
IF SOMETHING GOES WRONG:
如果出现了一些错误:
- If you have problems that seem to be due to kernel bugs, please check
如果你有一些看起来像是由于内核bug的错误,请检查
the file MAINTAINERS to see if there is a particular person associated
MAINTAINERS文件,你出现的错误是否是与个人用户相关联的
with the part of the kernel that you are having trouble with. If there
如果
isn't anyone listed there, then the second best thing is to mail
没有出现任何用户的信息,那么最好把错误用
them to me (torvalds@linux-foundation.org), and possibly to any other
邮件发给我(torvalds@linux-foundation.org),可能会有
relevant mailing-list or to the newsgroup.
相关的邮件列表或新闻组。
- In all bug-reports, *please* tell what kernel you are talking about,
在bug报告中,请说明
how to duplicate the problem, and what your setup is (use your common
怎么重现这个问题,和你的设置(用你的通常的
sense). If the problem is new, tell me so, and if the problem is
做法)。如果该问题是新的,请告诉我,如果这该问题是旧的,
old, please try to tell me when you first noticed it.
请试图告诉我你什么时候发觉的。
- If the bug results in a message like
如果这个bug结果信息如下
unable to handle kernel paging request at address C0000010
Oops: 0002
EIP: 0010:XXXXXXXX
eax: xxxxxxxx ebx: xxxxxxxx ecx: xxxxxxxx edx: xxxxxxxx
esi: xxxxxxxx edi: xxxxxxxx ebp: xxxxxxxx
ds: xxxx es: xxxx fs: xxxx gs: xxxx
Pid: xx, process nr: xx
xx xx xx xx xx xx xx xx xx xx
or similar kernel debugging information on your screen or in your
或者相似的内核调试信息出现在你的屏幕或系统日志上,
system log, please duplicate it *exactly*. The dump may look
请准确的复制。
incomprehensible to you, but it does contain information that may
可能它看起来像难以理解的垃圾,但它包含的信息或许可以
help debugging the problem. The text above the dump is also
帮助调试问题。以上的垃圾信息也是
important: it tells something about why the kernel dumped code (in
重要的:它告诉了一些为什么内核出现错误代码的信息(在
the above example it's due to a bad kernel pointer). More information
上面的例子中,错误是由于一个错误的内核指针)。更多信息
on making sense of the dump is in Documentation/oops-tracing.txt
可以在Documentation/oops-tracing.txt上搞清楚。
- If you compiled the kernel with CONFIG_KALLSYMS you can send the dump
如果你将CONFIG_KALLSYMS编译进内核,你可以原封不动地发送那些错误代码,
as is, otherwise you will have to use the "ksymoops" program to make
否则你就不得不使用“ksymoops”指令去搞清楚
sense of the dump (but compiling with CONFIG_KALLSYMS is usually preferred).
那些错误代码(但是将CONFIG_KALLSYMS编译进内核通常是默认的)
This utility can be downloaded from
这个实用工具可以从以下地址下载到。
ftp://ftp.<country>.kernel.org/pub/linux/utils/kernel/ksymoops/ .
Alternately you can do the dump lookup by hand:
另外,你也可以手动查找他们。
- In debugging dumps like the above, it helps enormously if you can
调试错误就是如上所述的,它极大地帮助你去
look up what the EIP value means. The hex value as such doesn't help
超找EIP的值的意义。十六进制的值本身不能帮助我或
me or anybody else very much: it will depend on your particular
别人:它取决于你所定制的
kernel setup. What you should do is take the hex value from the EIP
内核配置。你应该做的是将EIP上的十六进制值
line (ignore the "0010:"), and look it up in the kernel namelist to
(忽略“0010:”)在内核名称表上查找
see which kernel function contains the offending address.
内核函数包含的地址。
To find out the kernel function name, you'll need to find the system
找出内核函数的名称,然后找到系统中与错误现象相符合的
binary associated with the kernel that exhibited the symptom. This is
二进制文件。该文件就是
the file 'linux/vmlinux'. To extract the namelist and match it against
/linux/vmlinux。提取名称列表然后匹配
the EIP from the kernel crash, do:
内核崩溃的值:
nm vmlinux | sort | less
This will give you a list of kernel addresses sorted in ascending
这个会显示一个在一个上升序列中存储的内核地址列表,
order, from which it is simple to find the function that contains the
从这个列表中可以容易地找到包含错误信息地址的功能。
offending address. Note that the address given by the kernel
注意,从内核调试信息得到的地址
debugging messages will not necessarily match exactly with the
未必一定能准确地与
function addresses (in fact, that is very unlikely), so you can't
功能地址相符(事实上,那非常不可能),所以你不能
just 'grep' the list: the list will, however, give you the starting
仅仅grep那些列表:然而,如果给你一个内核
point of each kernel function, so by looking for the function that
指针的开头,那么,通过查找那些比你要找的
has a starting address lower than the one you are searching for but
那个低的开头地址的功能,
is followed by a function with a higher address you will find the one
你将会找到你
you want. In fact, it may be a good idea to include a bit of
想要的那个。事实上,它包含了一些
"context" in your problem report, giving a few lines around the
上下文在你的问题报告上,给出一些你感兴趣的那些行的上下文。
interesting one.
If you for some reason cannot do the above (you have a pre-compiled
如果你的一些结果不能通过上面的方法找到
kernel image or similar), telling me as much about your setup as
尽可能告诉我的你配置选项是
possible will help. Please read the REPORTING-BUGS document for details.
有帮助的。请阅读REPORTING-BUGS文档获得更多详细信息。
- Alternately, you can use gdb on a running kernel. (read-only; i.e. you
另外,你可以在一个运行中的内核使用gdb。(只读;
cannot change values or set break points.) To do this, first compile the
你不能改变值或设置断点。)要这样做,首先使用-g编译内核
kernel with -g; edit arch/i386/Makefile appropriately, then do a "make
适当地编辑arch/i386/Makefile,然后“make clean”
clean". You'll also need to enable CONFIG_PROC_FS (via "make config").
你也将需要编译CONFIG_PROC_FS,通过“make config”命令。
After you've rebooted with the new kernel, do "gdb vmlinux /proc/kcore".
在重启新内核后,执行“ddb vmlinux /proc/kcore”.
You can now use all the usual gdb commands. The command to look up the
现在你可以使用所有的通用gdb命令。这些命令可以找到
point where your system crashed is "l *0xXXXXXXXX". (Replace the XXXes
你的系统出现崩溃的地方。(替换XXX成
with the EIP value.)
EIP中的值)。
gdb'ing a non-running kernel currently fails because gdb (wrongly)
disregards the starting offset for which the kernel is compiled. |
|