linux内核安装指南

来源:互联网 发布:关于远离网络的演讲稿 编辑:程序博客网 时间:2024/06/05 20:21
    Linux kernel release 2.6.xx <http://kernel.org/>

These are the release notes for Linux version 2.6.  Read them carefully,
as they tell you what this is all about, explain how to install the
kernel, and what to do if something goes wrong.

这里有许多LINUX 2.6的发布注解。认真地阅读他们,因为他们会告诉你所有相关的内容,
解释如何安装内核,以及出错时如何处理。

WHAT IS LINUX?

  Linux is a clone of the operating system Unix, written from scratch by
  Linus Torvalds with assistance from a loosely-knit team of hackers across
  the Net. It aims towards POSIX and Single UNIX Specification compliance.
 
  LINUX是操作系统能够UNIX的一个克隆。在一帮遍布互联网的松散组织起来的黑客协
  助下,由Linus Torvalds仓促写成的。它遵循POSIX和Single UNIX Specification标准。

  It has all the features you would expect in a modern fully-fledged 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.
 
  它具备所有的你希望一个现代、完善的UNIX应该拥有的特征,包括真正的多任务、虚拟内存、
  共享库、命令载入、共享的写时拷贝执行、正确的内存管理、以及多任务网络[包括IPv4和IPv6]。

  It is distributed under the GNU General Public License - see the
  accompanying COPYING file for more details.
 
  它在GNU GPL协议下发布,请查看版权文件获取更详细的细节信息。

ON WHAT HARDWARE DOES IT RUN?

  Although originally developed first for 32-bit x86-based PCs (386 or higher),
  today Linux also runs on (at least) the Compaq Alpha AXP, Sun SPARC and
  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,
  Xtensa, AVR32 and Renesas M32R architectures.
 
  虽然,最早是为32位的PC(386或者更高)开发的,今天linux最少已经可以运行在康柏
  Alpha AXP、Sun的SPARC和UltraSPARC、摩托罗拉6800、PowerPC、PowerPC64、ARM、
   Hitachi SuperH, Cell,IBM S/390, MIPS, HP PA-RISC, Intel IA-64, DEC VAX,
   AMD x86-64, AXIS CRIS,  Xtensa, AVR32 以及Renesas M32R 等架构。

  Linux is easily portable to most general-purpose 32- or 64-bit architectures
  as long as they have a paged memory management unit (PMMU) and a port of the
  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
  functionality is then obviously somewhat limited.
 
  Linux是最容易移植到绝大多数通用32位或64位架构,主要他们支持页式内存管理单元(PMMU)和 
  GCC接口。linux也被移植到一系列不支持PMMU的架构,虽然有些功能显然是要受到限制。
 
 
  Linux has also been ported to itself. You can now run the kernel as a
  userspace application - this is called UserMode Linux (UML).

  linux已经被移植到自身。你现在可以将内核作为用户空间的应用程序来运行,这就是
  用户模式的Linux(UML)。

DOCUMENTATION:

 - There is a lot of documentation available both in electronic form on
   the Internet and in books, both Linux-specific and pertaining to
   general UNIX questions.  I'd recommend looking into the documentation
   subdirectories on any Linux FTP site for the LDP (Linux Documentation
   Project) books.  This README is not meant to be documentation on the
   system: there are much better sources available.
  
   有很多文档即以互联网上的电子形式也以书的形式提供,即有linux专题或者UNIX
   普遍问题相关。我建议仔细查看任何linux FTP页面的文档子目录,查找LDP(linux 文档项目)
   的书。这个README不是这个系统的文档:有更多更好的资源可以获取。

 - There are various README files in the Documentation/ subdirectory:
   these typically contain kernel-specific installation notes for some
   drivers for example. See Documentation/00-INDEX for a list of what
   is contained in each file.  Please read the Changes file, as it
   contains information about the problems, which may result by upgrading
   your kernel.

   有许多不同的README文件在文档子目录:特别是包含内核专有的安装指南,以某些驱动作为例子。
   查看文件/00-INDEX,浏览下每个文件包含的内容列表。请阅读修改日志,因为
   它包含关于问题的信息,这些问题可能影响你升级内核。

 - The Documentation/DocBook/ subdirectory contains several guides for
   kernel developers and users.  These guides can be rendered in a
   number of formats:  PostScript (.ps), PDF, and HTML, among others.
   After installation, "make psdocs", "make pdfdocs", or "make htmldocs"
   will render the documentation in the requested format.
  
   /DocBook子目录包含几个内核开发者和使用者的手册。这些手册能够被转译成几种格式:PostScript (.ps),
   PDF, and HTML以及其他格式。安装之后,"make psdocs"、"make pdfdocs"、"make htmldocs"
   将转译这个文档到指定的格式。

