Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initcpio: Move firmware unpacking to the initramfs
This solves the flakines due to udev getting uevents for devices before the firmware is updated, and gets rid of the dodgy systemd units involved. Now the initramfs is in charge of unpacking firmware twice: once for itself, once to update the rootfs firmware (if required). This is all fast enough that there isn't any significant impact on boot time. Signed-off-by: Hector Martin <marcan@marcan.st>
- Loading branch information
Showing
5 changed files
with
51 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/ash | ||
|
||
run_earlyhook() { | ||
if [ ! -e /proc/device-tree/chosen/asahi,efi-system-partition ]; then | ||
msg ":: Asahi: Missing asahi,efi-system-partition variable, firmware will not be loaded!" | ||
return 1 | ||
fi | ||
|
||
msg ":: Asahi: Triggering early load of NVMe modules..." | ||
modprobe apple-mailbox | ||
modprobe nvme-apple | ||
|
||
for i in $(seq 0 50); do | ||
[ -e /sys/bus/platform/drivers/nvme-apple/*.nvme/nvme/nvme*/nvme*n1/ ] && break | ||
sleep 0.1 | ||
done | ||
|
||
if [ ! -e /sys/bus/platform/drivers/nvme-apple/*.nvme/nvme/nvme*/nvme*n1/ ]; then | ||
err "Timed out waiting for NVMe device" | ||
return 1 | ||
fi | ||
|
||
# If the above exists, hopefully the /dev device exists and this will work | ||
msg ":: Asahi: Unpacking vendor firmware into initramfs..." | ||
mkdir -p /lib/firmware | ||
ash /usr/bin/update-vendor-firmware | ||
} | ||
|
||
run_latehook() { | ||
msg ":: Asahi: Updating vendor firmware in root filesystem..." | ||
mkdir -p /new_root/lib/firmware | ||
TARGET_ROOT=/new_root ash /usr/bin/update-vendor-firmware | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters