Neo-match
I still remember that the last time I saw the article optimized about FreeBSD 5 was 1 year ago, it was also when I just started UNIX. Time flies, I learned a lot of FreeBSD and UNIX knowledge in this year, and I am interested in how FreeBSD is more interested. Now, FreeBSD has replaced my Windows2000 and becomes the only OS in my computer. Experience is not exclusive. Here, I would like to have all FreeBSD enthusiasts, if there is an improper, welcome to criticize criticism.
· This article assumes that the reader has read the FreeBSD installation manual. · When reading this article, be sure to refer to the installation optimization article. · This article follows the GPL protocol. · This article follows the BSDL protocol. · Welcome other authors to write a variety of FreeBSD optimization articles in conjunction with this article.
First, installation (sysinstall)
1. In Distribution, only MINIMAL is selected, select Customization. Adding a man, you can view the command parameters when you have a problem; add the SRC, then CVSUP can speed up the speed and do not read the repeated file.
2, in User, after adding the user, change the / home / abc in the user path to / usr / abc. Because / usr has large capacity. Or can also increase the capacity of / home, but it is more troublesome. Then, to change the shell to CSH, in order to use convenience (also for the setting of the seventh part of this article).
Second, compilation optimization (make.conf)
Note: To block a Boolean option, not tagning NO or FALSE! But delete!
1, compiler option
CPUTYPE = Athlon-xp ## I use Athlonxp 2500 , different CPUs, please refer to Man make.conf
Cflags = -mfpmath = sse -mmmx -msse -m3dnow -maccumulate-outgoing-args -minline-all-stringOps ## is not recommended to use O2, O3, OS optimization, because all applications can be stably operated in O2, O3, OS. Moreover only 7% of additional performance. ## cflags default is "-o1 -pipe", no need to overwrite, so use =. ## Not recommended to use -f ... series optimization because it is not all applications to stabilize this.
## -mfpmath = SSE: Pentiumiii-compatible CPU can open -mfpmath = SSE to replace the floating point operation of traditional i387, speed up the speed. See the CPU product manual to determine if the CPU contains the SSE function. ## -mfpmath = PNI: Pentium4 Prescott Compatible CPU can open -Mfpmath = PNI to replace the floating point operation of traditional i387, speed up. See the CPU product manual to determine if the CPU contains a PNI function. ## -mmmx: Open the MMX instruction to add code performance. See the CPU product manual to determine if the CPU contains the MMX function. Suitable for PentiumMMX compatible CPU. ## -msse: Open the SSE instruction to add code performance. See the CPU product manual to determine if the CPU contains the SSE function. Suitable for PentiumIII compatible CPU. ## -msse2: Open the SSE2 instruction to increase the code performance. Refer to the CPU product manual to determine if the CPU contains SSE2 function. Suitable for Pentium4 compatible CPU. ## -mpni: Open the PNI instruction to increase the code performance. See the CPU product manual to determine if the CPU contains a PNI function. Suitable for Pentium4 Prescott compatible CPU. ## -m3dnow: Open 3DNOW! Instructions to add code performance. See the CPU product manual to determine if the CPU contains 3DNOW! Suitable for K6, Athlon compatible CPU.
## -maccumulate-outgoing-args -minline-all-stringops achieves acceleration by reducing certain movements, and is relatively stable. CXXFLAGS = -fmemoize-lookups -fsave-memoized ## make.conf mentioned C code optimization.
2, system compilation option kernconf = (filename) ## kernel configuration file name, change (filename) Changed to its own kernel file name.
Noinet6 = true ## Do not use the IPv6 protocol.
Noatm = true ## Do not use ATM as much as possible, this option is only available for non-ADSL users.
NO_SENDMAIL = True ## Try not to use Sendmail.
Nogames = true ## Do not install all games
NO_I4B = true ## Do not use ISDN for BSD as much as possible.
NO_IPFILTER = True ## Try not to use IP Filter.
Batch = yes ## Quiet compile, skip all questions when compiling. Suitable for users of certain overnight disposable compilers.
3, X-WINDOW Compilation Option XFree86_Version = 4 ## Try to use 4.3 version of X-Window
WITH_SETUID_LUIT = YES ## Do not use this item, running xterm will have a luit error problem.
WITH_GTK2 = YES ## Try to use GTK2 to run the GTK application
Use_mmx_asm = yes ## When compiling XFree86, try to use MMX code, only for PentiumMMX compatible CPU.
Use_3d1_asm = yes ## When XFree86 is compiled, try to use 3DNOW code, only for K6, Athlon compatible CPU.
WITHOUT_KDE_MENUS = YES ## When using gnome, the KDE program does not add the KDE program on the menu.
4, multimedia coding options
WITH_CDPARANOIA = YES
WITH_AALIB = YES
WITH_ESOUND = YES
WITH_FAAD = YES
WITH_FLAC = YES
WITH_FREETYPE = YES
WITH_GDKPIXBUF = YES
WITH_GSM = YES
WITH_HERMES = YES
WITH_JPEG = YES
WITH_LADSPA = YES
WITH_LAME = YES
WITH_LIBA52 = YES
WITH_LIBAUDIOFILE = YES
WITH_LIBCACA = YES
WITH_LIBFAME = YES
WITH_LIBMIKMOD = YES
WITH_LIBMPEG2 = YES
WITH_LIBMUSICBRAINZ = YES
WITH_LIBSHOUT = YES
WITH_LIBSIDPLAY = YES
WITH_LIBSNDFILE = YES
WITH_LIBTHEORA = YES
WITH_MAD = YES
WITH_NAS = YES
WITH_PANGO = YES
WITH_PNG = YES
WITH_SDL = YES
WITH_SMOTHWAVE = YES
WITH_SPEEX = YES
WITH_SWFDEC = YES
WITH_VORBIS = YES
WITH_VORBISIDEC = YES
WITH_XINE = YES
WITH_XVID = YES
All multimedia options over the ## All multimedia options are only turned on when the application is supported.
4. Application Compile Options Want_huge_stack_size = YES ## provides huge stack for applications for Python code.
WITH_GDM = YES ## provides a GDM link for some Window Manager. WITHOUT_MAILNEWS = YES ## Cancel Mozilla's mail news function, speed up compilation time.
WITHOUT_COMPOSER = YES ## Cancel Mozilla's web page editing function, speed up compilation time.
WITHOUT_LDAP = YES ## Cancel Mozilla's LDAP function and speed up compilation time.
WITHOUT_CHATZILLA = YES ## Cancel Mozilla's IRC chat function, speed up compilation time.
WITHOUT_XMLTERM = YES ## Cancel Mozilla's XML terminal function, speed up compilation time.
# With_RTC = YES ## Provides real-time clock support for some applications, but may cause certain multimedia programs unstable.
WITH_GLX = YES ## provides GLX accelerated drawing support for some applications.
WITH_TTF_BYTECODE_ENABED = YES ## provides double-byte support for some applications.
WITH_OPTIMIZED_CFLAGS = YESWITH_OPTIMIZED_CXXFLAGS = YESWITH_OPTIMIZE = YES ## Try to use more advanced compilation optimization
Third, kernel optimization (Make kernel)
Options PQ_HUGECACHE ## Provide support for the CPU of 1024K secondary cache
Options PQ_LARGECACHE ## provides support for the 512K secondary cache
Options PQ_MEDIUMCACHE ## provides support for 256K secondary cache CPU
Options PQ_SMALLCACHE ## Provides support for the 128K secondary cache CPU
Options CPU_ATHLON_SSE_HACKOPTIONS CPU_ENABLE_SSE ## Provides SSE support for Athlon series CPU
Options CPU_SUSP_HLT ## Opens the CPU idle energy saving.
Options CPU_UPGRADE_HW_CACHEOPTIONS CPU_WT_ALLOCOPTIONS NO_MEMORY_HOLE ## AMD Series CPU Optimization
## Some graphics cards can open DRM support to speed up display speed, please refer to / usr / src / sys / conf / notes and / usr / src / sys / i386 / conf / notes, this article is omitted.
Fourth, start mode (Loader.conf)
Autoboot_delay = "2" ## Set the start wait time of 2 seconds.
HW.ATA.TAPI_DMA = 1 ## Open the DMA transmission of the hard disk of the ATA33 interface to speed up the access speed.
Kern.ipc.maxsockets = "16384" ## increasing the number of inter-thread spots
Net.inet.tcp.tcbhashsize = "2048" ## increase the number of TCP control blocks
Beastie_disable = "yes" ## Turn off the small devil image start menu
V. System preference (rc.conf)
Background_dhclient = "yes" ## Don't wait for DHCP execution, speed up the start speed.
KeyRate = "fast" ## Maximize keyboard rate
Sendmail_enable = "none" sendmail_submit_enable = "no" sendmail_outbound_enable = "no" sendmail_msp_queue_enable = "no" ## Close Sendmail
CLEAR_TMP_ENABLE = "YES" ## Clear / var / TMP file on time
TCP_EXTENSIONS = "YES" ## Extension TCP 6, system resource optimization (sysctl.conf)
Security.bsd.see_other_uids = 0 ## Do not allow users to see all system processes
Kern.ipc.maxsockbuf = 8388608 ## thread socket buffer
Kern.ipc.shm_use_phys = 1 ## For threads provide physical memory support, it takes more than 256 megabytes of memory.
Kern.ipc.shmmax = 67108864 ## Threads can use the maximum shared memory
Kern.ipc.shmall = 32768 ## Maximum thread quantity
Kern.coredump = 0 ## program is not recorded when crash
Net.local.stream.sendspace = 65536Net.local.stream.RecvSpace = 65536 ## Local data stream receiving and send space
Net.local.dgram.maxdgram = 16384 ## Local packet maximum quantity
Net.local.dgram.recvspace = 65536 ## Local packet receiving space
Net.inet.tcp.RFC1644 = 1NET.INET.TCP.RFC3042 = 1Net.Inet.tcp.rfc3390 = 1 ## Some protocols that speed up network performance, please refer to the RFC article.
Net.inet.tcp.msdflt = 1460 ## Packet Data Section Size, ADSL is 1452.
Net.inet.tcp.sendspace = 65536net.inet.tcp.recvspace = 1048576 ## Network Data Receive and Send Space
NET.INET.TCP.INFLIGHT_ENABLE = 1 ## Provides buffer when connecting to network data
Net.inet.tcp.minMSS = 1460 ## Packet Data Section Minimum, ADSL is 1452.
Net.inet.Raw.maxdgram = 65536 ## Local data maximum number
Net.inet.Raw.Recvspace = 65536 ## Local data stream receiving space
Seven, environment setting (.cshrc) Alias LS LS -GF ## colorization LS
STENV Editor EE ## Default Editor is EE
SetENV Pager Less ## Default Paging device is Less, which is convenient than More.
Set numberEpset Prompt = '% N @% /% #' set filecset autolist ## These lines set I don't explain first, but I believe that you will definitely like it, what is it? Especially the last line.
8. CCACHE CCache is a cache for program compilation, and speeds up compilation time by reducing the number of repeating code.
Installation process:
SU
CD / USR / PORTS / DEVEL / CCACHE /
Make Install Clean
CD / USR /
Mkdir ccache
CD / usr / sbin
Ln -s / usr / local / bin / ccache gcc
Ln -s / usr / local / bin / ccache cc
Ln -s / usr / local / bin / ccache c
Ln -s / usr / local / bin / ccache g
Ln -s / usr / local / bin / ccache cpp
Echo "Stenv ccache_dir / usr / ccache" >> /Root/.cshrc
REHASH
exit
Finally, you can view the current compilation status by running ccache -s. Ok, you can now CVSUP system code and ports tree. Still start building your FreeBSD 5?