| 
 
          [ << ]
        
          [ < ]
        
      [ 主页 ]
      
            [ > ]
          
            [ >> ]
           
 7. 配置内核内容:7.a. 时区 
您首先需要选择您自己的时区,这样可以让系统知道它的位置在哪里。您可以在/usr/share/zoneinfo中找到您所在的时区,然后把它复制到/etc/localtime。请不要使用/usr/share/zoneinfo/Etc/GMT*下的时区,因为它们“名不副实”。例如,GMT-8事实上是GMT+8区。
 
| 代码 1.1: 设置时区信息 |  | 
# ls /usr/share/zoneinfo
# cp /usr/share/zoneinfo/GMT /etc/localtime
 |  7.b. 安装源码 选择内核 
Linux内核是所有发行版的核心。它位于用户程序和系统硬件之间。Gentoo提供给我们几个可选的内核源码。完整的清单参见Gentoo内核指南。 
 
对于ARM系统,我们使用gentoo-sources(包含一些附加特性的补丁)。
 
现在请使用emerge命令安装它。
 
| 代码 2.1: 安装内核源码 |  | 
# emerge gentoo-sources
 |  
当您查看/usr/src时,您将会看到一个叫做linux的符号链接指向您安装的内核源码。在我们这个例子中,安装的源码是gentoo-sources-2.6.17-r5。您的版本可能有所不同,所以请你记住它。
 
| 代码 2.2: 查看内核源码符号链接 |  | 
# ls -l /usr/src/linux
lrwxrwxrwx    1 root   root    12 Oct 13 11:04 /usr/src/linux -> linux-2.6.17-r5
 |  7.c. 缺省:手动配置 介绍 
手动配置内核经常被Linux使用者认为是最困难的步骤。事实并非如此——但是当您手动配置几次内核之后,您就不会再觉得它有多么难了。;)
 
然而,一件事情是真的:在手动配置内核之前,您必须了解您的系统。您可以安装pciutils(emerge pciutils),用其中的lspci来了解您需要的大部分信息。您现在可以在chroot的环境中运行lspci。您可以忽略任何pcilib的警告。(类似于pcilib: cannot open/sys/bus/pci/devices)。此外,您也可以在非chroot的环境执行lspci。结果相同。您还可以运行lsmod来查看安装光盘使用了哪些内核模块。(这也是个不错的提示,它可以教你该选择哪些模块)。
 
现在进入到您的内核目录并且执行make menuconfig。这将会启动一个基于ncureses的配置菜单。
 
| 代码 3.1: 开始menuconfig |  | 
# cd /usr/src/linux
# make menuconfig
 |  
您将会看到一些配置条目。首先我们将会列出一些您必须启用的选项(否则Gentoo将不能正常运行或者根本不能运行)。
 必须启用的选项 
鉴于嵌入设备的特殊属性,我们将在这里介绍已知的arm板配置。如果您的机器不在列表中,那么您应当访问相关的社区站点,搜询如何正确配置您的内核。
 
请从以下列表中选择您的机器来进入配置章节。
 7.d. NetWinder配置选项 
记住启动分区需要EXT2支持,因为那是引导程序唯一能从中读取到可靠数据的文件系统。另外,EXT3是唯一已测试过的文件系统,您可以和其他玩家一起试用;)。
 
| 代码 4.1: NetWinder配置选项 |  | 
# make netwinder_defconfig
System Type --->
  ARM system type (FootBridge) --->
    (X) FootBridge
  Footbridge Implementations --->
    [*] NetWinder
Floating point emulation --->
  [*] NWFPE math emulation
File systems --->
  [*] Second extended fs support
  Pseudo Filesystems --->
    [*] /proc file system support
    [*] Virtual memory file system support (former shm fs)
