Chinaunix首页 | 论坛 | 博客
  • 博客访问: 239312
  • 博文数量: 91
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 955
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-12 09:38
文章分类

全部博文(91)

文章存档

2017年(1)

2011年(1)

2008年(15)

2007年(74)

我的朋友

分类: LINUX

2007-08-12 10:40:48

Assume that the developmet environment-include compiler,make and kernel source code, and kernel headers-is installed. The root account will be used to create and install the kernel, although any user can compile a kernel given the appropriate filesystem permissions. Before building a customized kernel, you should read /usr/doc/HOWTO/kernel-HOWTO and /usr/src/linux/README
  During the configuration, you indicate for each option whether you want that feature:
    compiled into the kernel("yes" response)
    compiled as a module(module response)
    Don't want the feature at all ("no" response)
    some selections imply a group of other selections. For example, when you indicate that you wish to include SCSI drivers and features. The results from all of these choices are stord in the kernel configuration file /usr/src/linux.config. which is a plain text file that lists the opitons as shell variables set to one of y, m, or n in accordance with your response for each item.
    To begin, set current working directory to the top of source tree:
    #cd /usr/src/linux
    There are several ways to set up .config. Although you can do so, you should not edit the file manually. Instead, you may select from three interactive approaches. An addition option is available to construct a default configuration. Each is started using make.
    make config
    syntax
      make config
    Running make config is the most rundimentary of the automated kernel-configurration-terminal and does not depend on any form of display capability on your terminate. In response to make config, the system presents you with a question in you console or window for each kernel option. You respond to the questions with m, y, or n for module, yes or no, respectively. This method can admittedly get a bit tedious and has the liability that you must answer all the questions before being asked if you wish to save your .confgi file and exit. However, it is helpful if you do not have sufficient capability to use one of the menu-based methods(described next). A make config session looks like this:
    #make config
    make menuconfig
     syntax
       make meunconfig
    description
    This configuration method is more intutive and can be used as an alternative to make config, it creates a text-mode-windowed environment where you may use up/down/left/right and other keys to configure the kernel. The menu depends on the ability of your terminal or terminal window to use curses, a standard library of terminal cursor manipulateion instructions. if your terminal does not support curses(though most do), you must select another method.
    make xconfig
    syntax
     make xconfig
   description
   If you are running the x window system, the make xconfig configuration method presents a GUI menu with radio buttons to make the selections. It is the most appealing visually but requires a graphical console or x display.
   make oldconfig
   syntax
    make oldconfig
description
  make oldconfig can create a default .config file. This method sets up a default .config file without interaction from the user. This is convenient if you need a starting point and your distribution did not install a default .config file. This method will also build a new .config file from one customized for a previous kernel releases.
  
  Now that .config is created, one small changes is made to makefile to differentiate our new custom kernel from the generic one. examing /usr/src/linux/makefile the first four lines look like this:
  VERSION=2
  PATCHLEVEL=2
  SUBLEVEL=5
  EXTRAVERSION=-15
  you can see that the kernel version is 2.2.5 and that an addition version number is available. In this case, the generic kernel had the extra version suffix of -15, yielding a complete kernel version number 2.2.5-15. This EXTRAVERSION parameter can be used to indicate just about anything. In the example is denote the 15th buile of kernel 2.2.5, but -pentium is added to the end for our cutom version. Edit makefile and change EXTRAVERTION as follows:
  EXTRAVERSION=-15-pentium
  This change completes the configuration for this example.
  
  compile the kernel
  Once the .config and makefiel files are customized, the new kernel can be compiled by running the following commands:
  1.make dep or make
    In this step, source fiels(.c) are examined for dependencies on header files. A file called .depend is created in each directory containing source files to hold the resulting list, with a line for each compiled file (.o). The .depend files are automatically included in subsequent make operations to be sure that change in header fiels are compiled into new objects. simce kernel code isn'
t being developed here, no header file changes are needed. Nevertheless, make dep is an essential first step in the compilation process.
  2.make clean
    The "clean" operation remove old output files that may exist from previous kernel builds. These include core files, system map files, and others. They must be removed in order to compile a new,clean kernel.
  3.maek bzImage
    The bzImage file is our ultimate goal, a bootable kernel image file, compressed using the bzip2 utility, It si created in this step along with some additional support files needed for boot time.
  4.make modules
    Device drives and other items that were configured as modules are compiled in this step.
  5.make modules_install
    All of the modules compiled during make modules are installed under /lib/modules/kernel-version in this step, a directory are created there for each kernel version, include various extraversions.
    
  The bzImage and modules portions of the kernel-compilatin process will take the most time. Overall, the time required to build a kernel depends on your system's capabilities.
  6.make install

  the 6th is very important, because it can 生成 vmluniz-version(2.6-5),System.map-version(2.6-5), initrd.version(2.6-5).img and apppend the startup in the grub.conf or in the lili.conf
  Now that new kernel has been compiled, the system can be configured to boot it:
 
  Now, a listing ofkernels should show at least your default kernel and your new one, vmlinuz-2.2.5-15-ppentium
  #ls -l /boot/vmlinuz*

  you can look the /etc/grub.conf, it is not append a new startup options

    If everything has gone according to plan, it's time to reboot and attempt to load the new kernel

we hope you have a good luck. if have some problem, you must apply to the net.    

阅读(504) | 评论(0) | 转发(0) |
0

上一篇:linux下的find command

下一篇:linux下的function

给主人留下些什么吧!~~