Skip to content

Commit 6eb1349

Browse files
committed
New-style vendorfw in initramfs
Vendor firmware is now either loaded by the bootloader directly as an add-on initramfs, or loaded by the initramfs from the ESP, into /vendorfw in the initramfs. Then it is copied to a tmpfs mount at /lib/firmware/vendor on the new root filesystem.
1 parent d57f49e commit 6eb1349

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

initcpio/hooks/asahi

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
# SPDX-License-Identifier: MIT
33

44
run_earlyhook() {
5+
if [ -e /vendorfw ]; then
6+
msg ":: Asahi: Vendor firmware was loaded by the bootloader"
7+
return 0
8+
fi
9+
510
if [ ! -e /proc/device-tree/chosen/asahi,efi-system-partition ]; then
611
msg ":: Asahi: Missing asahi,efi-system-partition variable, firmware will not be loaded!"
712
return 1
@@ -23,12 +28,13 @@ run_earlyhook() {
2328

2429
# If the above exists, hopefully the /dev device exists and this will work
2530
msg ":: Asahi: Unpacking vendor firmware into initramfs..."
26-
mkdir -p /lib/firmware
27-
ash /usr/bin/update-vendor-firmware
31+
mkdir -p /vendorfw
32+
TARGET=/vendorfw ash /usr/bin/update-vendor-firmware
2833
}
2934

3035
run_latehook() {
31-
msg ":: Asahi: Updating vendor firmware in root filesystem..."
32-
mkdir -p /new_root/lib/firmware
33-
TARGET_ROOT=/new_root ash /usr/bin/update-vendor-firmware
36+
msg ":: Asahi: Copying vendor firmware to tmpfs under root filesystem..."
37+
mkdir -p /new_root/lib/firmware/vendor
38+
mount -t tmpfs vendorfw /new_root/lib/firmware/vendor
39+
cp -r /vendorfw/* /vendorfw/.vendorfw.manifest /new_root/lib/firmware/vendor
3440
}

initcpio/install/asahi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ build() {
3737

3838
# Firmware update script
3939
add_runscript
40+
add_dir /lib/firmware
41+
add_symlink /lib/firmware/vendor /vendorfw
4042
}
4143

4244
help() {

update-vendor-firmware

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ fi
1818
: ${TARGET:=/lib/firmware/}
1919
: ${TARGET_MANIFEST:=".vendorfw.manifest"}
2020

21+
if [ -e "$TARGET/vendor/$TARGET_MANIFEST" ]; then
22+
echo "New-style vendorfw detected, nothing to update"
23+
exit 0
24+
fi
25+
2126
umount=false
2227

2328
if [ -z "$VENDORFW" ]; then

0 commit comments

Comments
 (0)