最新

ここに日記はありません

Saturday 10 January, 2015 [長年日記] この日を編集

_ [BSD][Mac] MacBookにFreeBSDを (10) - mergemaster -

base systemをupdateするにはfreebsd-updateを使うのが簡単らしく主流になっているけど私はいまだにsrcからbuildすることにしている。一般的な手順は/usr/src/UPDATINGに記載されている。

To rebuild everything and install it on the current system.
-----------------------------------------------------------
# Note: sometimes if you are running current you gotta do more than
# is listed here if you are upgrading from a really old current.
 
<make sure you have good level 0 dumps>
make buildworld
make kernel KERNCONF=YOUR_KERNEL_HERE
                                                         [1]
<reboot in single user>                         [3]
mergemaster -p                                  [5]
make installworld
mergemaster -i                                  [4]
make delete-old                                 [6]
<reboot>
この中で面倒なのがmergemasterである。これは/etcにある設定ファイルを書き換える際に元にある設定を残しながら編集するためのものである。最近では
# mergemaster -UPi
というoptionをつけることでかなり手間が省けることになってるが、これを覚えるのもちょっと面倒でもある。 mergemaster(8)にも記載されているが、 /etc/mergemaster.rcまたは$HOME/.mergemasterrcに設定を書けばoptionの入力を省略できる。
AUTO_INSTALL=yes
AUTO_UPGRADE=yes
PRESERVE_FILES=yes
IGNORE_MOTD=yes
VERBOSE=yes
FREEBSD_ID=yes
としておくとかなり楽になる。

_ [BSD][Mac] MacBookにFreeBSDを (11) - linux_base -

Handbookにあるように FreeBSDにはLinuxのbinaryを実行するemulatorの機能が含まれている。 基本機能を提供するportsとしては

  • emulators/linux_base-fc4 (Fedora Core 4)
  • emulators/linux_base-f10 (Fedora 10)
  • emulators/linux_base-c6 (CentOS6)
  • emulators/linux_base-gentoo-stage3
  • が入っており、それぞれベースとなっているLinuxのdistributionが異なる。 以前はemulators/linux_baseというデフォルトのportsがあって 以前はlinux_base-fc4にlinkされていたように記憶している。 しばらく前からlinux_base-f10を使っていたが、ちょっと古くなってきたので 今回はlinux_base-c6を使うことにした。

    これを使う時にはFreeBSD内部で設定されているLinux kernelのバージョンが異なるので設定の変更が必要である。
    /etc/sysctl.confには

    compat.linux.osrelease=2.6.18
    
    を追加する。

    portsからinstallするときはこの変更がないとerrorとなるのであらかじめ

    # sysctl compat.linux.osrelease=2.6.18
    
    を入力しておく。 /etc/make.confには使うportsの種類を指定する。
    OVERRIDE_LINUX_BASE_PORT=c6
    OVERRIDE_LINUX_NONBASE_PORTS=c6
    
    /etc/rc.confには
    linux_enable="YES"
    
    /etc/devfs.conf には
    link /tmp shm
    
    /etc/fstabには
    linprocfs /compat/linux/proc linprocfs rw 0 0
    
    を追加する。