ugrd asahi (mac) support
Hey,
I'm wondering what's the best way to achieve something like this module script does in dracut but in ugrd?
https://github.com/AsahiLinux/asahi-scripts/blob/main/dracut/modules.d/99asahi-firmware/load-asahi-firmware.sh
Hey,
I'm wondering what's the best way to achieve something like this module script does in dracut but in ugrd?
https://github.com/AsahiLinux/asahi-scripts/blob/main/dracut/modules.d/99asahi-firmware/load-asahi-firmware.sh
I've been looking to port that module for over a year at this point (I just don't have hardware to test on). If you understand what it's doing, it shouldn't be too hard to rewrite for ugrd. I'm not sure how deep that module is tied into dracut, but if you were to include appropriate kmods in your kmod_init definition, and add the ugrd.base.debug module, that should be a decent starting point to try to attempt using a method similar to that script.
If you want to make your own test module, you could make a simple python function which returns a big multiline section, like in /var/lib/ugrd/asahi.py:
def asahi_init():
return """
#!/bin/sh
# SPDX-License-Identifier: MIT
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
if [ -e /vendorfw ]; then
info ":: Asahi: Vendor firmware was loaded by the bootloader"
return 0
fi
...
...
...
"""
Then in /var/lib/ugrd/asahi.toml:
[imports.init_mount]
asahi = [ "asahi_init"]
The way modules work is that a python function returns a list of strings, or a multiline string. That output is used to build the init file/profile. It uses the function name (in python) to also make a shell function. The toml file defines functions to look for within a certain module. Custom modules directly in /var/lib/ugrd/
in this case, I'm assuming this should be done during the "mount" phase. If you build with the debug module, and use the shell, you could also simply add function imports, so the shell code you made is validated and included, but it's not automatically executed. The debug module should include your $EDITOR which should make it a bit easier to work in the debug env.
I'm somewhat confused about what it's actually doing as the /vendorfw seems to be in the initramfs's root? I can't really tell. Anyway, the cpio extraction is indeed needed for getting Wifi to work. I was able to do it manually after I was in the booted system as it currently works too, after I manually moved the needed brcm blobs to /lib/firmware on the booted system which is not the greatest ways of doing it..
I'm not entirely sure either, I thought on macs, there was some procedure where some system firmware storage is mounted, and then the initramfs pulls/uses files from that mountpoint. I'm assuming if you keep those files between boots, you can just add them into the image, but that won't work unless they were carefully extracted/saved first.