发表于:2010-4-13 浏览:167 作者: 来源:互联网
关键字:freebsd,kernel,编译
描述:1.檔案內容 kernel文字敘述檔的組成很簡單,每行都是由一個關鍵及一到二個參數組成。 #表示註解。 常用的敘述檔:/usr/src/sys/i386/conf/GENERIC 詳細的敘述檔:/usr/src/sys/i386/con
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 。
machine i386
選擇機器的內部結構,除了i386 還有 alpha 及 pc98 我們現今看到的多是 i386 。
#cpu I386_CPU
#cpu I486_CPU
cpu I586_CPU
#cpu I686_CPU
CPU的型態..透過 dmesg | grep CPU,可以看到您的CPU型態
CPU:Pentium (166-MHz 586-class CPU)
所以我將其他的3個型態#(註解)掉,只留下I586_CPU。
ident OHAHA
kernel的識別,通常我們用機器名稱的大寫..所以我的是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 symbols
options MATH_EMULATE #Support for x87 emulation
模擬數學浮點運算器 除非您的機器是 386 或 486SX 之前的型號,
不然您可以將此行 # 掉, 因為FreeBSD在這方面的模擬並不很精確,
若您要求精確度的話..
將 MATH_EMULATE 改成 GPL_MATH_EMULATION 改用GNU 的模擬數學浮點運算器。
options INET #InterNETworking
網路支援,即使您沒有打算要連上網路也請保留,因為有些程式會用到loop
options INET6 #IPv6 communications protocols
IPv6 的通訊協定 (因為尚未啟用所以disable)
options FFS #Berkeley Fast Filesystem
options FFS_ROOT #FFS usable as root device [keep this!]
FFS是基本的FreeBSD硬碟檔案系統。若您要用硬碟開機...務必保留 !!
options SOFTUPDATES #Enable FFS soft updates support
Soft Updates 選項,可以加速磁碟的寫入。
FreeBSD 4.X 版後,預設已經加入,但未啟動。
options UFS_DIRHASH #Improve performance on big directories
改善FreeBSD在大資料夾中執行的效能。
options MFS #Memory Filesystem
options MD_ROOT #MD is a potential root device
memory-mapped檔案系統,如果您有很大的swap空間,您想要好好的利用的話...keep this
如果要使用的話,通常我們會將他掛在(mount)在/tmp 這個地方,
因為這裡有許多程式將暫存資料存放在此。
若要採用的話...請在/etc/fstab中的swap部分加入(或者說更新):
# Device Mountpoint FStype Options Dump Pass#
/dev/ad0s1b /tmp mfs rw 0 0
options NFS #Network Filesystem
options NFS_ROOT #NFS usable as root device, NFS required
網路檔案系統,除非您想經由TCP/IP的方式,將UNIX的系統分割區掛上,否則 # 掉
因為本網站之後有講到NFS方面...所以留著...^^"
#options MSDOSFS #MSDOS Filesystem
MSDOS檔案系統,除非您要在開機時就掛上此DOS分割區,否則您可以放心 # 掉
#options CD9660 #ISO 9660 Filesystem
#options CD9660_ROOT #CD-ROM usable as root, CD9660 required
ISO9660檔案系統,若您沒有光碟機,或者不常mount光碟機,則可以 # 掉
options PROCFS #Process filesystem
Process 檔案系統,為"假想"的檔案系統,掛(mount)在/proc,
此允許類似 ps 指令顯示process的資訊。
options COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!]
與4.3BSD的相容性[務必保留!],否則有些程式會不正常
options SCSI_DELAY=15000 #Delay (in ms) before probing SCSI
使kernel暫停15秒,去搜尋您機器上的SCSI裝置。
這個您應該看過吧...就是開機時令你覺得很煩很慢的那個...
您可以將此數值減少..以加快開機速度。
#options UCONSOLE #Allow users to grab the console
讓您能夠抓取console的畫面...這個對 X 的使用者比較有用...
#options USERCONFIG #boot -c editor
允許您從開機選單中啟動組態編輯器(configuration editor) 幾乎用不到~"~
#options VISUAL_USERCONFIG #visual boot -c editor
同上...只不過是視覺化的...~"~
#options KTRACE #ktrace(1) support
啟動kernel process tracing(追蹤系統程序),在debug時很有用,
...一般人還是用不到...@@"
{[csc:pagelist]}
options SYSVSHM #SYSV-style shared memory
此選項提供給System V 型態的shared memory(SHM) ...,最常用此選項功能的是 X 中的XSHM
若您要使用 X 請務必加上,此外許多有關圖形的程式也會因此選項功能而加速。
又者...big5con(中文console)也需要此選項。
options SYSVMSG #SYSV-style message queues
支援System V 的信號(semsphores),只佔用少量的kernel大小
options SYSVSEM #SYSV-style semaphores
支援System V 的訊息(messages),只佔用少量的kernel大小,BBS會用到此選項功能。
通常我們會將以上三種全部加上.....-__-||
以避免因為要裝個程式(big5con),而要重新修改kernel。
options P1003_1B #Posix P1003_1B real-time extensions
options _KPOSIX_PRIORITY_SCHEDULING
Real-time extensions added in the POSIX(及時系統擴充),
某些應用程式會用到(star office)
options ICMP_BANDLIM #Rate limit bad replies
啟動ICMP對於錯誤回應的頻寬限制,對於幫助拒絕packet攻擊有所助益。
#options KBD_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
#options SMP # Symmetric MultiProcessor Kernel
#options APIC_IO # Symmetric (APIC) I/O
多CPU的支援。
新版本的只要將此兩項打開,系統會自動抓到...^^
device isa
每個被FreeBSD支援的PC都必須要有這一個
device eisa
若您有EISA的主機板..加上它,會自動偵測及設定所有EISA裝置
device pci
若您有PCI的主機板..加上它,會自動偵測PCI的卡,並橋接PCI及ISA介面。
# Floppy drives
device fdc0 at isa? port IO_FD1 irq 6 drq 2
device fd0 at fdc0 drive 0
#device fd1 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:
#device fdc0
若你採用的軟碟是Toshiba的Y-E Data PCMCIA floppy,則將上面的fdc0開啟。
並將先前的fdc0註解。
# ATA and ATAPI devices
device ata0 at isa? port IO_WD1 irq 14
device ata1 at isa? port IO_WD2 irq 15
這兩個選項,是給那些沒有PCI的舊式系統使用。
device ata
偵測 PCI ATA&ATAPI的選項。
只需要這一行,系統會自動偵測新式的相關裝置。
device atadisk # ATA disk drives
IDE介面的硬碟機
device atapicd # ATAPI CDROM drives
IDE介面的光碟機
#device atapifd # ATAPI floppy drives
IDE介面的軟碟機 (我沒有..所以 # 掉)
#device atapist # ATAPI tape drives
IDE介面的磁帶機 (這....我更沒有...所以 # 掉)
options ATA_STATIC_ID #Static device numbering
讓控制器的編號固定,否則,則使用動態產生
# SCSI Controllers
#device ahb # EISA AHA1742 family
#device ahc # AHA2940 and onboard AIC7xxx devices
#device ahd # AHA39320/29320 and onboard AIC79xx devices
#device amd # AMD 53C974 (Tekram DC-390(T))
#device isp # Qlogic family
#device mpt # LSI-Logic MPT/Fusion
#device ncr # NCR/Symbios Logic
#device sym # 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
#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的控制卡,若請選擇您有的型號,
請參照 LINT 說明...找找您的卡是屬於哪一種。
若您像我一樣沒有這種高級品,全部#了吧。
# SCSI peripherals
#device scbus # SCSI bus (required)
#device da # Direct Access (disks)
#device sa # Sequential Access (tape etc)
#device cd # CD
#device pass # Passthrough device (direct SCSI access)
SCSI的周邊設備,我連卡都沒有了...全部#掉~"~。
# RAID controllers interfaced to the SCSI subsystem
#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
多磁碟陣列接SCSI控制卡
# RAID controllers
#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
磁碟陣列卡(RAID CARD),這不能算是貴重物品了,是奢侈品!
# atkbdc0 controls both the keyboard and the PS/2 mouse
device atkbdc0 at isa? port IO_KBD
鍵盤控制器(atkbdc)提供,鍵盤及滑鼠的I/O(輸入/輸出)服務。
若你有滑鼠或鍵盤,則需保留此裝置。
device atkbd0 at atkbdc? irq 1 flags 0x1
AT 84 鍵盤
device psm0 at atkbdc? irq 12
PS/2的滑鼠
device vga0 at isa?
顯示卡驅動程式
# splash screen/screen saver
pseudo-device splash
在開機時,顯示點陣圖影像,螢幕保護程式也需要此驅動程式。
# syscons is the default console driver, resembling an SCO console
device sc0 at isa? flags 0x100
FreeBSD預設的console驅動程式,類似SCO console。
絕大部分的全螢幕程式透過類似termcap的終端機函數資料庫存取console,
若當您在登入系統後,無法正確顯示全螢幕的畫面,
請將TERM 設定為scoansi。(export TERM=scoansi)
# Enable this and PCVT_FREEBSD for pcvt vt220 compatible console driver
#device vt0 at isa?
#options XSERVER # support for X server on a vt console
#options FAT_CURSOR # start with block cursor
# If you have a ThinkPAD, uncomment this along with the rest of the PCVT lines
#options PCVT_SCANSET=2 # IBM keyboards are non-std
VT220相容的console驅動程式,與VT100/102相容。
當您無法使用sc0時,可使用它(某些筆記型電腦會有這種狀況),
在任何平台上VT100都可以執行。(export TERM=vt100)
{[csc:pagelist]}
# Floating point support - do not disable.
device npx0 at nexus? port IO_NPX irq 13
npx0是FreeBSD上的數學浮點運算介面,不管你是採用包括實體的或是軟體模擬的
浮點運算處理器都需要它。
# Power management support (see LINT for more options)
device apm0 at nexus? disable flags 0x20 # Advanced Power Management
支援進階的電源管理(APM),對筆記型電腦很有助益。
# 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
若你把FreeBSD安裝在筆記型電腦之上,把PCMCIA加上吧。
可惜我沒有,若有..我會拿來玩遊戲^^"。(全部#掉)
# Serial (COM) ports
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
串列埠裝置。(windows稱之為COM1、COM2、COM3、COM4)
通常COM3、COM4不會用到。
# Parallel port
device ppc0 at isa? irq 7
device ppbus # Parallel port bus (required)
並列埠裝置。
#device lpt # Printer
並列埠的印表機。
#device plip # TCP/IP over parallel
並列埠的網路介面
#device ppi # Parallel port interface device
並列埠的介面裝置 (我也沒有任何有關的介面..so # 掉)
#device vpo # Requires scbus and da
專門給Iomega Zip的支援 (我更沒有ZIP)
# PCI Ethernet NICs.
#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的網路卡支援。選擇你有的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!
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‘‘)
需要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‘
device ed0 at isa? port 0x280 irq 10 iomem 0xd8000
#device ex
#device ep
#device fe0 at isa? port 0x300
ISA的網卡支援,注意到裝置ed仍需要先前的miibus裝置配合。
# Xircom Ethernet
#device xe
Xircom/Intel EtherExpress Pro100/16 的網路卡。
# PRISM I IEEE 802.11b wireless NIC.
#device awi
無線網卡。(筆記型電腦)
# 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.
#device wi
Lucent 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.
#device an
Aironet 4500/4800 802.11 的無限網卡。(筆記型電腦)
# The probe order of these is presently determined by i386/isa/isa_compat.c.
#device ie0 at isa? port 0x300 irq 10 iomem 0xd0000
#device le0 at isa? port 0x300 irq 5 iomem 0xd0000
#device lnc0 at isa? port 0x280 irq 10 drq 0
#device cs0 at isa? port 0x300
#device sn0 at isa? port 0x300 irq 10
ISA的乙太網卡。
請參照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 tunneling
IPv4及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
#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的支援項目。
我都沒有USB,所以全部#掉。
# USB Ethernet, requires mii
#device aue # ADMtek USB ethernet
#device cue # CATC USB ethernet
#device kue # Kawasaki LSI USB ethernet
USB的網路卡。
我都沒有USB,所以全部#掉。
2.編修注意事項
將不要或沒有的的註解#,而非刪除,主要是要避免,
不小心誤刪裝置,或是臨時多加了額外的裝置,還要去查詢LINT的麻煩