一、编译
现在的内核编译步骤真是简单极了
# make menuconfig
# make
# make modules_install
# make install
就这么两下,把以前繁杂的操作都包括了
# make modules
# make modules_install
# make install
# cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.14.3
# cp System.map /boot/System.map-2.6.14.3
# mkinitrd ……
# ln -s /boot/vmlinuz-2.6.14.3 /boot/vmlinuz
# ln -s /boot/System.map-2.6.14.3 /boot/System.map
#vim /boot/grub/menu.lst
上面这些都不用做了,真省事啊
主要就是make menuconfig这步了,这步说难也难,说不难也不难,总之呢就是按需配置
呵呵,按需配置,这下可没人能帮你了,得自己看着办了
二、可能出现的问题:
1、如果出现这样的错误进不去:Enforcing mode requested but no policy loaded
那是因为你原来系统启用了selinux的enforcing模式,你需要回到原来的系统关闭selinux就可以了,如果不需要selinux,那干脆编内核的时候就去掉。
2、启动错误提示:VFS:Unable to mount root fs on unknown-block(0,0)
请确保以下两项被编进内核
Device Drivers ---> Block devices --->
<*> RAM disk support
[*] Initial RAM disk (initrd) support
3、启动错误提示:
mkrootdev:lable /1 not found
mount:error 2 mounting ext3
mount:error 2 mounting none
switchroot:mount failed:22
Umount /initrd/dev failed:2
需要以下驱动支持:
Device Drivers ---> ATA/ATAPI/MFM/RLL support ---> [*] PCI IDE chipset support
……有问题的话再加
三、关于一些编译选项
1、如果是自己用的桌面系统,别忘了打开内核抢占
Processor type and features ---> Preemption Model (Preemptible Kernel (Low-Latency Desktop)) --->
说明:抢占模式:
No Forced Preemption (Server),这种模式等同于没有使能抢占选项的标准内核,主要适用于科学计算等服务器环境。
Voluntary Kernel Preemption (Desktop),这种模式使能了自愿抢占,但仍然失效抢占内核选项,它通过增加抢占点缩减了抢占延迟,因此适用于一些需要较好的响应性的环境,如桌面环境,当然这种好的响应性是以牺牲一些吞吐率为代价的。
Preemptible Kernel (Low-Latency Desktop),这种模式既包含了自愿抢占,又使能了可抢占内核选项,因此有很好的响应延迟,实际上在一定程度上已经达到了软实时性。它主要适用于桌面和一些嵌入式系统,但是吞吐率比模式2更低。
Complete Preemption (Real-Time),这种模式使能了所有实时功能,因此完全能够满足软实时需求,它适用于延迟要求为100微秒或稍低的实时系统。
实现实时是以牺牲系统的吞吐率为代价的,因此实时性越好,系统吞吐率就越低。
2、支持4G内存,我的没有这么多,你的呢
Processor type and features ---> High Memory Support (off)
四、下面是部分选项说明,可以参考下 < > ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)
APM (Advanced Power Management) BIOS Support --->
高级电源管理的支持,一般来说笔记本应该选上,台式机可以不选。
CPU Frequency scaling --->
这一选项允许改变CPU的主频,使CPU在低负荷或使用电池时降低主频,达到省电的目的。
Bus options (PCI, PCMCIA, EISA, MCA, ISA) --->
--- PCI support
PCI总线支持
PCI access mode (Any) --->
强列建议选Any,系统将优先使用MMConfig,然后使用BIOS,最后使用Direct检测PCI设备。
[ ] PCI Express support
PCI-E总线支持
[*] Legacy /proc/pci interface
[ ] PCI Debugging
[ ] ISA support
ISA总线,没有用就不要
[ ] MCA support
< > NatSemi SCx200 support
PCCARD (PCMCIA/CardBus) support --->
一般只有笔记本电脑上才会有PCMCIA插槽,如果你是台式机的话,可以不选这一项,然后跳过这一部份。
PCI Hotplug Support --->
一般来讲只有服务器上会有热插拔的设备,如果你使用的是台式机,你可以不选择此项并跳过这一部份。
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等语言编写的程序时非常有用
Networking --->
[*] Networking support
Networking options --->
需要什么协议、功能的自己选吧
[ ] Amateur Radio support --->
业余电台
< > IrDA (infrared) subsystem support --->
红外接口
< > Bluetooth subsystem support --->
蓝牙
< > Generic IEEE 802.11 Networking Stack
Device Drivers --->
驱动
Generic Driver Options --->
Connector - unified userspace <-> kernelspace linker --->
Memory Technology Devices (MTD) --->
Parallel port support --->
并口
Plug and Play support --->
即插即用
Block devices --->
< > Normal floppy disk support //软驱支持
[ ] SCSI tape drive support for Smart Array 5xxx
< > Mylex DAC960/DAC1100 PCI RAID Controller support
< > Micro Memory MM5415 Battery Backed RAM support (EXPERIMENTAL)
< > Promise SATA SX8 support
< > Low Performance USB Block driver
<*> RAM disk support
(16) Default number of RAM disks
(16384) Default RAM disk size (kbytes)
[*] Initial RAM disk (initrd) support
[*] Support for Large Block Devices
< > Packet writing on CD/DVD media
IO Schedulers --->
< > Anticipatory I/O scheduler
< > Deadline I/O scheduler
< > CFQ I/O scheduler
< > ATA over Ethernet support
ATA/ATAPI/MFM/RLL support --->
<*> ATA/ATAPI/MFM/RLL support
<*> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
--- Please see Documentation/ide.txt for help/info on IDE drives
[ ] Support for SATA (deprecated; conflicts with libata SATA driver)
[ ] Use old disk-only driver on primary interface
<M> Include IDE/ATA-2 DISK support
[*] Use multi-mode by default
<M> Include IDE/ATAPI CDROM support
< > Include IDE/ATAPI TAPE support (EXPERIMENTAL)
< > Include IDE/ATAPI FLOPPY support
<M> SCSI emulation support
[ ] IDE Taskfile Access
--- IDE chipset support/bugfixes
<*> generic/default IDE chipset support //使用IDE设备的这项要打*
[ ] CMD640 chipset bugfix/support
[ ] PNP EIDE support
[*] PCI IDE chipset support
[*] Sharing PCI IDE interrupts support
[ ] Boot off-board chipsets first support
<M> Generic PCI IDE Chipset Support
< > OPTi 82C621 chipset enhanced support (EXPERIMENTAL)
< > RZ1000 chipset bugfix/support
[*] Generic PCI bus-master DMA support
[ ] Force enable legacy 2.0.X HOSTS to use DMA
[*] Use PCI DMA by default when available
[ ] Enable DMA only for disks
< > AEC62XX chipset support
< > ALI M15x3 chipset support
< > AMD and nVidia IDE support
< > ATI IXP chipset IDE support
< > CMD64{3|6|8|9} chipset support
< > Compaq Triflex IDE support
< > CY82C693 chipset support
< > Cyrix CS5510/20 MediaGX chipset support (VERY EXPERIMENTAL)
< > Cyrix/National Semiconductor CS5530 MediaGX chipset support
< > HPT34X chipset support
< > HPT36X/37X chipset support
< > National SCx200 chipset support
< > Intel PIIXn chipsets support
< > IT821X IDE support
< > NS87415 chipset support
< > PROMISE PDC202{46|62|65|67} support
< > PROMISE PDC202{68|69|70|71|75|76|77} support
< > ServerWorks OSB4/CSB5/CSB6 chipsets support
< > Silicon Image chipset support
< > SiS5513 chipset support
< > SLC90E66 chipset support
< > Tekram TRM290 chipset support
< > VIA82CXXX chipset support
[ ] IGNORE word93 Validation BITS
SCSI device support --->
Multi-device support (RAID and LVM) --->
Fusion MPT device support --->
IEEE 1394 (FireWire) support --->
I2O device support --->
Network device support --->
ISDN subsystem --->
Telephony Support --->
Input device support --->
Character devices --->
I2C support --->
Dallas's 1-wire bus --->
Hardware Monitoring support --->
Misc devices --->
Multimedia Capabilities Port drivers --->
Multimedia devices --->
Graphics support --->
Sound --->
USB support --->
MMC/SD Card support --->
InfiniBand support --->
SN Devices --->
File systems --->
Profiling support --->
Kernel hacking --->
Security options --->
Cryptographic options --->
Library routines --->
Code maturity level options (代码成熟度选项)
[*] Prompt for development and/or incomplete code/drivers
默认情况下是选择的,这将会在设置界面中显示还在开发或者还没有完成的代码与驱动.你应该选择它,因为有许多设备可能必需选择这个选项才能进行配置,实际上它是安全的。
[*] Select only drivers expected to compile cleanly
选择这个选项你将不会看到一些已知的存在问题的驱动程序选项,默认的情况下也是选择的。如果你有设备没有找到驱动选项,你可以将这一项去掉,或许就可以找到相关驱动了,不过它可能是有BUG的。
General setup (常规设置)
[*] Support for paging of anonymous memory
这个选项将使你的内核支持虚拟内存,也就是让你的计算机好象拥有比实际内存更多 多的内存空间用来执行很大的程序。默认是选择的。
[*] System V IPC
为进程提供通信机制,这将使系统中各进程间有交换信息与保持同步的能力。如果不选这项,很多程序运行不起来。
[*] POSIX Message Queues
这是POSIX的消息队列,它同样是一种IPC。建议你最好将它选上
[ ] BSD Process Accounting
这里选择Y将会让内核为用户层的进程建立一个帐目(进程通过一个特殊的系统调用来通知内核),当程序退出时内核会将进程的相关信息记录到帐目文件中,主要包括进程的创建时间、 创建者,内存占用等信息。如果你需要就Y吧:)
[*] Sysctl support
这个选项能不重新编译内核修改内核的某些参数和变量,如果你也选择了支持/proc,将能从/proc/sys存取可以影响内核的参数或变量。建议你最好将它选上。打开这个选项将会增加内核的体积至少8KB,如果你的内核仅用制作安装与恢复系统系统盘那么可以不选,以减少对内存的占用。
[*] Auditing support
审记支持,用于和内核的某些子模块同时工作,例如SELinux。只有选择此项及它的子项,才能调用有关审记的系统调用
[*] Enable system-call auditing support
--- Support for hot-pluggable devices
支持热插拔的,最好选择
[*] Kernel Userspace Events
内核中分为系统区和用户区,这里系统区和用户区进行通讯的一种方式,选上。
[ ] Kernel .config support
这将会把内核的配置信息与相关的文档说明编译进内核中,以后可以使用一些工具来提取它用来重新构建内核,一般不用选它。
() Initramfs source file(s)
[ ] Configure standard kernel features (for small systems) --->
这是为了编译某些特殊的内核使用的,通常你可以不选择这一选项,你也不用对它下面的子项操心了。
