Help with Installing a Kernel Driver on Bluefin

Hello everyone,

I’m looking for assistance in installing a kernel driver from this GitHub repository on Fedora Silverblue, specifically for the Bluefin variant.

Currently, I’ve managed to compile the driver using:

bash

make
sudo insmod aorus-laptop.ko

However, I face two main issues:

  1. After every reboot, I need to manually run sudo insmod aorus-laptop.ko to load the driver again.
  2. I also have to rebuild the driver after every kernel update, which is quite cumbersome.

Given that I can’t use DKMS on Fedora Silverblue, I’ve read that creating my own package using Akmods might be a solution. However, I’m having trouble finding documentation or resources to guide me through the process.

My specific question is: How can I properly install and manage this kernel driver on Fedora Silverblue (Bluefin) using Akmod or any other recommended method?

Any guidance or resources would be greatly appreciated!

Thank you in advance for your help!

As it happens I’ve recently done this myself, so I can point you to what I did. This may be more convoluted than strictly necessary but I’ve been happy with the results.

(I don’t know how familiar you are with this stuff so I apologize if this is too granular/not granular enough)

These are the steps I took to get an image with the drivers I needed:

  1. Put together an akmod package with the driver.
  2. Build that package in a Copr.
  3. PR a script into akmods that adds the package to their extras image.
  4. Create a Bluefin derivative which uses that package and rebase into that.

Here’s how I completed each step:

1. Package the driver

This step is probably the hardest to get into if you’re not already used to packaging software. I couldn’t find any good documentation on creating akmod packages specifically, so my effort was mostly trolling the Fedora docs and looking at existing driver packages to figure it out.

You can see what I did in my repo.

There are two .spec files. One is for the driver itself (system76-io-kmod.spec) and the other (system76-io.spec) packages “common” files like the README and the driver list.

Your best bet might be to copy what I have and make changes. In particular, you want the URL field in the -kmod.spec file to point to the upstream repo while in the other .spec you want to point to the repo where you’re doing your work.

I’m sure there’s a less convoluted way to do this but it worked for me :sweat_smile:

2. Build the package in a Copr

Next you want to sign up for a Copr account if you don’t already have one.

Once you’re set up create a project. Most of the fields should be pretty self-explanatory but under Build Options → Chroots you want to check:

  • fedora-40-x86_64
  • fedora-41-x86_64
  • fedora-rawhide-x86_64

and leave the rest alone.

Once you have your project you want to create two packages. Go into the “Packages” tab in your project and click “New package”.

You want to create a aorus-laptop-kmod package and an aorus-laptop package. For both of these make sure the Clone url field points to your Github repo with the .spec files. The Spec file field should list which .spec file is associated with that package (i.e. the -kmod variant or not)

Once you have that set up you can click the “Rebuild all” button on the Packages page to try building them. It might take a few iterations of building then reading logs to see what went wrong. If you get stuck on this part you can paste the logs here and I’ll help if I can!

3. PR the package into akmods

Once your packages are building you can open a PR into akmods! You can look at one I did a bit ago for a sense of what to do: feat: add system76-io driver by ssweeny · Pull Request #284 · ublue-os/akmods · GitHub

You basically add a script which builds the RPM, then add that to Containerfile.extra. I was able to test this locally using podman build -f Containerfile.extra which was nice for cleaning things up before posting for review.

Assuming all the tests pass you should be able to get reviewed and merged relatively quickly.

4. Create a custom image

Since the extras aren’t installed by default in the Universal Blue images you’re going to have to make a custom image based on e.g. Bluefin which also includes your drivers.

Personally I think the easiest thing to do here is to use the BlueBuild system. It’s recipe-based and as a non-cloud-native developer this was easier for me to get my head around than the UBlue template.

I would follow their instructions to create your repo from their template then add an akmods section that lists your driver. You can see how I did it here: ublue-ssweeny/recipes/recipe-bluefin-dx-hwe.yml at 454e99968fdfb685e4534feaf1edd0fbc22021a4 · ssweeny/ublue-ssweeny · GitHub

I realize this is a lot, so give it a try and if you get stuck give me a ping and I’ll be happy to help out!

3 Likes

We should copy and paste this into the akmods README! <3

4 Likes

Hi !

I apologize for my late responses; it has been a busy week. I really appreciate the detailed explanation you provided—it helps a lot <3!

I’ll definitely try your steps when I find some time this weekend.

Thanks again for your support, and I’ll reach out if I have any questions as I work through this.

1 Like