ublue-os / hwe

Fedora variants with support for ASUS devices, Nvidia devices, and Surface laptops
https://universal-blue.org/images/hwe
Apache License 2.0
174 stars 37 forks source link

Surface: Include kernel modules into initramfs in build-time, instead of utilizing `initramfs-etc` #250

Closed fiftydinar closed 4 months ago

fiftydinar commented 6 months ago

This should make things more reliable for Surface users.

We can change surface-hardware-setup script to exclude initramfs-etc argument that would be leftover from this transition for some time, which would run this command: rpm-ostree initramfs-etc --untrack=/etc/modules-load.d/ublue-surface.conf

We wouldn't use --untrack-all, because we don't want to erase user modifications to it.

Besides this, it should be a simple change to utilize:

#!/usr/bin/env bash

set -euo pipefail

rpm-ostree cliwrap install-to-root /
QUALIFIED_KERNEL="$(rpm -qa | grep -P 'kernel-(\d+\.\d+\.\d+)' | sed -E 's/kernel-//')"
/usr/libexec/rpm-ostree/wrapped/dracut --no-hostonly --kver "${QUALIFIED_KERNEL}" --reproducible -v --add ostree -f "/lib/modules/${QUALIFIED_KERNEL}/initramfs.img"
chmod 0600 "/lib/modules/${QUALIFIED_KERNEL}/initramfs.img"

Than we would place ublue-surface.conf file from /etc/modules-load.d/ to /usr/lib/modules-load.d/

That would be basically it.

m2Giles commented 4 months ago

We are going to want to do this for all the images in this repo. Nvidia also should have the modules

bsherman commented 4 months ago

I'm working on this now.