1---
2title: "FreeBSD quirks on the Framework laptop"
3author: ["Amolith"]
4cover: ./cover.png
5lastmod: 2022-04-23T21:14:54-04:00
6tags: ["FreeBSD", "Framework"]
7categories: ["Technology"]
8draft: true
9toc: true
10---
11
12This is primarily intended for people new to FreeBSD. If you're already familiar
13with it, [the wiki page](https://wiki.freebsd.org/Laptops/Framework_Laptop) will
14probably tell you everything you need. I had no idea what I was doing so I had
15no idea what I was looking for! I had been beating my head against a wall for
16about three hours before I decided to join `#freebsd` on
17[Libera.Chat](https://libera.chat/); the people there were friendly, helpful,
18and gave me tons of great advice. I highly recommend popping in if you have any
19issues!
20
21## The Handbook {#the-handbook}
22
23Open [the handbook.](https://docs.freebsd.org/en/books/handbook/) Follow [the
24handbook.](https://docs.freebsd.org/en/books/handbook/) Read [the whole
25handbook.](https://docs.freebsd.org/en/books/handbook/) The developers spend a
26_lot_ of time making sure it's the best resource available for learning FreeBSD.
27In most cases, it will have an answer for any question related to FreeBSD.
28
29That said, the Framework laptop is so new that it's not fully supported by the
30current stable release, so for now, we'll need to diverge a bit. This guide is
31really only applicable until the release of FreeBSD 13.1 and until `drm-kmod`
32hits version 5.5+. Once those two criteria are met, following the handbook
33should be entirely sufficient!
34
35## The Source {#the-source}
36
37In section 2.5.3 of the handbook/installer, make sure you tick the `src` box to
38download the FreeBSD source code. It'll be necessary for building our graphics
39drivers later on.
40
41## The Graphics {#the-graphics}
42
43This is where things are less-than-ideal at the moment. _Usually_, installing
44[graphics/drm-kmod](https://cgit.freebsd.org/ports/tree/graphics/drm-kmod) would
45be sufficient, but the version in both FreeBSD's package repos and in the ports
46tree is too old. At the time of writing, it's compatible with Linux kernel 5.4
47while the Framework's drivers are in Linux kernel 5.5+. We'll need to clone the
48_sources_ for `graphics/drm-kmod`, check out a more recent branch, build the
49drivers, and use those instead.
50
51I'm not 100% certain whether the first step here is necessary but I don't feel
52like reinstalling to check.
53
541. Install `graphics/drm-kmod` with `pkg install drm-kmod`
552. Install `devel/git` with `pkg install git`
563. Clone `drm-kmod`'s source with
57
58 ```bash
59 git clone https://github.com/freebsd/drm-kmod
60 ```
61
624. Check out the `5.7-stable` branch with
63
64 ```bash
65 git checkout -b 5.7-stable --track remotes/origin/5.7-stable
66 ```
67
685. Build the package with `make`
696. Uninstall `drm-kmod` and all of its dependencies with `pkg remove drm-kmod`
70 followed by `pkg autoremove`
717. Install the more up-to-date drivers with `make install`
728. Make sure the module works as expected with `kldload
73/boot/modules/i915kms.ko`
749. If you suddenly see grey in your terminal, it works! Go ahead and add it to
75 your boot config by appending the following line to `/etc/rc.conf`
76
77 ```text
78 kld_load="/boot/modules/i915kms.ko"
79 ```
80
8110. Reboot and you should be able to start Xorg as the handbook describes!
82
83Again all of this information is available on [the FreeBSD wiki page for the
84Framework laptop.](https://wiki.freebsd.org/Laptops/Framework_Laptop) The
85`Graphics` row in section 2 says _requires DRM-KMOD 5.5 or higher. Fails to
86initialize with DRM-KMOD 5.4._ That's in reference to the package we just built
87and installed.
88
89Hope this helps!