Device Drivers --->
  ATA/ATAPI/MFM/RLL support --->
    [*] ATA/ATAPI/MFM/RLL support
    [*]   Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
    [*]     Include IDE/ATA-2 DISK support
    ---     IDE chipset support/bugfixes
    [*]     PCI IDE chipset support
    [*]       Winbond SL82c105 support
    [*]       Generic PCI bus-master DMA support
  Network device support --->
    [*] Network device support
    Ethernet (10 or 100Mbit) --->
      [*] Ethernet (10 or 100Mbit)
      Tulip family network device support --->
        [*] "Tulip" family network device support
        [*]   DECchip Tulip (dc2114x) PCI support
        [*]     Use PCI shared mem for NIC registers
        [*]     Use NAPI RX polling
      [*] EISA, VLB, PCI and on board controllers
      [*]   PCI NE2000 and clones support
  Character devices --->
    Serial drivers --->
      [*] 8250/16550 and compatible serial support
      [*]   Console on 8250/16550 and compatible serial port
      --- Non-8250 serial port support
      [*] DC21285 serial port support
      [*]   Console on DC21285 serial port
    Watchdog Cards --->
      [*] Watchdog Timer Support
      [*]   NetWinder WB83C977 watchdog
    [*] NetWinder thermometer support
    [*] NetWinder Button
    [*]   Reboot Using Button
Kernel Features --->
  [*] Preemptible Kernel
  [*] Timer and CPU usage LEDs
  [*]   CPU usage LED
File systems --->
  [*] Ext3 journalling file system support
Device Drivers --->
  Input device support --->
    [*] Keyboards --->
      [*] AT keyboard
    [*] Mouse --->
      [*] PS/2 mouse
  Graphics support --->
    [*] Support for frame buffer devices
    [*]   Enable firmware EDID
    [*]   CyberPro 2000/2010/5000 support
    Logo configuration --->
      [*] Bootup logo
      [*]   Standard 224-color Linux logo
  Sound --->
    [*] Sound card support
    Open Sound System --->
      [*] Open Sound System
      [*]   OSS sound modules
      [*]     Yamaha FM synthesizer (YM3812/OPL-3) support
      [*]     Netwinder WaveArtist
Device Drivers --->
  Character devices --->
    [*] NetWinder flash support
 |  
当您完成了内核配置,点击编译与安装。
 7.e. 编译与安装 
既然现在您的内核已经配置成功了,那么就是时候编译并且安装它了。退出配置界面并且开启编译进程:
 
| 代码 5.1: 编译内核 |  | 
# make && make modules_install
 |  
当内核编译完成,复制内核镜像到/boot。给您所选的内核镜像定个恰当的名字并记住它,因为后面当您配置引导程序的时候还要用到它。记得替换kernel-2.6.17-gentoo-r5为您的内核名字和版本。
 
| 代码 5.2: 安装内核 |  | 
# cp vmlinux.gz /boot/kernel-2.6.17-gentoo-r5
 |  
现在请从内核模块一节继续安装。
 7.f. 内核模块 配置模块 
您应该在/etc/modules.autoload.d/kernel-2.6中列出您需要自动加载的模块。如果您愿意,您也可以加上模块的选项。
 
要查看所有可用的模块,运行如下的find命令。不要忘记把“<kernel version>”替换成你刚编译好的内核版本:
 
| 代码 6.1: 查看所有可用的模块 |  | 
# find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko' | less
 |  
例如,要自动加载3c59x.ko模块,编辑kernel-2.6文件然后写入模块的名字。
 
| 代码 6.2: 编辑/etc/modules.autoload.d/kernel-2.6 |  | 
# nano -w /etc/modules.autoload.d/kernel-2.6
 |  
| 代码 6.3: /etc/modules.autoload.d/kernel-2.6 |  | 
3c59x
 |  
现在请从配置您的系统一章来继续您的安装。
 
 
          [ << ]
        
          [ < ]
        
      [ 主页 ]
      
            [ > ]
          
            [ >> ]
           
 本文档的内容遵循知识共享-署名-相同方式共享许可协议 |