FreeBSD 6.2 RELEASE 至 FreeBSD 7.2 RELEASE 等。 ====== 版本升級 ====== EX: 從 FreeBSD 6.3 RELEASE 升級至 FreeBSD 7.2 RELEASE 查詢 /etc/make.conf 中的 SUPFILE 設定指向哪個檔案: SUPFILE= /usr/share/examples/cvsup/standard-supfile 至該檔案查詢: *default release=cvs tag=RELENG_6_3 改成 *default release=cvs tag=RELENG_7_2 或 8.0: *default release=cvs tag=RELENG_8_0 然後重新 make update make buildworld make buildkernel make installkernel make installworld mergemaster 等等... 其中,mergemaster 需要仔細看。 ====== 做世界 BuildWorld ====== ===== 編譯環境的設定檔 ===== 參考: https://wiki.sars.tw/doku.php?id=freebsd:basic#make.conf ===== Download World Source Code ===== 系統所需的程式原始碼,存放在 /usr/src/ 中。 # sysinstall Configure -> Distributions -> src -> All ===== Upgrade Source Code ===== 更新原始檔。 # cd /usr/src # make update ===== Build World ===== 編譯所有檔案。 make -j2 buildworld ====== 刻核心 BuildKernel ====== http://twbsd.org/cht/book/index.php?ch=08 ===== 修改核心設定檔 ===== MYKERNEL 可以改成自己想要的核心名字。 # cd /usr/src/sys/i386/conf # cp GENERIC MYKERNEL 將用不到的東西 mark 掉。先參考 /var/run/dmesg.boot 中,看看會用到哪些硬體,記得編進去。尤其是與硬碟相關的設備(ATA/SATA/SCSI/NAS等等),避免找不到硬碟無法開機。 # vi MYKERNEL ===== Build Kernel ===== -j2 代表同時有兩個程式在執行,對於雙核心或多核心系統可減少編譯時間,四個核心可以用 -j5。 # cd /usr/src # make -j2 buildkernel KERNCONF=MYKERNEL ====== 安裝核心 Install Kernel ====== # make installkernel KERNCONF=MYKERNEL 將編譯過程中使用的檔案刪除: # rm -rf /usr/obj/usr/src/sys/MYKERNEL ====== 安裝世界 Install World ====== # make installworld ====== Mergemaster ====== 把 /usr/src/etc 的東西跟 /etc 的東西更新。 # mergemaster [-U] [-i] -U 代表自動更新沒有被修改過的設定檔,在 FreeBSD 6.4 版本之後才可使用 -i 代表自動安裝不存在的新檔案。 如果在舊版沒有 -U 可以用,通常只需要看一下差異,然後按 i 安裝新的設定值就可以了,除了 crontab、group、passwd、master.passwd、named.conf 等檔案一定會不同,不能直接安裝新版本,此時就要用 m 進入 merge 模式,然後看是要保留左邊舊版還是安裝右邊新版的檔案,如果要保留就輸入 l (小寫的 L),要用新版本就輸入 r。 ====== 新世界 ====== # sync;sync;sync;reboot 最後,祈禱沒出問題。 XD ====== 問題處理 ====== ===== 7.x 升級 8.0 的問題 ===== 安裝完 8.0,要 mergemaster 的時候,可能會出現問題: install -o root -g wheel -m 644 atrun cron ftpd imap kde login other passwd pop3 rsh sshd su system telnetd xdm /var/tmp/temproot/etc/pam.d /var/tmp/temproot/etc/pam.d/ftp -> /var/tmp/temproot/etc/pam.d/ftpd Bad system call (core dumped) *** Error code 140 Stop in /usr/src/etc/pam.d. *** Error code 1 Stop in /usr/src/etc. *** Error code 1 Stop in /usr/src. *** Error code 1 Stop in /usr/src. *** FATAL ERROR: Cannot 'cd' to /usr/src and install files to the temproot environment 是因為 /bin/ln 的檔案已經安裝成新版了,但是在舊版的環境無法執行,參考作法: - 備份新版的 /bin/ln -- cp /bin/ln /root/ln_8.0 - 從別台 7.x 的機器把舊版的 ln 透過 scp、http、ftp 等方式複製回來 -- scp xxxx@xxx.xxx.xx:/bin/ln /root/ln_7.x - 暫時蓋過 -- cp /root/ln_7.x /bin/ln - 重新 mergemaster 完成 - 將新版的蓋回來 -- cp /root/ln_8.0 /bin/ln - 重開機 ===== 找不到硬碟 ===== Manual root filesystem specification: : Mount using filesystem eg. ufs:da0sla ? list valid disk boot devices Abort manual input mountroot> 通常是有 SATA/RAID 卡等忘了編進去,在開機選單時(右方有 ASCII 的 FreeBSD字樣),按 ESC 進入 prompt,根據使用到的驅動,輸入 load da load mpt 等字。掛載完成後輸入 boot 開機,即可順利掛載硬碟。 ===== "/usr/src/lib/libc/stdlib/Makefile.inc", line 19: Need an operator ===== 編譯途中如果遇到下列錯誤: ===> lib/libc (cleandir) "/usr/src/lib/libc/stdlib/Makefile.inc", line 19: Need an operator make: fatal errors encountered -- cannot continue *** Error code 1 可能是之前重編後沒有將舊版的編譯檔案刪除,執行 make clean; rm -rf /usr/obj 後重新編譯應該就可以了。