chadmed / asahi-gentoosupport

Gentoo support files for Apple Silicon devices
61 stars 16 forks source link

genstrap: Include platform firmware in root image #12

Closed Leo3418 closed 1 year ago

Leo3418 commented 1 year ago

Some firmware files not in the linux-firmware package are needed to load a few devices on Apple silicon-based Macs, including the Wi-Fi adapter. Asahi Linux Desktop and Minimal load them to /lib/firmware/vendor. See 1 for more details.

The LiveCD image built by genstrap.sh does not load those firmware files, which renders the Wi-Fi adapter unavailable under the LiveCD environment. See 2 for more details.

This commit will let genstrap.sh:

In particular, the firmware has to be loaded after udev starts according to 1. Adding the brcmfmac driver to the initramfs might cause the firmware to load earlier than udev, which will still trigger Wi-Fi issues as per 2. Thus, this commit also makes dracut not include the brcmfmac driver anymore.

chadmed commented 1 year ago

Thanks for the PR.

While this does fix the poor behaviour, I'd prefer to upstream a more "correct" fix.

AsahiLinux/asahi-scripts contains a Dracut hook to do this automatically at boot in a way our modules and boot tooling expect. Integrating this into genstrap.sh should be trivial - add asahi-scripts as a submodule, then tell Dracut to inject the firmware hook and its dependencies.

Copying a few shell scripts of a known and unlikely to change size is more future proof than trying to copy a firmware folder of unknown size (and provenance), especially when we're already hitting unreasonable size constraints on the overlayfs.

Leo3418 commented 1 year ago

Thanks for the PR.

While this does fix the poor behaviour, I'd prefer to upstream a more "correct" fix.

AsahiLinux/asahi-scripts contains a Dracut hook to do this automatically at boot in a way our modules and boot tooling expect. Integrating this into genstrap.sh should be trivial - add asahi-scripts as a submodule, then tell Dracut to inject the firmware hook and its dependencies.

Copying a few shell scripts of a known and unlikely to change size is more future proof than trying to copy a firmware folder of unknown size (and provenance), especially when we're already hitting unreasonable size constraints on the overlayfs.

I understand. Reusing the dracut hook does feel like a better approach. I will close this pull request for now, but feel free to cherry-pick the commit should you change your mind later.