"Simple things are not easy to go wrong. ”
Wisdom! In fact, it's very important to cut down on the operating system's functionality that doesn't work for you. This not only means a smaller operating system, take up less disk space (today's hard drive says dozens of GB, and a few megabytes are bucket), and that means you're less likely to be attacked – in short, you don't have to worry about problems with modules that aren't installed in your operating system.
In this article, we will work together to optimize the configuration of the freebsd-i386 kernel. This article is written for freebsd4.7-stable, and the FreeBSD 4.x configuration will not be much different from this article. If you want to optimize the kernel of FreeBSD 5 or FreeBSD 2/3, you'll need to refer to their lint files (which will be mentioned later).
[Note: FreeBSD 5.0 is scheduled to be released on November 20, 2002.] FreeBSD's development team attaches great importance to the quality of the release and believes that this is more important than the release plan, but for the same reason, we often find that the actual release of FreeBSD is later than scheduled, usually within half a month. FreeBSD 5.0, the most important recent release of FreeBSD, is likely to be postponed, but I personally think we will be able to see the final release by the end of this year anyway. FreeBSD 5.0 has made a lot of changes to the system, and this series of articles will be released on the day FreeBSD 5.0 release for 5.0 revision, and the existing version will be retained, but into the maintenance phase, no longer introduce new content. ]
FreeBSD source code can be directly from the central CVSup server synchronization, but also as part of the system in the installation of a soldier installed. I have already said how to sync the source code, no longer repeat here. FreeBSD's source code (usually in/USR/SRC) contains all the codes that build the base system, while in/usr/src/sys there are several directories corresponding to different computer architectures (4.x supports only i386 and Alpha). i386 is a generic name that contains all the machines that are compatible with Intel 80386, not specifically 80386.
A brief introduction to FreeBSD kernel files. In the 4.x system, the/kernel file is the default kernel, which is normally started using it. /kernel. Generic This file is a strong compatibility kernel, if the/kernel can not boot the system, you have to rely on this file to boot. /kernel.old is the kernel before the make kernel, and you can also consider using/kernel.old to boot the system, usually if your kernel is broken.
/modules/is the kernel module, and/modules.old/is the corresponding/kernel.old module. These files are replaced at the same time each time the kernel is replaced.
In 5.0, the kernel and kernel modules are stored in the/boot/kernel.
There are two profiles in the/usr/src/sys/i386/conf, generic and lint. Where generic is the default profile for make kernel, direct make kernel generates the generic kernel, but is named/kernel when it is installed. A kernel is installed when the system is installed. GENERIC, later, this file will not follow the system make kernel update, so if you think this file is necessary to update, you need to manually make kernel, and/kernel renamed kernel. GENERIC. Of course, this is not usually necessary.
Lint is a file that includes nearly all kernel compilation configuration details. This configuration is not meant to really build kernel, his main purpose is to show the user the available kernel compilation configuration. When modifying the kernel compilation configuration, it is best to refer to this file first.
To configure your own kernel, you should copy generic to a different file. It's customary for this file to be the same as the host name. For example, I named my own Web machine apache.intranet.frontfree.net, and named Apache the configuration file:
Cd/usr/src/sys/i386/conf
CP GENERIC APACHE
Then, edit it with EE Apache. Let's take an actual generic file to illustrate.
To save space, the notes on the header of the document were deleted.
Machine i386 # system model for i386
CPU I386_CPU # Support 80386
CPU I486_CPU # Support 80486
CPU I586_CPU # Support Pentium
CPU I686_CPU # Support Pentium Pro and higher
Ident GENERIC # kernel file name
Maxusers 0 # Automatically detects the maximum number of users allowed at the same time
#makeoptions debug=-g # contains debug symbols. Usually only the current version is open
Options Math_emulate #支持协处理器模拟
Options INET #支持互联网
Options INET6 #IPv6通讯协议
Options FFS #伯克利快速文件系统
Options Ffs_root #FFS作为根设备 [must be preserved]
Options softupdates #打开FFS Soft Updates support
Options Ufs_dirhash #提高大型目录的支持
Options MFS #内存文件系统
Options Md_root #MD作为根设备
Options NFS #Network FileSystem
Options Nfs_root #NFS作为根设备 (requires NFS)
Options Msdosfs #MSDOS文件系统
Options CD9660 #ISO 9660 file System (CD-ROM)
Options Cd9660_root #CD-rom as a root device (requires CD9660)
Options Procfs #进程文件系统
Options compat_43 #兼容4.3bsd[must be retained]
Options scsi_delay=15000 #检测SCSI设备前的延时 (MS)
Options Uconsole #用户可以夺取控制台
Options Userconfig #boot-C editor Editor
Options Visual_userconfig #菜单式boot-C editor
Options Ktrace #ktrace (1) Support
Options Sysvshm #SYSV-style shared memory
Options sysvmsg #SYSV-style Message Queuing
Options Sysvsem #SYSV-style semaphore (semaphores)
Options p1003_1b #Posix p1003_1b Real-time extension
Options _kposix_priority_scheduling
Options Icmp_bandlim #对恶意ICMP请求进行限制
Options Kbd_install_cdev # Install a cdev device in/dev
# The following two items are required when making a symmetric multiprocessor (SMP) kernel
#options SMP #对称多处理器内核
#options apic_io #对称 (APIC) I/O
Device Isa
Device EISA
Device PCI
# Floppy Drive
Device fdc0 at Isa? Port IO_FD1 IRQ 6 DRQ 2
Device fd0 at Fdc0 Drive 0
Device FD1 at FDC0 Drive 1
#
# If you use the Toshiba libretto and his Y-E Y-E Data PCMCIA Floppy Drive
# do not use the above fdc0, but should use
#device fdc0
# ATA and ATAPI devices
Device ata0 at Isa? Port IO_WD1 IRQ 14
Device Ata1 at Isa? Port IO_WD2 IRQ 15
Device ATA
Device Atadisk # ATA disk drive (IDE hard drive)
Device ATAPICD # ATAPI Optical Drive
Device ATAPIFD # ATAPI floppy Drive
Device Atapist # ATAPI tape Drive
Options ata_static_id #静态设备编号
# SCSI Controller
Device AHB # EISA AHA1742 Family
Device AHC # AHA2940 onboard aic7xxx equipment
Device AMD # AMD 53c974 (Tekram DC-390 (T))
Device ISP # Qlogic family
Device NCR # Ncr/symbios Logic
Device Sym # Ncr/symbios Logic (newer chipset)
Options sym_setup_lp_probe_map=0x40
# Use NCR to hook up old NCR devices with SYM and NCR configured
Device Adv0 at Isa?
Device ADW
Device Bt0 at Isa?
Device aha0 at Isa?
Device Aic0 at Isa?
Device NCV # NCR 53c500
Device NSP # workbit Ninja SCSI-3
Device STG # TMC 18C30/18C50
# SCSI Peripherals
Device SCBUs # SCSI bus (must have if SCSI device is used)
Device da # Direct Access (hard disk)
Device SA # sequential Access (tapes, etc.)
Device CD # CD
Device Pass # Passthrough device (direct SCSI access)
# RAID controller with SCSI subsystem interface
Device ASR # DPT SmartRAID V, VI and Adaptec SCSI RAID
Device DPT # DPT Smartcache-see LINT for options!
Device IIR # Intel Integrated RAID
Device Mly # Mylex Acceleraid/extremeraid
Device Ciss # Compaq SmartRAID 5* Series
# RAID Controller
Device AAC # Adaptec FSA RAID, Dell perc2/perc3
Device AACP # SCSI passthrough for AAC (requires CAM)
Device Ida # Compaq Smart RAID
Device AMR # AMI MegaRAID
Device MLX # Mylex DAC960 Family
Device TWE # 3ware Escalade
# ATKBDC0 Control keyboard and PS/2 mouse
Device atkbdc0 at Isa? Port IO_KBD
Device atkbd0 at ATKBDC? IRQ 1 Flags 0x1
Device psm0 at ATKBDC? IRQ 12
Device vga0 at Isa?
# splash screen and screen saver
Pseudo-device Splash
# syscons is the default console driver, similar to the SCO console
Device sc0 at Isa? Flags 0x100
# for PCVT vt220 console, enable this and PCVT_FREEBSD
#device vt0 at Isa?
#options Xserver # support x server on VT console
#options Fat_cursor # using the big cursor
# If you're using ThinkPad, remove the comments from the following line and other PCVT related devices
#options pcvt_scanset=2 # IBM uses a nonstandard keyboard
# floating point operation Support-do not disable
Device npx0 at Nexus? Port IO_NPX IRQ 13
# Power Management Support
Device Apm0 at Nexus? Disable Flags 0x20 # Advanced Power Management
# PCCard (PCMCIA) support
Device Card
Device Pcic0 at Isa? IRQ 0 Port 0x3e0 Iomem 0xd0000
Device Pcic1 at Isa? IRQ 0 Port 0x3e2 iomem 0xd4000 Disable
# serial port (COM)
Device Sio0 at Isa? Port IO_COM1 flags 0x10 IRQ 4
Device Sio1 at Isa? Port Io_com2 IRQ 3
Device SiO2 at Isa? Disable Port IO_COM3 IRQ 5
Device SiO3 at Isa? Disable Port IO_COM4 IRQ 9
# and Mouth
Device ppc0 at Isa? IRQ 7
Device Ppbus # and Port bus (required for all port devices)
Device LPT # Printer
Device Plip # and port TCP/IP
Device PPI # Port interface Device
#device VPO # needs SCBUs and DA
# PCI Ethernet Adapters
Device de # Dec/intel dc21x4x (' Tulip ')
Device EM # Intel pro/1000 Adapter Gigabit Ethernet Card (' Wiseman ')
Device Txp # 3Com 3cr990 (' Typhoon ')
Device VX # 3Com 3c590, 3c595 (' vortex ')
# PCI Ethernet adapters with common MII Bus Controller code
# Note: Be sure to keep ' device Miibus ' to ensure available
Device Miibus # MII bus Support
Device DC # Dec/intel 21143 and various workalikes
Device FXP # Intel EtherExpress pro/100b (82557, 82558)
Device PCN # AMD am79c97x PCI 10/100 NICs
Device RL # RealTek 8129/8139
Device SF # Adaptec AIC-6915 (' Starfire ')
Device SIS # Silicon integrated Systems sis 900/sis 7016
Device Ste # Sundance ST201 (D-link dfe-550tx)
Device TL # Texas Instruments Thunderlan
Device TX # SMC Etherpower II (83c170 ' EPIC ')
Device VR # VIA Rhine, Rhine II
Device WB # Winbond w89c840f
Device XL # 3Com 3c90x (' boomerang ', ' Cyclone ')
Device BGE # Broadcom bcm570x (' Tigon III ')
# ISA Ethernet Adapter
# ' device ed ' needs ' device Miibus '
Device ed0 at Isa? Port 0x280 IRQ Iomem 0xd8000
Device EX
Device EP
Device Fe0 at Isa? Port 0x300
# Xircom Ethernet
Device XE
# PRISM I IEEE 802.11b wireless NIC.
Device Awi
# WAVELAN/IEEE 802.11 wireless NICs. Note:the Wavelan/ieee really
# exists as a PCMCIA device, so there is no ISA attachment needed
# and resources would always be dynamically assigned by the PCCard code.
Device WI
# aironet 4500/4800 802.11 wireless NICs. Note:the declaration below would
# Work for PCMCIA and PCI cards, as as the ISA cards set to ISA PnP
# mode (the factory default). If you set the switches on your ISA
# for a manually chosen I/O and IRQ, you must specify
# those parameters here.
Device an
# The probe order of this is presently determined by I386/ISA/ISA_COMPAT.C.
Device Ie0 at Isa? Port 0x300 IRQ Iomem 0xd0000
#device Le0 at Isa? Port 0x300 IRQ 5 Iomem 0xd0000
Device lnc0 at Isa? Port 0x280 IRQ DRQ 0
Device Cs0 at Isa? Port 0x300
Device Sn0 at Isa? Port 0x300 IRQ 10
# Pseudo Device-number indicates how many allocations
Pseudo-device Loop # loop back to Network
Pseudo-device Ether # Ethernet Support
Pseudo-device SL 1 # Core-level slip
Pseudo-device PPP 1 # Core-level PPP
Pseudo-device Tun # Packet Tunnel
Pseudo-device Pty # Pseudo-tty (telnet, etc.)
Pseudo-device MD # Memory Virtual disk
Pseudo-device gif # IPV6 and IPv4 Tunnel
Pseudo-device Faith 1 # Ipv6-to-ipv4 forwarding (translation)
# ' BPF ' pseudo device will enable the Berkeley packet filter.
# Beware of the management problems that arise
Pseudo-device BPF #Berkeley Packet filter
# USB Support
Device UHCI # UHCI PCI->USB interface
Device OHCI # OHCI PCI->USB interface
Device USB # USB bus (required)
Device Ugen # Generic
Device Uhid # "Human Interface Devices"
Device UKBD # Keyboard
Device Ulpt # Printer
Device UMass # Disks/mass storage-requires SCBUs and Da
Device UMS # Mouse
Device Uscanner # Scanners
Device Urio # Diamond Rio MP3 Player
# USB Ethernet, Need Mii
Device Aue # ADMtek USB Ethernet
Device Cue # CATC USB Ethernet
Device Kue # Kawasaki LSI USB Ethernet