- 论坛徽章:
- 0
|
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 "Processor 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. |
|