流浪的妖精's profile流浪妖精のForestPhotosBlogLists Tools Help

Blog


    03/08/2006

    2.6内核编译项详解

    内核版本:2.6.17
         make menuconfig 后你将看到linux内核配置页面一次有下列选项,后面将一项一项解释其功能:
    1. Code maturity level options 代码成熟等级。此处只有一项:prompt for development and/or incomplete code/drivers,如果你要试验现在仍处于实验阶段的功能,比如khttpd、IPv6等,就必须把该项选择为Y了;否则可以把它选择为N。
    2.General setup 这里是对最普通的一些属性进行设置。这部分内容非常多,一般使用缺省设置就可以了。
    () Local version - append to kernel release :这里填入的是64字符以内的字符串,你在这里填上的字符口串可以用uname -a命令看到。
    [*] Support for paging of anonymous memory (swap) 这是使用交换分区或者交换文件来做为虚拟内存的,当然要选上了。
    [*] System V IPC 表示系统5的Inter Process Communication,它用于处理器在程序之间同步和交换信息,如果不选这项,很多程序运行不起来
    [*] POSIX Message Queues 这是POSIX的消息队列,它同样是一种IPC。建议你最好将它选上
    [*] BSD Process Accounting这是充许用户进程访问内核将账户信息写入文件中。这通常被认为是个好主意,建议你最好将它选上。
    [*] BSD Process Accounting version 3 file format 指定信息写入格式
    [*] Sysctl support 这个选项能不重新编译内核修改内核的某些参数和变量,如果你也选择了支持/proc,将能从/proc/sys存取可以影响内核的参数或变量。建议你最好将它选上
    [ ] Auditing support审记支持,用于和内核的某些子模块同时工作,例如SELinux。只有选择此项及它的子项,才能调用有关审记的系统调用
    [*] Kernel .config support
    将.config配置信息保存在内核中,选上它及它的子项使得其它用户能从/proc中得到内核的配置
    [*] Enable access to .config through /proc/config.gz
    [] Cpuset support 多CPU时用到,一般不选
    [*] Kernel Userspace relay support (formerly relayfs)内核中分为系统区和用户区,这里系统区和用户区进行通讯的一种方式,选上。 ()Initramfs source file(s)
    [*]Enable 16-bit UID system calls
    []Enable VM86 support  虚拟X86支持,应该是嵌入式系统上或个别软件会用到
    []Optimize for size 修改gcc的参数“-0s”代替“-02”,为了编译较小的内核代码等
    [ ] Configure standard kernel features (for small systems) ---> 这是为了编译某些特殊的内核使用的,通常要很熟悉自己要做个什么样的内核的时候才会用到。
    [ ] Load all symbols for debugging/kksymoops
    是否装载所有的调试符号表信息,如果你不需要对内核调试,不需要选择此项。
    [*] Enable futex support
    不选这个内核不一定能正确的运行使用glibc的程序,当然要选上
    [*] Enable eventpoll support
    不选这个内核将不支持事件轮循的系统调用,最好选上
    [*] Optimize for size
    这个选项使gcc使用-Os的参数而不是-O2的参数来优化编译,以获得更小尺寸的内核,建议选上。
    [*] Use full shmem filesystem
    除非你在很少的内存且不使用交换内存时,才不要选择这项
    (0) Function alignment
    (0) Label alignment
    (0) Loop alignment
    (0) Jump alignment
    3.Loadable module support 对模块的支持。这里面有三项:
    Enable loadable module support:除非你准备把所有需要的内容都编译到内核里面,否则该项应该是必选的。
    Module unloading:模块可卸载,如果不选这项,加载的模块就不能被卸载
    Forced module unloading:内核不管是模块被使用,强迫卸载模块(rmmod -f),即使有些模块被卸载是不安全的。
    Module versioning support:有一些模块在你内核重新编译后,需要重新编译这些模块
    Source checksum for all modules:
    Automatic Kernel module loader:让内核在启动时有自己装入必需模块的能力,建议选上
    4.Block layer 块设备层
    Support for Large Block Devices:支持大的块设备, 大于2T的硬盘或者raid磁盘阵列等
    Support for tracing block io actions:
    Support for Large Single Files:支持单个大文件
    5.Processor type and features:处理器(CPU)l类型和属性设置
    Symmetric multi-processing support:对称多处理支持。除非你富到有多个CPU,否则就不用选了。
    Processor family:根据你自己的情况选择CPU类型。
    High Memory Support:大容量内存的支持。可以支持到4G、64G,一般可以不选。
    Math emulation:协处理器仿真。协处理器是在386时代的宠儿,现在早已不用了。
    MTTR support:MTTR支持。可不选。
    6.Power Management Options电源管理选项
    [*] Power Management support
    [ ] Power Management Debug Support
    [ ] Software Suspend (EXPERIMENTAL)
    ACPI (Advanced Configuration and Power Interface) Support --->
    APM (Advanced Power Management) BIOS Support --->
    CPU Frequency scaling --->

    ACPI (Advanced Configuration and Power Interface) Support --->
    [*] ACPI Support 这是一种电源管理方式,你可以看看你的BIOS是否支持。如果支持的话建议你选上这项
    [ ] Sleep States (EXPERIMENTAL)
    < > AC Adapter
    < > Battery
    <*> Button 捕获Power、Sleep、Lid(我也不知道这是什么按钮)等按钮是否按下,并做相应的动作
    <*> Video 集成在板上的显卡的ACPI支持,对有些板卡可能不起作用
    < > Fan
    <*> Processor
    <*> Thermal Zone
    < > ASUS/Medion Laptop Extras
    < > IBM ThinkPad Laptop Extras
    < > Toshiba Laptop Extras
    (0) Disable ACPI for systems before Jan 1st this year
    [ ] Debug Statements
    [*] Power Management Timer Support

    APM (Advanced Power Management) BIOS Support --->
    < > APM (Advanced Power Management) BIOS support 高级电源管理的支持,一般来说笔记本应该选上,台式机可以不选。
    [ ] Ignore USER SUSPEND
    [*] Enable PM at boot time
    [ ] Make CPU Idle calls when idle
    [ ] Enable console blanking using APM
    [ ] RTC stores time in GMT 按Unix的标准,硬件的时钟应该设为格林威治时间
    [ ] Allow interrupts during APM BIOS calls
    [*] Use real mode APM BIOS call to power off
    [*] CPU Frequency scaling 这一选项允许改变CPU的主频,使CPU在低负荷或使用电池时降低主频,达到省电的目的。
    [ ] Enable CPUfreq debugging
    < > /proc/cpufreq interface (deprecated)
    Default CPUFreq governor (performance) --->
    --- 'performance' governor
    <*> 'powersave' governor
    <*> 'userspace' governor for userspace frequency scaling
    [ ] /proc/sys/cpu/ interface (2.4. / OLD)
    <*> 'ondemand' cpufreq policy governor自动调节主频
    <*> CPU frequency table helpers 多数的CPU需要这一项来调节主频
    <*> ACPI Processor P-States driver 报告处理器的状态
    < > AMD Mobile K6-2/K6-3 PowerNow!
    < > AMD Mobile Athlon/Duron PowerNow!
    < > AMD Opteron/Athlon64 PowerNow!
    < > Cyrix MediaGX/NatSemi Geode Suspend Modulation
    <*> Intel Enhanced SpeedStep Intel的变频技术支持
    [ ] Use ACPI tables to decode valid frequency/voltage pairs
    --- Built-in tables for Banias CPUs
    < > Intel Speedstep on ICH-M chipsets (ioport interface)
    < > Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)
    < > Intel Pentium 4 clock modulation
    < > nVidia nForce2 FSB changing
    < > Transmeta LongRun
    < > VIA Cyrix III Longhaul
    --- shared options
    [ ] /proc/acpi/processor/../performance interface (deprecated)
    [ ] Relaxed speedstep capability checks
    7.Bus Options(PCI,PCMCIA,EISA,MCA,ISA)
    [*] PCI support
    PCI access mode (Any) --->强列建议选Any,系统将优先使用MMConfig,然后使用BIOS,最后使用Direct检测PCI设备。
    [ ] Message Signaled Interrupts (MSI and MSI-X)
    [ ] Legacy /proc/pci interface
    [ ] PCI device name database
    [ ] ISA support
    [*] EISA support
    [*] Vesa Local Bus priming
    [*] Generic PCI/EISA bridge
    [*] EISA virtual root device
    [ ] EISA device name database
    [ ] MCA support
    < > NatSemi SCx200 support
    PCCARD (PCMCIA/CardBus) support --->
    PCI Hotplug Support --->

    PCCARD (PCMCIA/CardBus) support --->一般只有笔记本电脑上才会有PCMCIA插槽,如果你是台式机的话,可以不选这一项,然后跳过这一部份。

    PCI Hotplug Support --->
    < > Support for PCI Hotplug (EXPERIMENTAL) 一般来讲只有服务器上会有热插拔的设备,如果你使用的是台式机,你可以不选择此项并跳过这一部份。
    8.Executable file formats可执行文件格式支持
    [*] Kernel support for ELF binaries ELF是开放平台下最常用的二进制文件,它支持不同的硬件平台
    < > Kernel support for a.out and ECOFF binaries
    <*> Kernel support for MISC binaries此选项允许插入二进制的封装层到内核中,当使用Java、.NET、Python、Lisp等语言编写的程序时非常有用
    9.Networking网络
    10.Device Drivers设备驱动
    11.File systems文件系统
    <*> Second extended fs support
    [*] Ext2 extended attributes
    [*] Ext2 POSIX Access Control Lists
    [*] Ext2 Security Labels
    <*> Ext3 journalling file system support
    [*] Ext3 extended attributes
    [*] Ext3 POSIX Access Control Lists
    [*] Ext3 Security Labels
    [ ] JBD (ext3) debugging support
    <*> Reiserfs support
    [ ] Enable reiserfs debug mode
    [ ] Stats in /proc/fs/reiserfs
    [*] ReiserFS extended attributes
    [*] ReiserFS POSIX Access Control Lists
    [*] ReiserFS Security Labels
    JFS filesystem support
    [*] JFS POSIX Access Control Lists
    [ ] JFS debugging
    [ ] JFS statistics
    XFS filesystem support
    [*] Realtime support (EXPERIMENTAL)
    [*] Quota support
    [*] Security Label support
    [*] POSIX ACL support
    < > Minix fs support
    < > ROM file system support
    [*] Quota support
    < > Old quota format support
    Quota format v2 support
    [*] Dnotify support
    < > Kernel automounter support
    < > Kernel automounter version 4 support (also supports v3)
    CD-ROM/DVD Filesystems --->
    DOS/FAT/NT Filesystems --->
    Pseudo filesystems --->
    Miscellaneous filesystems --->
    Network File Systems --->
    Partition Types --->
    Native Language Support --->
    12.Instrumentation Support
    13.Kernel hacking配置了这个,即使在系统崩溃时,你也可以进行一定的工作了。普通用户是用不着这个功能的。
    14.Security options 安全相关
    15.Cryptographic options
    16.Library routines