diff --git a/.gitignore b/.gitignore index 3fe5ccc..6b7eb95 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,22 @@ /asahi-scripts-20220821.tar.gz /asahi-scripts-20220918.2.tar.gz /asahi-scripts-20221027.tar.gz +/asahi-scripts-20221122.tar.gz +/asahi-scripts-20221129.tar.gz +/asahi-scripts-20221206.tar.gz +/asahi-scripts-20221220.tar.gz +/asahi-scripts-20230530.tar.gz +/asahi-scripts-20230606.tar.gz +/asahi-scripts-20230821.tar.gz +/asahi-scripts-20231217.tar.gz +/asahi-scripts-20231218.tar.gz +/asahi-scripts-20231219.tar.gz +/asahi-scripts-20231219.1.tar.gz +/asahi-scripts-20240411.tar.gz +/asahi-scripts-20240429.tar.gz +/asahi-scripts-20240822.tar.gz +/asahi-scripts-20250128.tar.gz +/asahi-scripts-20250130.tar.gz +/asahi-scripts-20250426.tar.gz +/asahi-scripts-20250426.1.tar.gz +/asahi-scripts-20250713.tar.gz diff --git a/0001-update-m1n1-Expand-DTBS-if-it-is-a-directory.patch b/0001-update-m1n1-Expand-DTBS-if-it-is-a-directory.patch new file mode 100644 index 0000000..e9659e7 --- /dev/null +++ b/0001-update-m1n1-Expand-DTBS-if-it-is-a-directory.patch @@ -0,0 +1,35 @@ +From 5fb7712c7c2692b77c21a6d799db29f6cefb388f Mon Sep 17 00:00:00 2001 +From: Janne Grunau +Date: Tue, 19 Aug 2025 22:55:33 +0200 +Subject: [PATCH 1/2] update-m1n1: Expand $DTBS if it is a directory + +Allows limiting the included devices to Apple silicon macs now that the +kernel has device-trees for iphones, ipads and T2 macs as well. +Avoids having each distribution to modify their default update-m1n1 +configuration for this. + +Signed-off-by: Janne Grunau +--- + update-m1n1 | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/update-m1n1 b/update-m1n1 +index ae274eb..dcd79fa 100755 +--- a/update-m1n1 ++++ b/update-m1n1 +@@ -24,6 +24,12 @@ if [ -z "$DTBS" ]; then + exit 1 + fi + ++# If ${DTBS} is a directory expand it to include dtbs from all Apple silicon ++# macs. ++if [ -d "$DTBS" ]; then ++ DTBS="${DTBS}/apple/t6*.dtb ${DTBS}/apple/t81*.dtb" ++fi ++ + umount=false + + m1n1config=/run/m1n1.conf +-- +2.50.1 + diff --git a/0002-fedora-update-m1n1-handle-dangling-boot-dtb-symlinks.patch b/0002-fedora-update-m1n1-handle-dangling-boot-dtb-symlinks.patch new file mode 100644 index 0000000..9507e81 --- /dev/null +++ b/0002-fedora-update-m1n1-handle-dangling-boot-dtb-symlinks.patch @@ -0,0 +1,36 @@ +From d24ee482717237afbf6cbbbabbd0dd4eea772f8a Mon Sep 17 00:00:00 2001 +From: Janne Grunau +Date: Tue, 19 Aug 2025 23:10:23 +0200 +Subject: [PATCH 2/2] fedora: update-m1n1: handle dangling /boot/dtb symlinks + +At kernel-install time the target of the /boot/dtb symlink might not +exists yet for newly installed targets. Use +"/usr/lib/modules/${KERNEL_VERSION}/dtb" instead. + +Signed-off-by: Janne Grunau +--- + update-m1n1 | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/update-m1n1 b/update-m1n1 +index dcd79fa..87de029 100755 +--- a/update-m1n1 ++++ b/update-m1n1 +@@ -24,6 +24,14 @@ if [ -z "$DTBS" ]; then + exit 1 + fi + ++# Fedora: handle broken /boot/dtb symlinks by reading the link, ++# extracting the kernel version and using the dtb directory from ++# "/usr/lib/modules/${KERNEL_VERSION}/". ++if [ -L "$DTBS" -a ! -d "$DTBS" ]; then ++ KVER=$(readlink "$DTBS" | sed -e 's/^dtb-//') ++ DTBS="/usr/lib/modules/${KVER}/dtb" ++fi ++ + # If ${DTBS} is a directory expand it to include dtbs from all Apple silicon + # macs. + if [ -d "$DTBS" ]; then +-- +2.50.1 + diff --git a/15-update-m1n1.install b/15-update-m1n1.install new file mode 100644 index 0000000..b5ce56f --- /dev/null +++ b/15-update-m1n1.install @@ -0,0 +1,22 @@ +#!/usr/bin/sh +# SPDX-License-Identifier: MIT +# thin wrapper to execute `update-m1n1` on kernel updates +# depends on grubby's "10-devicetree.install" + +COMMAND="$1" + +# execute only on aarch64, can't check for Apple silicon systems as the install +# images are created on generic aarch64 systems. +if [ "$(uname -m)" != aarch64 ]; then + exit 0 +fi + +case "${COMMAND}" in + # always run update-m1n1 and rely on its no change detection for removals + # of old kernels. + add|remove) + exec /usr/bin/update-m1n1 + ;; +esac + +exit 0 diff --git a/594967c090cd7c64ee7e8bdb1bc0696f00e4a3ec.patch b/594967c090cd7c64ee7e8bdb1bc0696f00e4a3ec.patch deleted file mode 100644 index 2268d20..0000000 --- a/594967c090cd7c64ee7e8bdb1bc0696f00e4a3ec.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 594967c090cd7c64ee7e8bdb1bc0696f00e4a3ec Mon Sep 17 00:00:00 2001 -From: Neal Gompa -Date: Sun, 18 Sep 2022 11:36:00 -0400 -Subject: [PATCH] Makefile: Rework to split out initramfs script - installation/removal - -Technically, initramfs generators are independent of distributions, -and it's entirely possible to do something like Dracut on Arch. - -Thus, let's ensure that it's possible to do this and install/remove -initramfs scripts separately. - -For backwards compatibility, the install-{arch,fedora} commands -will still install their respective default initramfs generator -scripts. - -Signed-off-by: Neal Gompa ---- - Makefile | 36 ++++++++++++++++++++++-------------- - 1 file changed, 22 insertions(+), 14 deletions(-) - -diff --git a/Makefile b/Makefile -index 4b5fe7b..3a567e8 100644 ---- a/Makefile -+++ b/Makefile -@@ -27,37 +27,45 @@ install: all - install -dD $(DESTDIR)$(PREFIX)/share/asahi-scripts - install -m0644 -t $(DESTDIR)$(PREFIX)/share/asahi-scripts functions.sh - --install-arch: install -+install-mkinitcpio: install -+ install -dD $(DESTDIR)$(PREFIX)/lib/initcpio/install -+ install -m0644 -t $(DESTDIR)$(PREFIX)/lib/initcpio/install initcpio/install/asahi -+ install -dD $(DESTDIR)$(PREFIX)/lib/initcpio/hooks -+ install -m0644 -t $(DESTDIR)$(PREFIX)/lib/initcpio/hooks initcpio/hooks/asahi -+ -+install-dracut: install -+ install -dD $(DESTDIR)$(DRACUT_CONF_DIR) -+ install -m0644 -t $(DESTDIR)$(DRACUT_CONF_DIR) dracut/10-asahi.conf -+ -+install-arch: install install-mkinitcpio - install -m0755 -t $(DESTDIR)$(BIN_DIR)/ $(BUILD_ARCH_SCRIPTS) - install -dD $(DESTDIR)$(PREFIX)/lib/systemd/system - install -dD $(DESTDIR)$(PREFIX)/lib/systemd/system/{multi-user,sysinit}.target.wants - install -m0644 -t $(DESTDIR)$(PREFIX)/lib/systemd/system $(addprefix systemd/,$(UNITS)) - ln -sf $(addprefix $(PREFIX)/lib/systemd/system/,$(MULTI_USER_WANTS)) \ - $(DESTDIR)$(PREFIX)/lib/systemd/system/multi-user.target.wants/ -- install -dD $(DESTDIR)$(PREFIX)/lib/initcpio/install -- install -m0644 -t $(DESTDIR)$(PREFIX)/lib/initcpio/install initcpio/install/asahi -- install -dD $(DESTDIR)$(PREFIX)/lib/initcpio/hooks -- install -m0644 -t $(DESTDIR)$(PREFIX)/lib/initcpio/hooks initcpio/hooks/asahi - install -dD $(DESTDIR)$(PREFIX)/share/libalpm/hooks - install -m0644 -t $(DESTDIR)$(PREFIX)/share/libalpm/hooks libalpm/hooks/95-m1n1-install.hook - --install-fedora: install -- install -dD $(DESTDIR)$(DRACUT_CONF_DIR) -- install -m0644 -t $(DESTDIR)$(DRACUT_CONF_DIR) dracut/10-asahi.conf -+install-fedora: install install-dracut - - uninstall: - rm -f $(addprefix $(DESTDIR)$(BIN_DIR)/,$(SCRIPTS)) - rm -rf $(DESTDIR)$(PREFIX)/share/asahi-scripts - --uninstall-arch: -+uninstall-mkinitcpio: -+ rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/install/asahi -+ rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/hooks/asahi -+ -+uninstall-dracut: -+ rm -f $(DESTDIR)$(DRACUT_CONF_DIR)/10-asahi.conf -+ -+uninstall-arch: uninstall-mkinitcpio - rm -f $(addprefix $(DESTDIR)$(BIN_DIR)/,$(ARCH_SCRIPTS)) - rm -f $(addprefix $(DESTDIR)$(PREFIX)/lib/systemd/system/,$(UNITS)) - rm -f $(addprefix $(DESTDIR)$(PREFIX)/lib/systemd/system/multi-user.target.wants/,$(MULTI_USER_WANTS)) -- rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/install/asahi -- rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/hooks/asahi - rm -f $(DESTDIR)$(PREFIX)/share/libalpm/hooks/95-m1n1-install.hook - --uninstall-fedora: -- rm -f $(DESTDIR)$(DRACUT_CONF_DIR)/10-asahi.conf -+uninstall-fedora: uninstall-dracut - --.PHONY: clean install install-arch install-fedora uninstall uninstall-arch uninstall-fedora -+.PHONY: clean install install-mkinitcpio install-dracut install-arch install-fedora uninstall uninstall-mkinitcpio uninstall-dracut uninstall-arch uninstall-fedora diff --git a/780b7f21f8dc002a3a073b34036291655af7dd38.patch b/780b7f21f8dc002a3a073b34036291655af7dd38.patch deleted file mode 100644 index c469d32..0000000 --- a/780b7f21f8dc002a3a073b34036291655af7dd38.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 780b7f21f8dc002a3a073b34036291655af7dd38 Mon Sep 17 00:00:00 2001 -From: Davide Cavalca -Date: Mon, 31 Oct 2022 21:39:29 -0700 -Subject: [PATCH] asahi-fwextract: fix overzealous quoting - -Signed-off-by: Davide Cavalca ---- - asahi-fwextract | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/asahi-fwextract b/asahi-fwextract -index 744a037..b131e7f 100755 ---- a/asahi-fwextract -+++ b/asahi-fwextract -@@ -40,7 +40,7 @@ fi - - echo "Upgrading vendor firmware package" - "$PYTHON" -m asahi_firmware.update "$ASAHIFW" "$VENDORFWTMP" --mv -f "${VENDORFWTMP}/*" "$VENDORFW" -+mv -f ${VENDORFWTMP}/* "$VENDORFW" - rmdir "$VENDORFWTMP" - echo "Firmware upgraded" - diff --git a/asahi-scripts.spec b/asahi-scripts.spec index aab1329..ecd42cb 100644 --- a/asahi-scripts.spec +++ b/asahi-scripts.spec @@ -1,5 +1,5 @@ Name: asahi-scripts -Version: 20221027 +Version: 20250713 Release: %autorelease Summary: Miscellaneous admin scripts for Asahi Linux @@ -7,49 +7,43 @@ License: MIT URL: https://github.com/AsahiLinux/asahi-scripts Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz Source: update-m1n1.sysconfig -# Add asahi-fwextract script -Patch: %{url}/commit/c749ccaa5d9b16d49b8ae49052f14c5838917cd7.patch -# asahi-fwextract: fix overzealous quoting -Patch: %{url}/commit/780b7f21f8dc002a3a073b34036291655af7dd38.patch -# Makefile: Rework to split out initramfs script installation/removal -Patch: %{url}/commit/594967c090cd7c64ee7e8bdb1bc0696f00e4a3ec.patch -# dracut: Add firmware loading module -Patch: %{url}/commit/f933d5510543e8adeb215c450b1002910fecdde7.patch -# dracut: Fix symlink direction -Patch: %{url}/commit/f67757c036dd16334ec1fd3b8463e66667e71269.patch +Source2: 15-update-m1n1.install + +Patch01: 0001-update-m1n1-Expand-DTBS-if-it-is-a-directory.patch +Patch02: 0002-fedora-update-m1n1-handle-dangling-boot-dtb-symlinks.patch BuildArch: noarch BuildRequires: make BuildRequires: sed +BuildRequires: systemd-rpm-macros +Requires: bash Requires: coreutils Requires: grep Requires: sed +Requires: systemd-udev Requires: util-linux-core %description This package contains miscellaneous admin scripts for the Asahi Linux reference distro. -%package -n asahi-fwextract +%package -n asahi-fwupdate Summary: Asahi Linux firmware extractor Requires: %{name} = %{version}-%{release} -Requires: python3dist(asahi-firmware) +# Not using python3dist(asahi-firmware) because its version is fixed +Requires: python3-asahi_firmware >= 0.5.4 -%description -n asahi-fwextract -Asahi Linux firmware extractor. +%description -n asahi-fwupdate +Asahi Linux firmware updater. %package -n dracut-asahi Summary: Dracut config for Apple Silicon Macs Requires: dracut Requires: linux-firmware-vendor = %{version}-%{release} -Provides: dracut-config-asahi = %{version}-%{release} -Obsoletes: dracut-config-asahi < 20220821-5 -Provides: update-vendor-firmware = %{version}-%{release} -Obsoletes: update-vendor-firmware < 20220918.2-8 %description -n dracut-asahi Dracut config for Apple Silicon Macs. @@ -66,15 +60,28 @@ over properly from the initramfs. Summary: Keep m1n1 up to date Requires: %{name} = %{version}-%{release} - Requires: bash Requires: gzip Requires: m1n1 Requires: uboot-images-armv8 +# grubby's /usr/lib/kernel/install.d/10-devicetree.install creates the +# /boot/dtb symlink update-m1n1 uses to construct the 2nd stage m1n1 image +Requires: grubby %description -n update-m1n1 Keep m1n1 up to date on Apple Silicon systems. +%package -n asahi-battery +Summary: Asahi Linux battery charge control scripts + +Requires: %{name} = %{version}-%{release} +Requires: systemd +Requires: systemd-udev + +%description -n asahi-battery +Asahi Linux battery charge control scripts restore charge_control_end_threshold +on system start. + %prep %autosetup -p1 @@ -89,21 +96,34 @@ Keep m1n1 up to date on Apple Silicon systems. install -Ddpm0755 %{buildroot}%{_prefix}/lib/firmware/vendor install -Dpm0644 %SOURCE1 %{buildroot}%{_sysconfdir}/sysconfig/update-m1n1 +# Install kernel-install script +install -Dpm0755 -t %{buildroot}%{_kernel_install_dir} %{SOURCE2} -%transfiletriggerin -n update-m1n1 -- %{_libdir}/m1n1 %{_datadir}/uboot/apple_m1 /boot/dtb- +%transfiletriggerin -n asahi-fwupdate -- %{_sbindir}/asahi-fwupdate %{_bindir}/asahi-fwextract +%{_sbindir}/asahi-fwupdate || : + +# This needs to be a separate trigger because we can't use python3_sitearch here +%transfiletriggerin -n asahi-fwupdate -- /usr/lib/python +grep -q 'asahi_firmware' && %{_sbindir}/asahi-fwupdate || : + +# We can't use _libdir here because it gets incorrectly expanded to /usr/lib +%transfiletriggerin -n update-m1n1 -- /usr/lib/m1n1 /usr/lib64/m1n1 /usr/share/uboot/apple_m1 /etc/m1n1.conf %{_sbindir}/update-m1n1 || : %files %license LICENSE %{_datadir}/%{name}/ +%{_sbindir}/asahi-diagnose +%{_udevhwdbdir}/65-autosuspend-override-asahi-sdhci.hwdb -%files -n asahi-fwextract +%files -n asahi-fwupdate %license LICENSE -%{_sbindir}/asahi-fwextract +%{_sbindir}/asahi-fwupdate %files -n dracut-asahi %license LICENSE %{_prefix}/lib/dracut/dracut.conf.d/10-asahi.conf +%{_prefix}/lib/dracut/modules.d/91kernel-modules-asahi/ %{_prefix}/lib/dracut/modules.d/99asahi-firmware/ %files -n linux-firmware-vendor @@ -112,9 +132,15 @@ install -Dpm0644 %SOURCE1 %{buildroot}%{_sysconfdir}/sysconfig/update-m1n1 %files -n update-m1n1 %license LICENSE -%config(noreplace) %{_sysconfdir}/m1n1.conf %config(noreplace) %{_sysconfdir}/sysconfig/update-m1n1 +%{_kernel_install_dir}/15-update-m1n1.install %{_sbindir}/update-m1n1 +%files -n asahi-battery +%{_unitdir}/macsmc-battery-charge-control-end-threshold.path +%{_unitdir}/macsmc-battery-charge-control-end-threshold.service +%{_udevrulesdir}/93-macsmc-battery-charge-control.rules +%ghost %config(noreplace) %{_sysconfdir}/udev/macsmc-battery.conf + %changelog %autochangelog diff --git a/c749ccaa5d9b16d49b8ae49052f14c5838917cd7.patch b/c749ccaa5d9b16d49b8ae49052f14c5838917cd7.patch deleted file mode 100644 index 18206ea..0000000 --- a/c749ccaa5d9b16d49b8ae49052f14c5838917cd7.patch +++ /dev/null @@ -1,79 +0,0 @@ -From c749ccaa5d9b16d49b8ae49052f14c5838917cd7 Mon Sep 17 00:00:00 2001 -From: Davide Cavalca -Date: Mon, 19 Sep 2022 14:09:57 +0200 -Subject: [PATCH] Add asahi-fwextract script - -Signed-off-by: Davide Cavalca ---- - Makefile | 2 +- - asahi-fwextract | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 49 insertions(+), 1 deletion(-) - create mode 100755 asahi-fwextract - -diff --git a/Makefile b/Makefile -index b175b4a..4b5fe7b 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - PREFIX=/usr/local - CONFIG_DIR=/etc/default - BIN_DIR=$(PREFIX)/bin --SCRIPTS=update-m1n1 -+SCRIPTS=asahi-fwextract update-m1n1 - ARCH_SCRIPTS=update-grub first-boot - UNITS=first-boot.service - MULTI_USER_WANTS=first-boot.service -diff --git a/asahi-fwextract b/asahi-fwextract -new file mode 100755 -index 0000000..744a037 ---- /dev/null -+++ b/asahi-fwextract -@@ -0,0 +1,48 @@ -+#!/bin/sh -+# SPDX-License-Identifier: MIT -+ -+set -eu -+ -+[ -e /etc/default/asahi-fwextract ] && . /etc/default/asahi-fwextract -+ -+: "${ASAHIFW:=}" -+: "${VENDORFW:=}" -+: "${VENDORFWTMP:=/run/.vendorfw-tmp}" -+: "${PYTHON:=python3}" -+ -+if [ -e "$(dirname "$0")"/functions.sh ]; then -+ . "$(dirname "$0")"/functions.sh -+else -+ . /usr/share/asahi-scripts/functions.sh -+fi -+ -+umount=false -+ -+if [ -z "$ASAHIFW" ] && [ -z "$VENDORFW" ]; then -+ mount_sys_esp /run/.system-efi -+ ASAHIFW="/run/.system-efi/asahi/" -+ VENDORFW="/run/.system-efi/vendorfw/" -+ umount=true -+fi -+ -+if [ ! -e "${ASAHIFW}/all_firmware.tar.gz" ]; then -+ echo "No firmware tarball found, skipping extraction" -+ exit 0 -+fi -+ -+if [ ! -d "$VENDORFW" ]; then -+ mkdir -p "$VENDORFW" -+fi -+ -+if [ ! -d "$VENDORFWTMP" ]; then -+ mkdir -p "$VENDORFWTMP" -+fi -+ -+echo "Upgrading vendor firmware package" -+"$PYTHON" -m asahi_firmware.update "$ASAHIFW" "$VENDORFWTMP" -+mv -f "${VENDORFWTMP}/*" "$VENDORFW" -+rmdir "$VENDORFWTMP" -+echo "Firmware upgraded" -+ -+$umount && umount /run/.system-efi -+true diff --git a/f67757c036dd16334ec1fd3b8463e66667e71269.patch b/f67757c036dd16334ec1fd3b8463e66667e71269.patch deleted file mode 100644 index a1beb48..0000000 --- a/f67757c036dd16334ec1fd3b8463e66667e71269.patch +++ /dev/null @@ -1,24 +0,0 @@ -From f67757c036dd16334ec1fd3b8463e66667e71269 Mon Sep 17 00:00:00 2001 -From: Hector Martin -Date: Fri, 4 Nov 2022 10:00:39 +0900 -Subject: [PATCH] dracut: Fix symlink direction - -Fixes: #16 -Signed-off-by: Hector Martin ---- - dracut/modules.d/99asahi-firmware/module-setup.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/dracut/modules.d/99asahi-firmware/module-setup.sh b/dracut/modules.d/99asahi-firmware/module-setup.sh -index 15195bf..547103a 100755 ---- a/dracut/modules.d/99asahi-firmware/module-setup.sh -+++ b/dracut/modules.d/99asahi-firmware/module-setup.sh -@@ -26,7 +26,7 @@ installkernel() { - # called by dracut - install() { - inst_dir "/lib/firmware" -- ln_r "/lib/firmware/vendor" "/vendorfw" -+ ln_r "/vendorfw" "/lib/firmware/vendor" - asahiscriptsdir="/usr/share/asahi-scripts" - inst_dir $asahiscriptsdir - $DRACUT_CP -R -L -t "${initdir}/${asahiscriptsdir}" "${dracutsysrootdir}${asahiscriptsdir}"/* diff --git a/f933d5510543e8adeb215c450b1002910fecdde7.patch b/f933d5510543e8adeb215c450b1002910fecdde7.patch deleted file mode 100644 index 730b1ce..0000000 --- a/f933d5510543e8adeb215c450b1002910fecdde7.patch +++ /dev/null @@ -1,181 +0,0 @@ -From f933d5510543e8adeb215c450b1002910fecdde7 Mon Sep 17 00:00:00 2001 -From: Neal Gompa -Date: Wed, 2 Nov 2022 22:11:25 -0400 -Subject: [PATCH] dracut: Add firmware loading module - -This implements the logic for loading Apple firmware on Asahi systems -using Dracut as the initramfs system. - -Signed-off-by: Neal Gompa ---- - Makefile | 8 +++- - dracut/{ => dracut.conf.d}/10-asahi.conf | 3 ++ - .../install-asahi-firmware.sh | 12 +++++ - .../99asahi-firmware/load-asahi-firmware.sh | 47 +++++++++++++++++++ - .../99asahi-firmware/module-setup.sh | 36 ++++++++++++++ - 5 files changed, 105 insertions(+), 1 deletion(-) - rename dracut/{ => dracut.conf.d}/10-asahi.conf (91%) - create mode 100755 dracut/modules.d/99asahi-firmware/install-asahi-firmware.sh - create mode 100755 dracut/modules.d/99asahi-firmware/load-asahi-firmware.sh - create mode 100755 dracut/modules.d/99asahi-firmware/module-setup.sh - -diff --git a/Makefile b/Makefile -index 3a567e8..ae00958 100644 ---- a/Makefile -+++ b/Makefile -@@ -6,6 +6,7 @@ ARCH_SCRIPTS=update-grub first-boot - UNITS=first-boot.service - MULTI_USER_WANTS=first-boot.service - DRACUT_CONF_DIR=$(PREFIX)/lib/dracut/dracut.conf.d -+DRACUT_MODULES_DIR=$(PREFIX)/lib/dracut/modules.d - BUILD_SCRIPTS=$(addprefix build/,$(SCRIPTS)) - BUILD_ARCH_SCRIPTS=$(addprefix build/,$(ARCH_SCRIPTS)) - -@@ -26,6 +27,7 @@ install: all - install -m0644 -t $(DESTDIR)/etc etc/m1n1.conf - install -dD $(DESTDIR)$(PREFIX)/share/asahi-scripts - install -m0644 -t $(DESTDIR)$(PREFIX)/share/asahi-scripts functions.sh -+ install -dD $(DESTDIR)/lib/firmware/vendor - - install-mkinitcpio: install - install -dD $(DESTDIR)$(PREFIX)/lib/initcpio/install -@@ -35,7 +37,11 @@ install-mkinitcpio: install - - install-dracut: install - install -dD $(DESTDIR)$(DRACUT_CONF_DIR) -- install -m0644 -t $(DESTDIR)$(DRACUT_CONF_DIR) dracut/10-asahi.conf -+ install -m0644 -t $(DESTDIR)$(DRACUT_CONF_DIR) dracut/dracut.conf.d/10-asahi.conf -+ install -dD $(DESTDIR)$(DRACUT_MODULES_DIR)/99asahi-firmware -+ install -m0755 -t $(DESTDIR)$(DRACUT_MODULES_DIR)/99asahi-firmware dracut/modules.d/99asahi-firmware/install-asahi-firmware.sh -+ install -m0755 -t $(DESTDIR)$(DRACUT_MODULES_DIR)/99asahi-firmware dracut/modules.d/99asahi-firmware/load-asahi-firmware.sh -+ install -m0755 -t $(DESTDIR)$(DRACUT_MODULES_DIR)/99asahi-firmware dracut/modules.d/99asahi-firmware/module-setup.sh - - install-arch: install install-mkinitcpio - install -m0755 -t $(DESTDIR)$(BIN_DIR)/ $(BUILD_ARCH_SCRIPTS) -diff --git a/dracut/10-asahi.conf b/dracut/dracut.conf.d/10-asahi.conf -similarity index 91% -rename from dracut/10-asahi.conf -rename to dracut/dracut.conf.d/10-asahi.conf -index 229e59f..39ce98b 100644 ---- a/dracut/10-asahi.conf -+++ b/dracut/dracut.conf.d/10-asahi.conf -@@ -23,3 +23,6 @@ add_drivers+=" rtc-macsmc simple-mfd-spmi spmi-apple-controller nvmem_spmi_mfd " - - # For MTP HID - add_drivers+=" apple-dockchannel dockchannel-hid apple-rtkit-helper " -+ -+# For Apple firmware -+add_dracutmodules+=" asahi-firmware " -diff --git a/dracut/modules.d/99asahi-firmware/install-asahi-firmware.sh b/dracut/modules.d/99asahi-firmware/install-asahi-firmware.sh -new file mode 100755 -index 0000000..f903862 ---- /dev/null -+++ b/dracut/modules.d/99asahi-firmware/install-asahi-firmware.sh -@@ -0,0 +1,12 @@ -+#!/bin/sh -+# SPDX-License-Identifier: MIT -+ -+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh -+ -+info ":: Asahi: Installing vendor firmware to root filesystem..." -+if [ ! -d /sysroot/lib/firmware/vendor ]; then -+ warn ":: Asahi: Vendor firmware directory missing on the root filesystem!" -+ return 1 -+fi -+mount -t tmpfs vendorfw /sysroot/lib/firmware/vendor -+cp -pr /vendorfw/* /vendorfw/.vendorfw.manifest /sysroot/lib/firmware/vendor -diff --git a/dracut/modules.d/99asahi-firmware/load-asahi-firmware.sh b/dracut/modules.d/99asahi-firmware/load-asahi-firmware.sh -new file mode 100755 -index 0000000..5b7f373 ---- /dev/null -+++ b/dracut/modules.d/99asahi-firmware/load-asahi-firmware.sh -@@ -0,0 +1,47 @@ -+#!/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 -+ -+if [ ! -e /proc/device-tree/chosen/asahi,efi-system-partition ]; then -+ info ":: Asahi: Missing asahi,efi-system-partition variable, firmware will not be loaded!" -+ return 0 -+fi -+ -+info ":: 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 -+ warn ":: Asahi: Timed out waiting for NVMe device" -+ return 1 -+fi -+ -+# If the above exists, hopefully the /dev device exists and this will work -+info ":: Asahi: Unpacking vendor firmware into initramfs..." -+ -+VENDORFW="/run/.system-efi/vendorfw/" -+ -+( -+ . /usr/share/asahi-scripts/functions.sh -+ mount_sys_esp /run/.system-efi -+) -+ -+if [ ! -e "$VENDORFW/firmware.cpio" ]; then -+ warn ":: Asahi: Vendor firmware not found in ESP." -+ umount /run/.system-efi -+ return 1 -+fi -+ -+( cd /; cpio -i < "$VENDORFW/firmware.cpio" ) -+info ":: Asahi firmware unpacked successfully" -diff --git a/dracut/modules.d/99asahi-firmware/module-setup.sh b/dracut/modules.d/99asahi-firmware/module-setup.sh -new file mode 100755 -index 0000000..15195bf ---- /dev/null -+++ b/dracut/modules.d/99asahi-firmware/module-setup.sh -@@ -0,0 +1,36 @@ -+#!/bin/sh -+# SPDX-License-Identifier: MIT -+ -+# called by dracut -+check() { -+ if [ -n "$hostonly" ] && [ ! -e /proc/device-tree/chosen/asahi,efi-system-partition ]; then -+ return 0 -+ elif [ -z "$hostonly" ]; then -+ return 0 -+ else -+ return 255 -+ fi -+} -+ -+# called by dracut -+depends() { -+ echo fs-lib -+ return 0 -+} -+ -+# called by dracut -+installkernel() { -+ instmods apple-mailbox nvme-apple -+} -+ -+# called by dracut -+install() { -+ inst_dir "/lib/firmware" -+ ln_r "/lib/firmware/vendor" "/vendorfw" -+ asahiscriptsdir="/usr/share/asahi-scripts" -+ inst_dir $asahiscriptsdir -+ $DRACUT_CP -R -L -t "${initdir}/${asahiscriptsdir}" "${dracutsysrootdir}${asahiscriptsdir}"/* -+ inst_multiple cpio cut dirname modprobe mount seq sleep umount -+ inst_hook pre-udev 10 "${moddir}/load-asahi-firmware.sh" -+ inst_hook cleanup 99 "${moddir}/install-asahi-firmware.sh" -+} diff --git a/sources b/sources index bf6ba3f..46303e9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (asahi-scripts-20221027.tar.gz) = c3a323820fb457dde53ceff5904e18a4f34d1e8cb7c0b85ce10a02d2693baf6dc2ba73efebed55f9a3b36d55ed073fad28aee788ecb19b66703bdb5c36566255 +SHA512 (asahi-scripts-20250713.tar.gz) = cb94711a556e4b8b4e171540d7026f93ad03afe3a359e8888bc63c09a17d521af1da3299fd3af89ad1fd3c3cb55b0b508ae307b4a9dacb48d45bbdfa50e4f767 diff --git a/update-m1n1.sysconfig b/update-m1n1.sysconfig index 6d440e5..68b20fb 100644 --- a/update-m1n1.sysconfig +++ b/update-m1n1.sysconfig @@ -1,3 +1,4 @@ M1N1="/usr/lib64/m1n1/m1n1.bin" U_BOOT="/usr/share/uboot/apple_m1/u-boot-nodtb.bin" -DTBS=/boot/dtb-*/apple/* +# limit DTBS to Mx and Mx Pro/Max/Ultra +DTBS="/boot/dtb"