1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
. /scripts/functions
if [ -e /lib/firmware/vendor ]; then
log_failure_msg "Vendor firmware was loaded by the bootloader"
return 1
fi
if [ ! -e /proc/device-tree/chosen/asahi,efi-system-partition ]; then
log_failure_msg "Missing asahi,efi-system-partition variable, firmware will not be loaded!"
return 1
fi
log_success_msg "Load NVME modules"
modprobe apple-mailbox
modprobe nvme-apple
modprobe xhci-plat-hcd
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
VENDORFW="/run/.system-efi/vendorfw/"
(
. /usr/share/asahi-scripts/functions.sh
mount_sys_esp /run/.system-efi
)
if [ ! -e "$VENDORFW/firmware.cpio" ]; then
log_failure_msg "Vendor firmware not available in ESP!"
umount /run/.system-efi
return 1
fi
( cd /; cpio -i < "$VENDORFW/firmware.cpio" )
umount /run/.system-efi
log_success_msg "Asahi: Vendor firmware unpacked successfully"
|