💾 Archived View for uscoffings.net › tech › freebsd › freebsd-rebuild.gmi captured on 2023-09-08 at 15:58:46. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-03-20)

-=-=-=-=-=-=-

Notes for Upgrading FreeBSD

[date: 2018-04-14]

After upgrading my motherboard to a Kaby Lake processor, I have lost accelerated video with FreeBSD-11.1. FreeBSD-12-CURRENT has the Kaby Lake i915 DRM patches. Below are some notes upgrading and then rebuilding the kernel from source.

Upgrade to 12-CURRENT

Before starting any major upgrade, I like to ensure the system is up-to-date, and clean out any junk ports:

# freebsd-update fetch
# freebsd-update install
# portsnap fetch
# portsnap update
# portmaster -ad
# pkg_cutleaves

Now that the system is in a tidy state, let's think about updating to 12-CURRENT. I've been running from binary installs. Switch to building from source:

# portmaster -d devel/subversion
# mv /usr/src /usr/src.bak
# svn checkout https://svn.freebsd.org/base/head /usr/src

Previously my `CPUTYPE` has been `native`, but googling suggests sometimes this causes problems. The most recent explicitly mentioned microarchitecture in `/usr/src/share/mk/bsd.cpu.mk` is `skylake`. So let's go with that:

# vim /etc/make.conf
CPUTYPE?=skylake

Build the kernel:

# cd /usr/src
# make -j4 buildworld
# make -j4 buildkernel

Now install the kernel and reboot:

# make installkernel
# shutdown -r now

Now install the world:

# cd /usr/src
# make installworld
# shutdown -r now

Merge configuration files and clean up:

# mergemaster -Ui
# make check-old
# make delete-old
# make check-old-libs
# make delete-old-libs
# shutdown -r now

It's a good idea to rebuild all ports (`portmaster -afd`) after upgrading the base OS.

# portmaster -afd

Install `drm-next-kmod`

# portmaster -d graphics/drm-next-kmod

Load the `i915kms.ko` from `/etc/rc.conf`:

kld_list="/boot/modules/i915kms.ko"

Also proofread `/boot/loader.conf` for any now-extraneous lines. For example, I had a `kern.vt.fb.default_mode` setting which -- now that it was driving two monitors -- was now applying an out-of-range resolution to a monitor.