secluded/content/posts/freebsd-quirks-on-the-frame...

3.5 KiB

title author cover lastmod tags categories draft toc
FreeBSD quirks on the Framework laptop
Amolith
./cover.png 2022-04-23T21:14:54-04:00
FreeBSD
Framework
Technology
true true

This is primarily intended for people new to FreeBSD. If you're already familiar with it, the wiki page will probably tell you everything you need. I had no idea what I was doing so I had no idea what I was looking for! I had been beating my head against a wall for about three hours before I decided to join #freebsd on Libera.Chat; the people there were friendly, helpful, and gave me tons of great advice. I highly recommend popping in if you have any issues!

The Handbook

Open the handbook. Follow the handbook. Read the whole handbook. The developers spend a lot of time making sure it's the best resource available for learning FreeBSD. In most cases, it will have an answer for any question related to FreeBSD.

That said, the Framework laptop is so new that it's not fully supported by the current stable release, so for now, we'll need to diverge a bit. This guide is really only applicable until the release of FreeBSD 13.1 and until drm-kmod hits version 5.5+. Once those two criteria are met, following the handbook should be entirely sufficient!

The Source

In section 2.5.3 of the handbook/installer, make sure you tick the src box to download the FreeBSD source code. It'll be necessary for building our graphics drivers later on.

The Graphics

This is where things are less-than-ideal at the moment. Usually, installing graphics/drm-kmod would be sufficient, but the version in both FreeBSD's package repos and in the ports tree is too old. At the time of writing, it's compatible with Linux kernel 5.4 while the Framework's drivers are in Linux kernel 5.5+. We'll need to clone the sources for graphics/drm-kmod, check out a more recent branch, build the drivers, and use those instead.

I'm not 100% certain whether the first step here is necessary but I don't feel like reinstalling to check.

  1. Install graphics/drm-kmod with pkg install drm-kmod

  2. Install devel/git with pkg install git

  3. Clone drm-kmod's source with

    git clone https://github.com/freebsd/drm-kmod
    
  4. Check out the 5.7-stable branch with

    git checkout -b 5.7-stable --track remotes/origin/5.7-stable
    
  5. Build the package with make

  6. Uninstall drm-kmod and all of its dependencies with pkg remove drm-kmod followed by pkg autoremove

  7. Install the more up-to-date drivers with make install

  8. Make sure the module works as expected with kldload /boot/modules/i915kms.ko

  9. If you suddenly see grey in your terminal, it works! Go ahead and add it to your boot config by appending the following line to /etc/rc.conf

    kld_load="/boot/modules/i915kms.ko"
    
  10. Reboot and you should be able to start Xorg as the handbook describes!

Again all of this information is available on the FreeBSD wiki page for the Framework laptop. The Graphics row in section 2 says requires DRM-KMOD 5.5 or higher. Fails to initialize with DRM-KMOD 5.4. That's in reference to the package we just built and installed.

Hope this helps!