FreeBSD_Kernel_Config.doc
文本预览下载声明
FreeBSD_Kernel_Config
FreeBSD Kernel Configure
****************************************************************************************************
同步 /usr/src 及 /usr/ports 参考[FreeBSD_Update.txt]
****************************************************************************************************
安装ccache,节省编译时间 [/usr/ports/devel/ccache],或利用 pkg_add 安装,命令如下:
Port 安装:
cd /usr/ports/devel/ccache
make install clean
Package 安装:
pkg_add -r ccache
配置:
vi /etc/make.conf
.if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) !defined(NOCCACHE)
CC=/usr/local/libexec/ccache/world/cc
CXX=/usr/local/libexec/ccache/world/c++
.endif
.if ${.CURDIR:M*/ports/devel/ccache}
NO_CCACHE= yes
.endif
vi /.cshrc
# set ccache varibles
setenv PATH /usr/local/libexec/ccache:$PATH
setenv CCACHE_PATH /usr/bin:/usr/local/bin
setenv CCACHE_DIR /var/tmp/ccache
setenv CCACHE_LOGFILE /var/log/ccache.log
# set ccache temp size to 512MB (default 1GB)
if ( -x /usr/local/bin/ccache ) then
/usr/local/bin/ccache -M 512m /dev/null
endif
退出登录并再次登录使配置生效。
ccache -s #查看当前编译情况
其他提高编译性能的设定
vi /etc/make.conf
WITHOUT_X11=yes
NO_PROFILE=true
CFLAGS+= -O2 -fno-strict-aliasing -pipe # += 是保留原设定值,如果= 则删除了原设定值
mount -u -o noatime /usr/src # /usr/src 必须单独的挂载
mount -u -o async /usr/obj # 同上
****************************************************************************************************
编译内核:(内核文件配置下面讲解)
cd /usr/src
make -j4 buildworld
make buildkernel KERNCONF=MYKERNELFILE
make installkernel KERNCONF=MYKERNNELFILE
reboot
# 重启进入单用户模式,在小版本升级过程中,可以在多用户模式下进行
# 多用户模式下
cd /usr/src
mergemaster -p
make installworld
mergemaster
shutdown -r now
# 单用户模式下
adjkerntz -i
fsck -p
mount -u /
mount -a -t ufs
swapon -a
cd /usr/src
mergemaster -p
make installworld
mergemaster
reboot
# 完成上面步骤后
cd /usr/obj
chflags -R noschg *
rm -rf *
cd /usr/src
make cleandir
make cleandir # 一定要运行两次
***如果是只编译内核,可以执行以下步骤
cd /usr/src/sys/i386/conf
config MYKERNEL
cd ../compile/MYKERNEL
make clean
ma
显示全部