make menuconfig 最常使用的,是文字模式下面可以显示类似图形接口的方式,不需要启动 X Window 就能够挑选核心功能菜单!
make oldconfig 通过使用已存在的 ./.config 文件内容,使用该文件内的设置值为默认值,只将新版本核心内的新功能选项列出让使用者选择, 可以简化核心功能的挑选过程!对于作为升级核心源代码后的功能挑选来说,是非常好用的一个项目!
make xconfig 通过以 Qt 为图形接口基础功能的图形化接口显示,需要具有 X window 的支持。例如 KDE 就是通过 Qt 来设计的 X Window,因此你如果在 KDE 画面中,可以使用此一项目。
make gconfig 通过以 Gtk 为图形接口基础功能的图形化接口显示,需要具有 X window 的支持。例如 GNOME 就是通过 Gtk 来设计的 X Window,因此你如果在 GNOME 画面中,可以使用此一项目。
make config 最旧式的功能挑选方法,每个项目都以条列式一条一条的列出让你选择,如果设置错误只能够再次选择,很不人性化啊!
大致的功能选择有上述的方法,更多的方式可以参考核心目录下的 README 文件。鸟哥个人比较偏好 make menuconfig 这个项目啦!如果你喜欢使用图形接口, 然后使用鼠标去挑选所需要的功能时,也能使用 make xconfig 或 make gconfig ,不过需要有相关的图形接口支持! 如果你是升级核心源代码并且需要重新编译,那么使用 make oldconfig 会比较适当!
[*] Enable loadable module support ---> <==下面为细项
--- Enable loadable module support
[*] Forced module loading
[*] Module unloading
[*] Forced module unloading # 其实鸟哥认为这个项目可能可以选择的!免得常常无法卸载模块!
[*] Module versioning support
[*] Source checksum for all modules
[*] Module signature verification
[ ] Require modules to be validly signed
[*] Automatically sign all modules
Which hash algorithm should modules be signed with? # 可以选择 SHA256 即可!
================================================================================
-*- Enable the block layer ---> <==看吧!默认就是已经选择了!下面为细项
-*- Block layer SG support v4
-*- Block layer SG support v4 helper lib
[*] Block layer data integrity support
[*] Block layer bio throttling support
Partition Types ---> # 至少下面的数个项目要选择!
[*] Macintosh partition map support
[*] PC BIOS (MSDOS partition tables) support
[*] Windows Logical Disk Manager (Dynamic Disk) support
[*] SGI partition support
[*] EFI GUID Partition support
.....(其他保留默认值).....
IO Schedulers ---> # 磁盘伫列的处理方式
<*> Deadline I/O scheduler # 鸟哥非常建议将此项目设置为核心功能!
<*> CFQ I/O scheduler
[*] CFQ Group Scheduling support
Default I/O scheduler (Deadline) ---> # 相当建议改为Deadline
CPU 的类型与功能选择
进入“Processor type and features”后,请挑选你主机的实际 CPU 形式。鸟哥这里使用的是 Intel E5 的 CPU, 而且鸟哥的主机还有启动 KVM 这个虚拟化的服务 (在一部主机上面同时启动多个操作系统),因此,所以下面的选择是这样的:
.....(其他保留默认值).....
[*] Linux guest support ---> # 提供 Linux 虚拟化功能
[*] Enable paravirtualization code # 至少下面这几样一定要有选择才好!
[*] Paravirtualization layer for spinlocks
[*] Xen guest support
[*] KVM Guest support (including kvmclock)
[*] Paravirtual steal time accounting
.....(其他保留默认值).....
Processor family (Generic-x86-64) ---> # 除非你是旧系统,否则就用他!
[*] Enable Maximum number of SMP Processors and NUMA Nodes
[*] Multi-core scheduler support
Preemption Model (No Forced Preemption (Server) ---> # 调整成 server 喔!原本是 desktop
.....(其他保留默认值).....
Timer frequency (300 HZ) ---> # server 设置成 300 即可!
# 这个项目则与核心针对某个事件立即回应的速度有关。Server 用途可以调整到
# 300Hz 即可,如果是桌面电脑使用,需要调整高一点,例如 1000Hz 较佳!
.....(其他保留默认值).....
电源管理功能
如果选择了“Power management and ACPI options”之后,就会进入系统的电源管理机制中。 其实电源管理机制还需要搭配主板以及 CPU 的相关省电功能,才能够实际达到省电的效率啦! 不论是 Server 还是 Desktop 的使用,在目前电力不足的情况下,能省电就加以省电吧!
.....(其他保留默认值).....
[*] ACPI (Advanced Configuration and Power Interface) Support --->
# 对嵌入式系统来说,由于可能会增加核心容量故需要考虑考虑。至于 desktop/server 当然就选择啊
# 至于内容细项大致保持默认值即可
CPU Frequency scaling --->
# 决定 CPU 频率的一个重要项目,基本上的项目是 ondemand 与 performance 两者!
<M> CPU frequency translation statistics
[*] CPU frequency translation statistics details
Default CPUFreq governor (ondemand) ---> # 现在大家都建议用这个!
-*- 'performance' governor
<*> 'powersave' governor
<*> 'userspace' governor for userspace frequency scaling
-*- 'ondemand' cpufreq policy governor
<*> 'conservative' cpufreq governor
x86 CPU frequency scaling drivers --->
# 这个子项目内全部都是省电机制,能编成模块的全部选择!要加入核心的都加入就对了!
[*] PCI support
[*] Support mmconfig PCI config space access
[*] PCI Express support
<*> PCI Express Hotplug driver
.....(其他在 PCI Express 下面的项目大多保留默认值).....
-*- Message Signaled Interrupts (MSI and MSI-X)
<*> PCI Stub driver # 如果要玩虚拟化,这个部份建议编进核心!
.....(其他保留默认值).....
编译后可执行文件的格式
选择“Executable file formats / Emulations”会见到如下选项。 下面的选项必须要勾选才行喔!因为是给 Linux 核心运行可执行文件之用的数据。通常是与编译行为有关啦!
-*- Kernel support for ELF binaries
[*] Write ELF core dumps with partial segments
<*> Kernel support for scripts starting with #!
<M> Kernel support for MISC binaries
[*] IA32 Emulation
<M> IA32 a.out support
[*] x32 ABI for 64-bit mode
# 因为我们的 CentOS 已经是纯 64 位的环境!所以个人建议这里还是要选择仿真 32 位的功能!
# 不然若有些比较旧的软件,恐怕会无法被你的系统所执行喔!
# 下面仅有列出比较重要及与默认值不同的项目而已喔!所以项目少很多!
<M> Second extended fs support # 默认已经不支持 ext2/ext3,这里我们将他加回来!
<M> Ext3 journalling file system support
[*] Default to 'data=ordered' in ext3 (NEW)
[*] Ext3 extended attributes (NEW)
[*] Ext3 POSIX Access Control Lists
<M> The Extended 4 (ext4) filesystem # 一定要有的支持
<M> Reiserfs support
<M> XFS filesystem support # 一定要有的支持!
[*] XFS Quota support
[*] XFS POSIX ACL support
[*] XFS Realtime subvolume support # 增加这一项好了!
<M> Btrfs filesystem support # 最好有支持!
[*] Quota support
<*> Quota format vfsv0 and vfsv1 support
<*> Kernel automounter version 4 support (also supports v3)
<M> FUSE (Filesystem in Userspace) support
DOS/FAT/NT Filesystems --->
<M> MSDOS fs support
<M> VFAT (Windows-95) fs support
(950) Default codepage for FAT # 要改成这样喔!中文支持!
(utf8) Default iocharset for FAT # 要改成这样喔!中文支持!
<M> NTFS file system support # 建议加上 NTFS 喔!
[*] NTFS write support # 让他可读写好了!
Pseudo filesystems ---> # 类似 /proc ,保留默认值
-*- Miscellaneous filesystems ---> # 其他文件系统的支持,保留默认值
[*] Network File Systems ---> # 网络文件系统!很重要!也要挑挑!
<M> NFS client support
<M> NFS server support
[*] NFS server support for NFS version 4
<M> CIFS support (advanced network filesystem, SMBFS successor)
[*] Extended statistics
[*] Provide CIFS client caching support
-*- Native language support ---> # 选择默认的语系
(utf8) Default NLS Option
<M> Traditional Chinese charset (Big5)
另外还有“ Cryptographic API ”这个密码应用程序接口工具选项,以前的默认加密机制为 MD5,近年来则改用了 SHA 这种机制。 不过,反正默认已经将所有的加密机制编译进来了,所以也是可以保留默认值啦!都不需要额外修改就是了!
虚拟化与函数库
虚拟化是近年来非常热门的一个议题,因为计算机的能力太强,所以时常闲置在那边, 此时,我们可以通过虚拟化技术在一部主机上面同时启动多个操作系统来运行,这就是所谓的虚拟化。 Linux 核心已经主动的纳入虚拟化功能喔!而 Linux 认可的虚拟化使用的机制为 KVM (Kernel base Virtual Machine)。 至于常用的核心函数库也可以全部编为模块啰!
[*] Virtualization --->
--- Virtualization
<M> Kernel-based Virtual Machine (KVM) support
<M> KVM for Intel processors support
<M> KVM for AMD processors support
[*] Audit KVM MMU
[*] KVM legacy PCI device assignment support # 虽然已经有 VFIO,不过建议还是选起来!
<M> Host kernel accelerator for virtio net
================================================================================
Library routines --->
# 这部份全部保留默认值即可!
此外,因为鸟哥重视的地方在于“网络服务器与虚拟化服务器”上面,所以里头的设置少掉了相当多的个人桌上型 Linux 的硬件编译!所以,如果你想要编译出一个适合你的机器的核心, 那么可能还有相当多的地方需要来修正的!不论如何,请随时以 Help 那个选项来看一看内容吧!反正 Kernel 重编的概率不大!花多一点时间重新编译一次! 然后将该编译完成的参数文件储存下来,未来就可以直接将该文件叫出来读入了! 所以花多一点时间安装一次就好!那也是相当值得的!