0.前言因為kernel的文字敘述檔內容繁多,所以獨立出來說明 。1.檔案內容kernel文字敘述檔的組成很簡單,每行都是由一個關鍵及一到二個參數組成 。#表示註解 。常用的敘述檔:/usr/src/sys/i386/conf/GENERIC詳細的敘述檔:/usr/src/sys/i386/conf/LINT## GENERIC -- Generic kernel configuration file for FreeBSD/i386## For more information on this file, please read the handbook section on# Kernel Configuration Files:##http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.HTML## The handbook is also available locally in /usr/share/doc/handbook# if you"ve installed the doc distribution, otherwise always see the# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the# latest information.## An exhaustive list of options and more detailed explanations of the# device lines is also present in the ./LINT configuration file. If you are# in doubt as to the purpose or necessity of a line, check first in LINT.## $FreeBSD: src/sys/i386/conf/GENERIC,v 1.246.2.48 2002/08/31 20:28:26 obrIEn Exp $說明: 此段在說明編譯文字敘述檔的參考資料 。及目前編輯GENERIC的版本1.246.2.48。Machinei386選擇機器的內部結構,除了i386 還有 alpha 及 pc98 我們現今看到的多是 i386。#CPUI386_CPU#cpuI486_CPUcpuI586_CPU#cpuI686_CPUCPU的型態..透過 dmesg | grep CPU,可以看到您的CPU型態CPU:Pentium (166-MHz 586-class CPU)所以我將其他的3個型態#(註解)掉,只留下I586_CPU 。identOHAHAkernel的識別,通常我們用機器名稱的大寫..所以我的是OHAHA 。maxusers 0這個數值大約等於你希望同時能夠登入機器的人數;正確的說,此代表process的最大值有關,maximum=20 16*maxusers在正常的情況下,如果您要跑X-Window的話,最小值是4;以一般狀況來說,用64已經足夠,因為process值為:1044 (20 16*64)從FreeBSD 4.5 開始系統會自動調整這個設定,若您將其設為0的話 。注意:maxusers不是能夠login的限制 。要限制同時login數可以透過之後的pseudo-device pty 16 來限制 。#makeoptions DEBUG=-g#Build kernel with gdb(1) debug symbolsoptionsMATH_EMULATE #Support for x87 emulation模擬數學浮點運算器 除非您的機器是 386 或 486SX 之前的型號,不然您可以將此行 # 掉, 因為FreeBSD在這方面的模擬並不很精確,若您要求精確度的話..將 MATH_EMULATE 改成 GPL_MATH_EMULATION 改用GNU 的模擬數學浮點運算器 。optionsINET#InterNETworking網路支援,即使您沒有打算要連上網路也請保留,因為有些程式會用到loopoptionsINET6#IPv6 communications protocolsIPv6 的通訊協定 (因為尚未啟用所以disable)optionsFFS#Berkeley Fast FilesystemoptionsFFS_ROOT#FFS usable as root device [keep this!]FFS是基本的FreeBSD硬碟檔案系統 。若您要用硬碟開機...務必保留 !!optionsSOFTUPDATES #Enable FFS soft updates supportSoft Updates 選項,可以加速磁碟的寫入 。FreeBSD 4.X 版後,預設已經加入,但未啟動 。optionsUFS_DIRHASH #Improve performance on big Directories改善FreeBSD在大資料夾中執行的效能 。optionsMFS#Memory FilesystemoptionsMD_ROOT#MD is a potential root devicememory-mapped檔案系統,如果您有很大的swap空間,您想要好好的利用的話...keep this如果要使用的話,通常我們會將他掛在(mount)在/tmp 這個地方,因為這裡有許多程式將暫存資料存放在此 。若要採用的話...請在/etc/fstab中的swap部分加入(或者說更新):# DeviceMountpointFStypeOptionsDumpPass#/dev/ad0s1b/tmpmfsrw00optionsNFS#Network FilesystemoptionsNFS_ROOT#NFS usable as root device, NFS required網路檔案系統,除非您想經由TCP/IP的方式,將Unix的系統分割區掛上,否則 # 掉因為本網站之後有講到NFS方面...所以留著...^^"#optionsMSDosFS#MSDOS FilesystemMSDOS檔案系統,除非您要在開機時就掛上此DOS分割區,否則您可以放心 # 掉#optionsCD9660#ISO 9660 Filesystem#optionsCD9660_ROOT #CD-ROM usable as root, CD9660 requiredISO9660檔案系統,若您沒有光碟機,或者不常mount光碟機,則可以 # 掉optionsPROCFS#Process filesystemProcess 檔案系統,為"假想"的檔案系統,掛(mount)在/proc,此允許類似 ps 指令顯示process的資訊 。optionsCOMPAT_43#Compatible with BSD 4.3 [KEEP THIS!]與4.3BSD的相容性[務必保留!],否則有些程式會不正常optionsSCSI_DELAY=15000 #Delay (in ms) before probing SCSI使kernel暫停15秒,去搜尋您機器上的SCSI裝置 。這個您應該看過吧...就是開機時令你覺得很煩很慢的那個...您可以將此數值減少..以加快開機速度 。#optionsUCONSOLE#Allow users to grab the console讓您能夠抓取console的畫面...這個對 X 的使用者比較有用...#optionsUSERCONFIG #boot -c editor允許您從開機選單中啟動組態編輯器(configuration editor) 幾乎用不到~"~#optionsVISUAL_USERCONFIG #visual boot -c editor同上...只不過是視覺化的...~"~#optionsKTRACE#ktrace(1) support啟動kernel process tracing(追蹤系統程序),在debug時很有用,...一般人還是用不到...@@"optionsSYSVSHM#SYSV-style shared memory此選項提供給System V 型態的shared memory(SHM) ...,最常用此選項功能的是 X 中的XSHM若您要使用 X 請務必加上,此外許多有關圖形的程式也會因此選項功能而加速 。又者...big5con(中文console)也需要此選項 。optionsSYSVMSG#SYSV-style message queues支援System V 的信號(semsphores),只佔用少量的kernel大小optionsSYSVSEM#SYSV-style semaphores支援System V 的訊息(messages),只佔用少量的kernel大小,BBS會用到此選項功能 。通常我們會將以上三種全部加上.....-__-||以避免因為要裝個程式(big5con),而要重新修改kernel 。optionsP1003_1B#Posix P1003_1B real-time extensionsoptions_KPOSIX_PRIORITY_SCHEDULINGReal-time extensions added in the POSIX(及時系統擴充),某些應用程式會用到(star Office)optionsICMP_BANDLIM #Rate limit bad replies啟動ICMP對於錯誤回應的頻寬限制,對於幫助拒絕packet攻擊有所助益 。#optionsKBD_INSTALL_CDEV# install a CDEV entry in /dev這個是某些鍵盤採用的驅動程式 。#options AHC_REG_PRETTY_PRINT # Print register bitfields in debug# output.Adds ~128k to driver.ahc裝置,支援Adaptec 29/3940(U)(W)及AIC7870/AIC7880類型的主機板 。#options AHD_REG_PRETTY_PRINT # Print register bitfields in debug# output.Adds ~215k to driver.ahd裝置,提供Adaptec 79xx Ultra320 的SCSI裝置 。# To make an SMP kernel, the next two are needed#optionsSMP# Symmetric MultiProcessor Kernel#optionsAPIC_IO# Symmetric (APIC) I/O多CPU的支援 。新版本的只要將此兩項打開,系統會自動抓到...^^deviceisa每個被FreeBSD支援的PC都必須要有這一個deviceeisa若您有EISA的主機板..加上它,會自動偵測及設定所有EISA裝置devicepci若您有PCI的主機板..加上它,會自動偵測PCI的卡,並橋接PCI及ISA介面 。# Floppy drivesdevicefdc0 at isa? port IO_FD1 irq 6 drq 2devicefd0 at fdc0 drive 0#devicefd1 at fdc0 drive 1軟碟的控制卡,fd0是A:,fd1是B:因為我沒有第二個軟碟機,所以 # 掉 fd1## If you have a Toshiba Libretto with its Y-E Data PCMCIA floppy,# don"t use the above line for fdc0 but the following one:#devicefdc0若你採用的軟碟是Toshiba的Y-E Data PCMCIA floppy,則將上面的fdc0開啟 。並將先前的fdc0註解 。# ATA and ATAPI devicesdeviceata0 at isa? port IO_WD1 irq 14deviceata1 at isa? port IO_WD2 irq 15這兩個選項,是給那些沒有PCI的舊式系統使用 。deviceata偵測 PCI ATA&ATAPI的選項 。只需要這一行,系統會自動偵測新式的相關裝置 。deviceatadisk# ATA disk drivesIDE介面的硬碟機deviceatapicd# ATAPI CDROM drivesIDE介面的光碟機#deviceatapifd# ATAPI floppy drivesIDE介面的軟碟機 (我沒有..所以 # 掉)#deviceatapist# ATAPI tape drivesIDE介面的磁帶機 (這....我更沒有...所以 # 掉)optionsATA_STATIC_ID#Static device numbering讓控制器的編號固定,否則,則使用動態產生# SCSI Controllers#deviceahb# EISA AHA1742 family#deviceahc# AHA2940 and onboard AIC7xxx devices#deviceahd# AHA39320/29320 and onboard AIC79xx devices#deviceamd# AMD 53C974 (Tekram DC-390(T))#deviceisp# Qlogic family#devicempt# LSI-Logic MPT/Fusion#devicencr# NCR/Symbios Logic#devicesym# NCR/Symbios Logic (newer chipsets)#options SYM_SETUP_LP_PROBE_MAP=0x40# Allow ncr to attach legacy NCR devices when# both sym and ncr are configured#deviceadv0 at isa?#deviceadw#devicebt0 at isa?#deviceaha0 at isa?#deviceaic0 at isa?#devicencv# NCR 53C500#devicensp# Workbit Ninja SCSI-3#devicestg# TMC 18C30/18C50SCSI的控制卡,若請選擇您有的型號,請參照 LINT 說明...找找您的卡是屬於哪一種 。若您像我一樣沒有這種高級品,全部#了吧 。# SCSI peripherals#devicescbus# SCSI bus (required)#deviceda# Direct Access (disks)#devicesa# Sequential Access (tape etc)#devicecd# CD#devicepass# Passthrough device (direct SCSI access)SCSI的周邊設備,我連卡都沒有了...全部#掉~"~ 。# RAID controllers interfaced to the SCSI subsystem#deviceasr# DPT SmartRAID V, VI and Adaptec SCSI RAID#devicedpt# DPT Smartcache - See LINT for options!#deviceiir# Intel Integrated RAID#devicemly# Mylex AcceleRAID/eXtremeRAID#deviceciss# Compaq SmartRAID 5* series多磁碟陣列接SCSI控制卡# RAID controllers#deviceaac# Adaptec FSA RAID, Dell PERC2/PERC3#deviceaacp# SCSI passthrough for aac (requires CAM)#deviceida# Compaq Smart RAID#deviceamr# AMI MegaRAID#devicemlx# Mylex DAC960 family#devicetwe# 3ware Escalade磁碟陣列卡(RAID CARD),這不能算是貴重物品了,是奢侈品!# atkbdc0 controls both the keyboard and the PS/2 mousedeviceatkbdc0 at isa? port IO_KBD鍵盤控制器(atkbdc)提供,鍵盤及滑鼠的I/O(輸入/輸出)服務 。若你有滑鼠或鍵盤,則需保留此裝置 。deviceatkbd0 at atkbdc? irq 1 flags 0x1AT 84 鍵盤devicepsm0 at atkbdc? irq 12PS/2的滑鼠devicevga0 at isa?顯示卡驅動程式# splash screen/screen saverpseudo-device splash在開機時,顯示點陣圖影像,螢幕保護程式也需要此驅動程式 。# syscons is the default console driver, resembling an SCO consoledevicesc0 at isa? flags 0x100FreeBSD預設的console驅動程式,類似SCO console 。絕大部分的全螢幕程式透過類似termcap的終端機函數資料庫存取console,若當您在登入系統後,無法正確顯示全螢幕的畫面,請將TERM 設定為scoansi 。(export TERM=scoansi)# Enable this and PCVT_FREEBSD for pcvt vt220 compatible console driver#devicevt0 at isa?#optionsXSERVER# support for X server on a vt console#optionsFAT_CURSOR# start with block cursor# If you have a ThinkPAD, uncomment this along with the rest of the PCVT lines#optionsPCVT_SCANSET=2# IBM keyboards are non-stdVT220相容的console驅動程式,與VT100/102相容 。當您無法使用sc0時,可使用它(某些筆記型電腦會有這種狀況),在任何平台上VT100都可以執行 。(export TERM=vt100)# Floating point support - do not disable.devicenpx0 at nexus? port IO_NPX irq 13npx0是FreeBSD上的數學浮點運算介面,不管你是採用包括實體的或是軟體模擬的浮點運算處理器都需要它 。# Power management support (see LINT for more options)deviceapm0 at nexus? disable flags 0x20 # Advanced Power Management支援進階的電源管理(APM),對筆記型電腦很有助益 。# PCCARD (PCMCIA) support#devicecard#devicepcic0 at isa? irq 0 port 0x3e0 iomem 0xd0000#devicepcic1 at isa? irq 0 port 0x3e2 iomem 0xd4000 disable若你把FreeBSD安裝在筆記型電腦之上,把PCMCIA加上吧 。可惜我沒有,若有..我會拿來玩遊戲^^" 。(全部#掉)# Serial (COM) portsdevicesio0 at isa? port IO_COM1 flags 0x10 irq 4devicesio1 at isa? port IO_COM2 irq 3#devicesio2 at isa? disable port IO_COM3 irq 5#devicesio3 at isa? disable port IO_COM4 irq 9串列埠裝置 。(Windows稱之為COM1、COM2、COM3、COM4)通常COM3、COM4不會用到 。# Parallel portdeviceppc0 at isa? irq 7deviceppbus# Parallel port bus (required)並列埠裝置 。#devicelpt# Printer並列埠的印表機 。#deviceplip# TCP/IP over parallel並列埠的網路介面#deviceppi# Parallel port interface device並列埠的介面裝置(我也沒有任何有關的介面..so # 掉)#devicevpo# Requires scbus and da專門給Iomega Zip的支援 (我更沒有ZIP)# PCI Ethernet NICs.#devicede# DEC/Intel DC21x4x (``Tulip"")#deviceem# Intel PRO/1000 adapter Gigabit Ethernet Card (``Wiseman"")#devicetxp# 3Com 3cR990 (``Typhoon"")#devicevx# 3Com 3c590, 3c595 (``Vortex"")PCI的網路卡支援 。選擇你有的PCI網卡型號,沒有的#掉 。# PCI Ethernet NICs that use the common MII bus controller code.# NOTE: Be sure to keep the "device miibus" line in order to use these NICs!devicemiibus# MII bus support#devicedc# DEC/Intel 21143 and various workalikes#devicefxp# Intel EtherExpress PRO/100B (82557, 82558)#devicepcn# AMD Am79C97x PCI 10/100 NICs#devicerl# RealTek 8129/8139#devicesf# Adaptec AIC-6915 (``Starfire"")#devicesis# Silicon Integrated Systems SiS 900/SiS 7016#deviceste# Sundance ST201 (D-Link DFE-550TX)#devicetl# Texas Instruments ThunderLAN#devicetx# SMC EtherPower II (83c170 ``EPIC"")#devicevr# VIA Rhine, Rhine II#devicewb# Winbond W89C840F#devicexl# 3Com 3c90x (``Boomerang"", ``Cyclone"")#devicebge# Broadcom BCM570x (``Tigon III"")需要MII bus支援的PCI網路卡 。若你的網卡屬於這一區段,除了將網卡的裝置留著,務必要將miibus留著 。網卡的型號可以從dmesg | grep address中看出...否則您也可以從 LINT 中參考以我來說,我的網卡是D-link 200 isa (ed)不屬於PCI 介面 。所以我將PCI全部#掉 。但保留miibus因為ISA網卡需要 。# ISA Ethernet NICs.# "device ed" requires "device miibus"deviceed0 at isa? port 0x280 irq 10 iomem 0xd8000#deviceex#deviceep#devicefe0 at isa? port 0x300ISA的網卡支援,注意到裝置ed仍需要先前的miibus裝置配合 。# Xircom Ethernet#devicexeXircom/Intel EtherExpress Pro100/16 的網路卡 。# PRISM I IEEE 802.11b wireless NIC.#deviceawi無線網卡 。(筆記型電腦)# WaveLAN/IEEE 802.11 wireless NICs. Note: the WaveLAN/IEEE really# exists only as a PCMCIA device, so there is no ISA attachment needed# and resources will always be dynamically assigned by the pccard code.#devicewiLucent WaveLAN/IEEE 802.11 的PCMCIA網卡 。(筆記型電腦)# Aironet 4500/4800 802.11 wireless NICs. Note: the declaration below will# work for PCMCIA and PCI cards, as well as ISA cards set to ISA PnP# mode (the factory default). If you set the switches on your ISA# card for a manually chosen I/O address and IRQ, you must specify# those parameters here.#deviceanAironet 4500/4800 802.11 的無限網卡 。(筆記型電腦)# The probe order of these is presently determined by i386/isa/isa_compat.c.#deviceie0 at isa? port 0x300 irq 10 iomem 0xd0000#devicele0 at isa? port 0x300 irq 5 iomem 0xd0000#devicelnc0 at isa? port 0x280 irq 10 drq 0#devicecs0 at isa? port 0x300#devicesn0 at isa? port 0x300 irq 10ISA的乙太網卡 。請參照LINT取得詳細的網卡資訊 。# Pseudo devices - the number indicates how many units to allocate.虛擬裝置 。pseudo-device loop# Network loopback通常的loop裝置,當您用telnet或ftp localhost它就是經由此裝置此為必需的 。pseudo-device ether# Ethernet support當您有網路卡時才需要,它也包含基本的網路協定碼 。pseudo-device sl 1 # Kernel SLIP支援SLIP,不過他以快要被PPP取代,s1後的數字表示,同時有多少SLIP連線被支援pseudo-device ppp 1 # Kernel PPP對撥接的PPP支援,ppp後的數字表示,同時有多少PPP連線被支援pseudo-device tun# Packet tunnel.被PPP所使用,tun後的數字表示,同時有多少PPP session被支援pseudo-device pty# Pseudo-ttys (telnet etc)虛擬終端機裝置,預設是16,最高可以達到256 (login port)pseudo-device md# Memory "disks"memory disk 虛擬裝置 與之前的MFS相呼應,不可單獨存在pseudo-device gif# IPv6 and IPv4 tunnelingIPv4及IPv6間的的傳送通道pseudo-device faith 1 # IPv6-to-IPv4 relaying (translation)抓取封包並使之轉向到IPv4/IPv6間的背景服務程式(daemon)# The `bpf" pseudo-device enables the Berkeley Packet Filter.# Be aware of the administrative consequences of enabling this!pseudo-device bpf#Berkeley packet filter柏克萊的封包過濾器 。(必須保留!)及使網路卡處在不區分封包的模式,也能抓取每一封包 。這些封包能被抓取到磁碟或經由 tcpdump 程式解釋 。# USB support#deviceuhci# UHCI PCI->USB interface#deviceohci# OHCI PCI->USB interface#deviceusb# USB Bus (required)#deviceugen# Generic#deviceuhid# "Human Interface Devices"#deviceukbd# Keyboard#deviceulpt# Printer#deviceumass# Disks/Mass storage - Requires scbus and da#deviceums# Mouse#deviceuscanner # Scanners#deviceurio# Diamond Rio MP3 PlayerUSB的支援項目 。我都沒有USB,所以全部#掉 。# USB Ethernet, requires mii#deviceaue# ADMtek USB ethernet#devicecue# CATC USB ethernet#devicekue# Kawasaki LSI USB ethernetUSB的網路卡 。我都沒有USB,所以全部#掉 。2.編修注意事項將不要或沒有的的註解#,而非刪除,主要是要避免,不小心誤刪裝置,或是臨時多加了額外的裝置,還要去查詢LINT的麻煩
推荐阅读
- 53 FreeBSD连载:中文X服务器
- A FreeBSD 编辑器VI
- 42 FreeBSD连载:NFS客户支持
- 76 FreeBSD连载:设置基本系统
- FreeBSD 实用小技巧ctrl+d
- FreeBSD 权限操作
- 在FreeBSD中安装双网卡实例
- 最简单FreeBSD网关方案
- 29 FreeBSD连载:打印机配置:系统结构
- 03 FreeBSD连载:其他相关系统和组织
