Step1:更改pkg源
root@FreeBSD:~ # mkdir -p /usr/local/etc/pkg/repos
root@FreeBSD:~ # vi /usr/local/etc/pkg/repos/1.ustc.conf
ustc: { url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/latest", mirror_type: "srv", signature_type: "none", fingerprints: "/usr/share/keys/pkg", enabled: yes }
root@FreeBSD:~ # mv /etc/pkg/FreeBSD.conf /etc/pkg/FreeBSD.conf.back
root@FreeBSD:~ # pkg update
Step2:安装编译所需工具
root@FreeBSD:~ # pkg install vim wget git axel
root@FreeBSD:~ # axel -n 10 -a http://mirrors.ustc.edu.cn/freebsd/releases/amd64/13.1-RELEASE/src.txz
root@FreeBSD:~ # tar xzpf src.txz -C /
Step3:修改内核参数
root@FreeBSD:~ # cd /usr/src/
root@FreeBSD:/usr/src # cd /usr/src/sys/amd64/conf
root@FreeBSD:/usr/src/sys/amd64/conf # mkdir /root/kernels
root@FreeBSD:/usr/src/sys/amd64/conf # cp GENERIC /root/kernels/UNIX
root@FreeBSD:/usr/src/sys/amd64/conf # cd /root/kernels/
root@FreeBSD:~/kernels # vim UNIX
options IPFIREWALL options IPFIREWALL_VERBOSE options IPFIREWALL_VERBOSE_LIMIT=3 options IPFIREWALL_DEFAULT_TO_ACCEPT options IPFIREWALL_NAT options DUMMYNET options LIBALIAS options HZ=2000
root@FreeBSD:~/kernels # cd /usr/src/sys/amd64/conf
root@FreeBSD:/usr/src/sys/amd64/conf # ln -s /root/kernels/UNIX
Step4:编译内核
root@FreeBSD:/usr/src/sys/amd64/conf # cd /usr/src
root@FreeBSD:/usr/src # make buildkernel KERNCONF=UNIX
标签:src,FreeBSD,pkg,conf,编译,usr,Freebsd,root,内核 From: https://www.cnblogs.com/networking/p/17396742.html