第 11.2 节 通过源代码更新
基本思路就是获取 FreeBSD 的源代码,然后进行编译安装。可以使用 git 直接拉取代码,也可以直接下载 ISO 镜像里面的 txz 压缩文件或者去 github 上下载当前 FreeBSD 项目的 zip 压缩包。
编译流程见 Handbook 即可。非常地简单。
拉取源码:
- 直接拉取压缩包
# fetch https://mirrors.nju.edu.cn/freebsd/snapshots/arm64/14.0-CURRENT/src.txz
# tar zxvf src.txz -C /
- 或者直接从 https://github.com/freebsd/freebsd-src 下载 zip,传进去。
# unzip freebsd-src-main.zip
# mv freebsd-src-main/* /usr/src
开始编译:
# cd /usr/src
# make -j4 buildworld # 编译世界
# make -j4 kernel # 编译并安装内核
# reboot # 重启使用新内核
# etcupdate -p # 合并更新
# cd /usr/src
# make installworld # 安装世界
# etcupdate -B # 合并更新
# reboot # 重启
故障排除:
Conflicts remain from previous update, aborting.
root@ykla:~ # etcupdate -B
Conflicts remain from previous update, aborting.
# export EDITOR=/usr/bin/ee # 切换 vi 为 ee,vi 不会用
# export VISUAL=/usr/bin/ee # 切换 vi 为 ee,vi 不会用
# etcupdate resolve # 解决冲突
Resolving conflict in '/etc/group':
Select: (p) postpone, (df) diff-full, (e) edit,
(h) help for more options: e # 输入 e 解决冲突
# etcupdate -B