INSTALLING the kernel:

 - If you install the full sources, put the kernel tarball in a
   directory where you have permissions (eg. your home directory) and
   unpack it:

   如果你要以全源码方式安装,将内核压缩包存放在一个你有权限访问的目录,并且解压。

        gzip -cd linux-2.6.XX.tar.gz | tar xvf -

   或者
        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
   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.
  
   不要使用/usr/src/linux目录!这个目录有一个内核头文件集合,通常是不完整的,
   这些头文件被库头文件所使用。他们应该正好匹配库文件,而不应该正好被内核变更
   给弄得一团糟。

 - You can also upgrade between 2.6.xx releases by patching.  Patches are
   distributed in the traditional gzip and the newer bzip2 format.  To
   install by patching, get all the newer patch files, enter the
   top level directory of the kernel source (linux-2.6.xx) and execute:

   你也可以通过打补丁在2.6.xx发布版之间升级。补丁通常以传统得gzip和新得bzip2格式
   发布。为了安装补丁,下载所有更新得补丁文件,进入内核源码(linux-2.6.xx)的最顶
   层目录并且执行

        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
   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.
   (按顺序,重复输入所有比你当前源码树更大的版本号),那么你就可以顺利完成了。
   你可能想删除备份文件(xxx~或者xxx.orig),确认没有失败的补丁(xxx#或者xxx.rej).
   如果有,不是你就是我犯了一个错误。

   Unlike patches for the 2.6.x kernels, patches for the 2.6.x.y kernels
   (also known as the -stable kernels) are not incremental but instead apply
   directly to the base 2.6.x kernel.  Please read
   Documentation/applying-patches.txt for more information.
  
   和2.6.x内核的补丁不一样,2.6.x.y内核的补丁,就是所谓的稳定版本,不是递增的,
   而是直接替换2.6.x内核。请阅读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.

   还有个办法,脚本patch-kernel可以自动完成这个过程。它判断当前内核的版本号,并且
   应用任何找到的补丁。

        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
   not incremental and must be applied to the 2.6.xx base tree. For
   example, if your base kernel is 2.6.12 and you want to apply the
   2.6.12.3 patch, you do not and indeed must not first apply the
   2.6.12.1 and 2.6.12.2 patches. Similarly, if you are running kernel
   version 2.6.12.2 and want to jump to 2.6.12.3, you must first
   reverse the 2.6.12.2 patch (that is, patch -R) _before_ applying
   the 2.6.12.3 patch.
  
   如果你想使用稳定系列的补丁,在发布版本之间升级,比如patch-2.6.xx.y。注意,
   这些".发布号"不是递增的,必须应用到2.6.xx的基础树。例如,如果你的基础内核是2.6.12
   并且你想应用2.6.12.3补丁,你不能,实际上也没必需要先打上2.6.12.1和2.6.12.2补丁。类似地,
   如果你正运行2.6.12.2版本地内核,并且想跳到2.6.12.3,你在打上2.6.12.3补丁之前,
   必须先撤销2.6.12.2补丁。
  
   You can read more on this in Documentation/applying-patches.txt
   你可以在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
   versions of various software packages.  Consult
   Documentation/Changes for the minimum version numbers required
   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.
  
   编译和运行2.6.xx内核,要求各种软件包地最新版本。查阅changes文件,
   确认要求的最小版本号,以及如何得到这些包的更新。必须了解,过度使用这些
   包的旧版本可能导致潜在的错误,这些错误是非常难被捕获的。所以,当编译
   或者操作过程中,出现了明显的错误,你就不能说你已经正确的升级包了。

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
   place for the output files (including .config).
  
   使用选项 "make O=output/dir" 允许你指定一个可选的地方存放输出文件,包括 .config。  
  
   Example:
  
   例如:
  
     kernel source code:    /usr/src/linux-2.6.N
     build directory:        /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
   used for all invocations of make.
  
   请注意:如果 "O=output/dir"选项被使用,那么它必须被所有的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
   only ask you for the answers to new questions.

   不用忽略这个步骤,即使你只是升级一个最小的版本。新的配置选项被添加到
   每个发布版本中,奇怪的问题可能会出现,如果配置文件没有象期望的那样被配置。
   如果你想不用费事地将已经存在的配置文件带到新版本中,使用"make oldconfig"
   命令,这个命令只是就新问题请求确认。  

 - 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
               your existing ./.config file and asking about
               new config symbols.
                       基于已经存在的配置文件,默认回答所有的问题,只询问新的配置特征。
              
    "make silentoldconfig"
               Like above, but avoids cluttering the screen
               with questions already answered.
               和上面一样,但避免在屏幕上集中出现已经回答的问题
              
    "make defconfig"   Create a ./.config file by using the default
               symbol values from arch/$ARCH/defconfig.
               使用arch/$ARCH/defconfig中默认的特征值建立一个配置文件              
              
    "make allyesconfig"
               Create a ./.config file by setting symbol
               values to 'y' as much as possible.
               尽可能地使用'y'设置特征值,来建立一个配置文件              
              
    "make allmodconfig"
               Create a ./.config file by setting symbol
               values to 'm' as much as possible.
               尽可能地使用'm'设置特征值,来建立一个配置文件              
              
    "make allnoconfig" Create a ./.config file by setting symbol
               values to 'n' as much as possible.
               尽可能地使用'n'设置特征值,来建立一个配置文件              
              
    "make randconfig"  Create a ./.config file by setting symbol
               values to random values.
               尽可能地使用随机值来设置特征值,来建立一个配置文件              

   The allyesconfig/allmodconfig/allnoconfig/randconfig variants can
   also use the environment variable KCONFIG_ALLCONFIG to specify a
   filename that contains config options that the user requires to be
   set to a specific value.  If KCONFIG_ALLCONFIG=filename is not used,
   "make *config" checks for a file named "all{yes/mod/no/random}.config"
   for symbol values that are to be forced.  If this file is not found,
   it checks for a file named "all.config" to contain forced values.
  
   allyesconfig/allmodconfig/allnoconfig/randconfig变量也可以使用环境变量
   KCONFIG_ALLCONFIG来指定一个文件,这个文件里,已经将用户要求的配置项设置
   为一个特定的值。如果KCONFIG_ALLCONFIG=filename没有被使用,"make *config"
   就会检查一个名叫"all{yes/mod/no/random}.config"的文件,获取强制要求的特征值。
   如果这个文件没有被找到,它就会检查名叫"all.config"的文件,获取其中包含的被
   强制指定的值。
  
  
    NOTES on "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
      will result in a kernel that does NOT work on a 386.  The
      kernel will detect this on bootup, and give up.
     
      将处理器类型设置高于386,可能导致编译后的内核无法在386上工作。这个内核在启动
      时检测到这个问题,并自动放弃。
     
    - A kernel with math-emulation compiled in will still use the
      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
      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
          "development", "experimental", or "debugging" features.
         
      "kernel hacking"配置细节上,通常会导致一个更大或者更慢的内核,或者两者兼有。
      甚至能让内核更不稳定,通过配置激活一些过程,尝试中断坏的代码以发现内核问题(kmalloc())。
      这样,你可能需要对"development"、"experimental"、"debugging"特征的问题回答'n'。

COMPILING the kernel:

 - Make sure you have at least gcc 3.2 available.
   For more information, refer to Documentation/Changes.
  
   确认你最少有gcc 3.2能用。更多的信息参考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
   possible to do "make install" if you have lilo installed to suit the
   kernel makefiles, but you may want to check your particular lilo setup first.
  
   使用"make"创建一个压缩的内核映象文件。也可能需要运行"make install",如果你已经安装了
   lilo来配合内核编译文件,但是你最好单独地先检查你lilo安装。
  

   To do the actual install you have to be root, but none of the normal
   build should require that. Don't take the name of root in vain.
  
   为了精确地安装,你必须是root用户,但没有一个正常地创建过程需要那个。不要
   徒劳无益地使用root。
  

 - If you configured any of the parts of the kernel as `modules', you
   will also have to do "make modules_install".
  
   如果你将内核的任何组件配置为模块"modules",你可能需要执行"make modules_install"

 - 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
   do a "make modules_install".
  
   保存内核备份,方便处理某些东西出错的情况。这对开发版特别有用,由于新的发布版包含
   那些没有被调试过的新代码。也要确认你保存那个内核所对应的模块的备份。如果你正在安装
   一个新的内核,版本号和你正在工作的内核一样,在你执行"make modules_install"之前,
   备份你模块所在目录。
  
   Alternatively, before compiling, use the kernel config option
   "LOCALVERSION" to append a unique suffix to the regular kernel version.
   LOCALVERSION can be set in the "General Setup" menu.
  
   另外一个办法,在编译之前,使用内核配置选项"LOCALVERSION"添加一个唯一的后缀
   到常规的内核版本。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)
   to the place where your regular bootable kernel is found.
  
   为了启动新的内核,你需要拷贝内核映象(编译之后,通常是../linux/arch/i386/boot/bzImage )
   到通常可启动内核所在的地方。

 - Booting a kernel directly from a floppy without the assistance of a
   bootloader such as LILO, is no longer supported.
  
   不用启动加载器,如LILO的帮助,直接从软盘启动内核的方式,不在被支持。

   If you boot Linux from the hard drive, chances are you use LILO which
   uses the kernel image as specified in the file /etc/lilo.conf.  The
   kernel image file is usually /vmlinuz, /boot/vmlinuz, /bzImage or
   /boot/bzImage.  To use the new kernel, save a copy of the old image
   and copy the new image over the old one.  Then, you MUST RERUN LILO
   to update the loading map!! If you don't, you won't be able to boot
   the new kernel image.
  
   如果你从硬盘引导linux,条件是你使用了LILO,她使用/etc/lilo.conf中指定的内核映象。
   这个内核映象文件通常是/vmlinuz ,/boot/vmlinuz , /bzImage 或者/boot/bzImage。为了
   使用新内核,保存旧映象的一个备份,拷贝新的映象覆盖到旧版本。然后,你必须返回LILO
   更新正在加载的映象!!如果你不这么做,你将无法启动新的内核映象。
  

   Reinstalling LILO is usually a matter of running /sbin/lilo.
   You may wish to edit /etc/lilo.conf to specify an entry for your
   old kernel image (say, /vmlinux.old) in case the new one does not
   work.  See the LILO docs for more information.
  
   重新安装LILO通常是运行/sbin/lilo的事情了。你可能希望编辑 /etc/lilo.conf指定你旧的内核映象
   的入口(比如说,/vmlinux.old),如果新内核无法工作的话。查看LILO文档获取更多的信息。

   After reinstalling LILO, you should be all set.  Shutdown the system,
   reboot, and enjoy!
  
   在重新安装LILO之后,所有的一切都被设置了。关闭系统,重新启动,然后享受你的工作。

   If you ever need to change the default root device, video mode,
   ramdisk size, etc.  in the kernel image, use the 'rdev' program (or
   alternatively the LILO boot options when appropriate).  No need to
   recompile the kernel to change these parameters.
  
   如果你曾经需要改变默认的跟设备,视频模式,内存磁盘大小,以及诸如此类。在内核映象中,使用'rdev'
   程序(或者合适的LILO候选启动选项)。不需要重新编译内核来改变这些参数。

 - 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
   the file MAINTAINERS to see if there is a particular person associated
   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
   relevant mailing-list or to the newsgroup.
  
   如果你发现问题是由于内核BUGS的缘故,请检查文件MAINTAINERS,看下时候有人
   和你有问题的内核部分有关。如果没有任何人列在那里,那么第二个最好的选择就是
   将他们发邮件给我(torvalds@linux-foundation.org),以及给邮件列表中可能相关的
   任何其他人,或者给新闻组。

 - In all bug-reports, *please* tell what kernel you are talking about,
   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.
  
   在所有的BUG报告中,请说明你正讨论的是那个内核,如何重现这个问题,以及你
   安装的东西(使用普通的语气)。如果这个问题是新的,就告诉我这些,如果这个
   问题是旧的,请试着告诉我,你什么时候开始注意到它。
  

 - 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
  
   或者相似的内核调试信息在你的屏幕上,或者你的系统日志中,请完整复制它。
   这个转储信息可能看起来对你毫无意义,但是它包含可能有助于调试这个问题的信息。
   上面转储的文本也是重要的:它提示一些关于为什么内核要转储代码的信息(在上面的
   例子中,它是由错误的内核指针引起的)。oops-tracing.txt中更多的信息将使这个
   转储信息变得更加有意义。
  

 - If you compiled the kernel with CONFIG_KALLSYMS you can send the dump
   as is, otherwise you will have to use the "ksymoops" program to make
   sense of the dump (but compiling with CONFIG_KALLSYMS is usually preferred).
   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:
  
   如果你使用CONFIG_KALLSYMS编译了这个内核,你能原样发送转储信息,否则,你不得不
   使用"ksymoops"程序使转储信息变得有意义(但使用CONFIG_KALLSYMS编译选项通常是被建议得)。
   这个工具能够从ftp://ftp.<country>.kernel.org/pub/linux/utils/kernel/ksymoops/下载。
   另外,你也可以手工进行转储信息查找。

 - 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
   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
   line (ignore the "0010:"), and look it up in the kernel namelist to
   see which kernel function contains the offending address.
  
   象上面那样调试信息转储,如果你能查找出EIP值的含义,将是巨大的帮助。象这样的16进制值
   对我或任何其他人是不会有太大的帮助。它可能依赖于你独特的内核安装。你应该做的是从
   EIP行(忽略"0010:")取出16进制值,在内核名字列表中查看一下,看下那个内核名称列表中,
   究竟哪个内核函数包含这个被攻击的地址。
  

   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
   the EIP from the kernel crash, do:
  
   为了找出这个内核函数名,你需要找到可以展示这个症状的二进制系统所相关的内核。
   这个文件叫做"linux/vmlinux"。提取名称列表,和崩溃内核的EIP相匹配,这样做:  

        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
   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.
  
   这个命令将给你一个内核地址列表,升序排列,从这个列表中,很简单就可以找到包含
   被攻击地址的函数。注意:这个内核调试信息给出的地址对精确匹配这个函数地址并不
   是必须的,实际上,一点都不象,所以,你无法使用'grep'这个列表:然而,这个列表
   将给你每个内核函数的开始地址,所以,通过查找一个拥有开始地址小于目标地址,但
   是下个函数地址要高于目标地址的函数,你就可以找到你想要的。实际上,在你程序报
   告中,包含一些上下文信息是个好主意,提供一些感兴趣那个函数周边的行。

   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
   cannot change values or set break points.) To do this, first compile the
   kernel with -g; edit arch/i386/Makefile appropriately, then do a "make
   clean". You'll also need to enable CONFIG_PROC_FS (via "make config").
  
   另外,你可以在正在运行的内核上使用gdb.(只读;你无法改变值,或者设置断点。)
   为了实现这个目的,请先使用-g参数编译内核;正确编辑 arch/i386/Makefile,然后
   执行"make clean"。你也需要打开 CONFIG_PROC_FS选项(通过"make config")。

   After you've rebooted with the new kernel, do "gdb vmlinux /proc/kcore".
   You can now use all the usual gdb commands. The command to look up the
   point where your system crashed is "l *0xXXXXXXXX". (Replace the XXXes
   with the EIP value.)

   在你使用新内核重新启动后,执行"gdb vmlinux /proc/kcore"。现在,你就可以使用所有
   的gdb常用命令。查看你系统崩溃点的命令是"l *0xXXXXXXXX"。(用EIP值替换XXX...)。

   gdb'ing a non-running kernel currently fails because gdb (wrongly)
   disregards the starting offset for which the kernel is compiled.
  
   gdb一个非运行态的内核现在还不行,因为gdb错误地无视内核编译后地起始偏移量。

 
原创粉丝点击