[Home]

FreeBSD Installation

This is a guide to making a modified installer for FreeBSD 11.0 using Ubuntu. First, get the installer and write it to a memstick:

$ wget https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/11.0/FreeBSD-11.0-RELEASE-amd64-memstick.img.xz
$ xz -d FreeBSD-11.0-RELEASE-amd64-memstick.img.xz
$ sudo dd if=FreeBSD-11.0-RELEASE-amd64-memstick.img of=/dev/sdb bs=1M conv=sync

The FreeBSD installer uses the UFS (4.4BSD variant). The Linux kernel distributed by Ubuntu has read support for UFS built in, but write support is highly experimental, so we’ll have to recompile the kernel. If you are alright using kernel 4.8.17 (and trust some random person’s binaries), you can also download my headers and image packages, and skip straight to the last three commands:

$ uname -r
$ sudo -s
# aptitude install linux-source-4.8.0 ncurses-dev kernel-package linux-source build-essential
# cd /usr/src
# bzip2 -dc linux-source-4.8.0.tar.bz2 | tar xf -
# cd linux-source-4.8.0
# cp /boot/config-4.8.0-54-generic .config
# vim .config
# grep CONFIG_UFS_FS_WRITE=y .config
# make menuconfig
# make-kpkg clean
# CONCURRENCY_LEVEL=4 make-kpkg --initrd --append-to-version=-ntd5-ufs-write kernel-image kernel-headers
# cp /usr/share/kernel-package/examples/etc/kernel/postinst.d/initramfs /etc/kernel/postinst.d/
# cp /usr/share/kernel-package/examples/etc/kernel/postrm.d/initramfs /etc/kernel/postrm.d/
# dpkg -i /usr/src/linux-*-ntd5-ufs-write*.deb

Now reboot your computer. Run uname -r again to confirm that you are running the new kernel. Now you can mount the installer and make changes:

$ sudo -s
# mount -r -t ufs -o rw,ufstype=44bsd /dev/sdb3 mnt
# echo 'hint.ahci.0.msi="0"' >> mnt/boot/loader.conf
# echo 'hint.ahci.1.msi="0"' >> mnt/boot/loader.conf
# echo 'hint.ahcich.0.sata_rev="2"' >> mnt/boot/loader.conf
# echo 'hint.ahcich.1.sata_rev="2"' >> mnt/boot/loader.conf
# umount mnt