freebsd-quirks-on-the-framework-laptop.md

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