- 論壇徽章:
- 0
|
CONFIGURING the kernel:
配置內(nèi)核:
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
如果配置文件沒有預(yù)期得配置好,臨時問題就會出現(xiàn)。
as expected. If you want to carry your existing configuration to a
如果你想使用一個存在的配置文件使得
new version with minimal work, use "make oldconfig", which will
新版本內(nèi)核能最低限度工作,可以使用“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
默認(rèn)所有現(xiàn)存的.config中的選項,
your existing ./.config file and asking about
只詢問新的選項。
new config symbols.
"make silentoldconfig"
Like above, but avoids cluttering the screen
跟上一個一樣,但是避免了已經(jīng)選好選項
with questions already answered.
使屏幕布局有些凌亂。
Additionally updates the dependencies.
另外升級了依賴性。
"make defconfig" Create a ./.config file by using the default
創(chuàng)建了.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.
的值,這取決于系統(tǒng)架構(gòu)。
"make ${PLATFORM}_defconfig"
Create a ./.config file by using the default
創(chuàng)建一個.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.
取決于你的機器架構(gòu)。
"make allyesconfig"
Create a ./.config file by setting symbol
創(chuàng)建一個.config文件,盡可能的將
values to 'y' as much as possible.
選項的值設(shè)置為“y”。
"make allmodconfig"
Create a ./.config file by setting symbol
創(chuàng)建一個.config文件,盡可能的將
values to 'm' as much as possible.
選項的值設(shè)置為“m”
"make allnoconfig" Create a ./.config file by setting symbol
創(chuàng)建一個.config文件,盡可能的將
values to 'n' as much as possible.
選項的值設(shè)置為“n”
"make randconfig" Create a ./.config file by setting symbol
創(chuàng)建一個.config文件,將
values to random values.
選項的值隨機設(shè)置。
You can find more information on using the Linux kernel config tools
你可以在Documentation/kbuild/kconfig.txt上找到更多關(guān)于使用Linux內(nèi)核配置工具的信息
in Documentation/kbuild/kconfig.txt.
NOTES on "make config":
“make config”的說明:
- having unnecessary drivers will make the kernel bigger, and can
設(shè)置上沒有用的驅(qū)動將會導(dǎo)致內(nèi)核變得龐大,
under some circumstances lead to problems: probing for a
并會在某些情況下導(dǎo)致問題:搜索一個
nonexistent controller card may confuse your other controllers
不存在的控制器卡可能會使其他的控制器卡混亂(而不能正確驅(qū)動)。
- compiling the kernel with "Processor type" set higher than 386
在編譯內(nèi)核時,“Processor type”(處理器類型)設(shè)置大于386的話
will result in a kernel that does NOT work on a 386. The
可能造成的結(jié)果是不能在386機器上工作。
kernel will detect this on bootup, and give up.
內(nèi)核會在啟動的時候判斷處理器類型,如果不符合,會放棄啟動。
- A kernel with math-emulation compiled in will still use the
一個將math-emulation編譯進(jìn)去的內(nèi)核將仍會使用協(xié)處理器,如果
coprocessor if one is present: the math emulation will just
存在協(xié)處理器的話:數(shù)字仿真器將
never get used in that case. The kernel will be slightly larger,
從不被使用到。而內(nèi)核會略微變大,
but will work on different machines regardless of whether they
但仍可以在不同的機器上工作,不管它們是否
have a math coprocessor or not.
有數(shù)字協(xié)處理器。
- the "kernel hacking" configuration details usually result in a
“kernel hacking”配置的選項很多的話,通常會致使
bigger or slower kernel (or both), and can even make the kernel
內(nèi)核變大或變慢(或者又大又慢),甚至?xí)箖?nèi)核
less stable by configuring some routines to actively try to
不穩(wěn)定。通常一些做法可以積極地試圖
break bad code to find kernel problems (kmalloc()). Thus you
打破錯誤的代碼從而找到內(nèi)核問題。因此你
should probably answer 'n' to the questions for
或許應(yīng)當(dāng)回答“n”來實現(xiàn)不編譯
"development", "experimental", or "debugging" features.
"development"(開發(fā)), "experimental"(試驗),或"debugging"(調(diào)試)的特性
COMPILING the kernel:
編譯內(nèi)核
- 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.
請注意你仍然可以通過這個內(nèi)核運行a.out的用戶程序
- Do a "make" to create a compressed kernel image. It is also
使用“make”去創(chuàng)建一個壓縮的內(nèi)核鏡像。
possible to do "make install" if you have lilo installed to suit the
如果你安裝了lilo并適合內(nèi)核的makefile,也可以使用“make install”命令
kernel makefiles, but you may want to check your particular lilo setup first.
但是,你應(yīng)該先檢查你自己的lilo配置。
To do the actual install you have to be root, but none of the normal
要實際安裝內(nèi)核,你必須是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
如果你將內(nèi)核的任何一個部分作為“modules”(模塊)編譯,
will also have to do "make modules_install".
你還必須使用“make modules_install”命令。
- Verbose kernel compile/build output:
詳細(xì)的內(nèi)核編譯輸出:
Normally the kernel build system runs in a fairly quiet mode (but not
通常內(nèi)核編譯選擇安靜模式進(jìn)行運行(但不是完全的安靜模式)。
totally silent). However, sometimes you or other kernel developers need
然而,有些適合你或其他的內(nèi)核開發(fā)人員需要
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”參數(shù)來重建內(nèi)核。
target, use "V=2". The default is "V=0".
默認(rèn)的參數(shù)是“V=0”
- Keep a backup kernel handy in case something goes wrong. This is
保存一個內(nèi)核副本,以防萬一出現(xiàn)錯誤。對于開發(fā)版本來說,這是
especially true for the development releases, since each new release
非常正確的做法。當(dāng)新的沒有測試過的版本釋放出以后就應(yīng)該這樣做。
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
備份好的與內(nèi)核一直的模塊副本。如果你
are installing a new kernel with the same version number as your
安裝一個與你當(dāng)前版本相同的新的內(nèi)核作為你的工作內(nèi)核,
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
另外,在編譯內(nèi)核的時候,可以使用內(nèi)核配置選項
"LOCALVERSION" to append a unique suffix to the regular kernel version.
“LOCALVERSION”來添加一個符合內(nèi)核版本號的獨有的后綴。
LOCALVERSION can be set in the "General Setup" menu.
LOCALVERSION 可以在“General Setup”菜單中設(shè)置。
- In order to boot your new kernel, you'll need to copy the kernel
為了引導(dǎo)你的新內(nèi)核,你需要復(fù)制內(nèi)核
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.
替換你平時引導(dǎo)的內(nèi)核。
- Booting a kernel directly from a floppy without the assistance of a
直接從軟驅(qū)引導(dǎo)內(nèi)核而不借助諸如LILO這樣的輔助工具
bootloader such as LILO, is no longer supported.
已經(jīng)不再被支持了。
If you boot Linux from the hard drive, chances are you use LILO which
如果你引導(dǎo)Linux是從硬盤驅(qū)動器上,有可能你使用的LILO
uses the kernel image as specified in the file /etc/lilo.conf. The
的/etc/lilo.conf作為配置文件來引導(dǎo)內(nèi)核。
kernel image file is usually /vmlinuz, /boot/vmlinuz, /bzImage or
內(nèi)核鏡像文件通常是 /vmlinuz、/boot/vmlinuz、/bzImage或者
/boot/bzImage. To use the new kernel, save a copy of the old image
/boot/bzImage。要使用新的內(nèi)核前,先復(fù)制一個舊內(nèi)核鏡像的副本
and copy the new image over the old one. Then, you MUST RERUN LILO
然后復(fù)制新的內(nèi)核鏡像來覆蓋舊的。然后,你需要重新運行LILO
to update the loading map!! If you don't, you won't be able to boot
來更新引導(dǎo)模塊。∪绻悴贿@樣做,就不能使用新的內(nèi)核引導(dǎo)系統(tǒng)。
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來指定進(jìn)入你的
old kernel image (say, /vmlinux.old) in case the new one does not
舊的內(nèi)核鏡像(如:/vmlinux.old)這種情況新的內(nèi)核則不會
work. See the LILO docs for more information.
工作。查看LILO的文檔可以獲得更多的信息。
After reinstalling LILO, you should be all set. Shutdown the system,
在重新安裝LILO后,你應(yīng)該將其設(shè)置好。關(guān)閉系統(tǒng),
reboot, and enjoy!
重啟,祝你愉快!
If you ever need to change the default root device, video mode,
如果你曾需要去改變默認(rèn)的root裝置、視頻模式、
ramdisk size, etc. in the kernel image, use the 'rdev' program (or
虛擬內(nèi)存大小等等,在內(nèi)核鏡像中,使用“rdev”指令(或
alternatively the LILO boot options when appropriate). No need to
在適當(dāng)?shù)臅r候用LILO引導(dǎo)選項)。不需要
recompile the kernel to change these parameters.
重新編譯內(nèi)核來改變這些參數(shù)。
- Reboot with the new kernel and enjoy.
重新引導(dǎo)新的內(nèi)核愉快。
IF SOMETHING GOES WRONG:
如果出現(xiàn)了一些錯誤:
- If you have problems that seem to be due to kernel bugs, please check
如果你有一些看起來像是由于內(nèi)核bug的錯誤,請檢查
the file MAINTAINERS to see if there is a particular person associated
MAINTAINERS文件,你出現(xiàn)的錯誤是否是與個人用戶相關(guān)聯(lián)的
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
沒有出現(xiàn)任何用戶的信息,那么最好把錯誤用
them to me (torvalds@linux-foundation.org), and possibly to any other
郵件發(fā)給我(torvalds@linux-foundation.org),可能會有
relevant mailing-list or to the newsgroup.
相關(guān)的郵件列表或新聞組。
- 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
怎么重現(xiàn)這個問題,和你的設(shè)置(用你的通常的
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.
請試圖告訴我你什么時候發(fā)覺的。
- If the bug results in a message like
如果這個bug結(jié)果信息如下
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
或者相似的內(nèi)核調(diào)試信息出現(xiàn)在你的屏幕或系統(tǒng)日志上,
system log, please duplicate it *exactly*. The dump may look
請準(zhǔn)確的復(fù)制。
incomprehensible to you, but it does contain information that may
可能它看起來像難以理解的垃圾,但它包含的信息或許可以
help debugging the problem. The text above the dump is also
幫助調(diào)試問題。以上的垃圾信息也是
important: it tells something about why the kernel dumped code (in
重要的:它告訴了一些為什么內(nèi)核出現(xiàn)錯誤代碼的信息(在
the above example it's due to a bad kernel pointer). More information
上面的例子中,錯誤是由于一個錯誤的內(nèi)核指針)。更多信息
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編譯進(jìn)內(nèi)核,你可以原封不動地發(fā)送那些錯誤代碼,
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編譯進(jìn)內(nèi)核通常是默認(rèn)的)
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
調(diào)試錯誤就是如上所述的,它極大地幫助你去
look up what the EIP value means. The hex value as such doesn't help
超找EIP的值的意義。十六進(jìn)制的值本身不能幫助我或
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
內(nèi)核配置。你應(yīng)該做的是將EIP上的十六進(jìn)制值
line (ignore the "0010:"), and look it up in the kernel namelist to
(忽略“0010:”)在內(nèi)核名稱表上查找
see which kernel function contains the offending address.
內(nèi)核函數(shù)包含的地址。
To find out the kernel function name, you'll need to find the system
找出內(nèi)核函數(shù)的名稱,然后找到系統(tǒng)中與錯誤現(xiàn)象相符合的
binary associated with the kernel that exhibited the symptom. This is
二進(jìn)制文件。該文件就是
the file 'linux/vmlinux'. To extract the namelist and match it against
/linux/vmlinux。提取名稱列表然后匹配
the EIP from the kernel crash, do:
內(nèi)核崩潰的值:
nm vmlinux | sort | less
This will give you a list of kernel addresses sorted in ascending
這個會顯示一個在一個上升序列中存儲的內(nèi)核地址列表,
order, from which it is simple to find the function that contains the
從這個列表中可以容易地找到包含錯誤信息地址的功能。
offending address. Note that the address given by the kernel
注意,從內(nèi)核調(diào)試信息得到的地址
debugging messages will not necessarily match exactly with the
未必一定能準(zhǔn)確地與
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那些列表:然而,如果給你一個內(nèi)核
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
如果你的一些結(jié)果不能通過上面的方法找到
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文檔獲得更多詳細(xì)信息。
- Alternately, you can use gdb on a running kernel. (read-only; i.e. you
另外,你可以在一個運行中的內(nèi)核使用gdb。(只讀;
cannot change values or set break points.) To do this, first compile the
你不能改變值或設(shè)置斷點。)要這樣做,首先使用-g編譯內(nèi)核
kernel with -g; edit arch/i386/Makefile appropriately, then do a "make
適當(dāng)?shù)鼐庉媋rch/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".
在重啟新內(nèi)核后,執(zhí)行“ddb vmlinux /proc/kcore”.
You can now use all the usual gdb commands. The command to look up the
現(xiàn)在你可以使用所有的通用gdb命令。這些命令可以找到
point where your system crashed is "l *0xXXXXXXXX". (Replace the XXXes
你的系統(tǒng)出現(xiàn)崩潰的地方。(替換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. |
|