Compare commits

...
Sign in to create a new pull request.

52 commits

Author SHA1 Message Date
Fedora Release Engineering
a2ad8aace3 Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild 2026-01-16 03:57:03 +00:00
Janne Grunau
b1b17e6f4e Update 15-update-m1n1.install
- has to run on generic aarch64 systems for install image generation,
  should probably always run if the installed kernel is an aarch64
  kernel
- add a note on the "10-devicetree.install" (grubby) dependency
2025-08-19 23:39:31 +02:00
Janne Grunau
eb78052afd Fix update-m1n1 invocation from kernel-install add ...
At the time kernel-install runs 15-update-m1n1.install "/boot/dtb" might
be a dangling symlink as /boot/dtb-${KERNEL_VERSION} has not yet been
created.
Take advantage of the proposed $DTBS directory support [1] and use
"/boot/dtb" as DTBS default location.
Add an fedora specific patch to detect the dangling symlink and use the
dtb directory from the kernel's modules directory in /usr/lib/modules.

1: https://github.com/AsahiLinux/asahi-scripts/pull/67
2025-08-19 23:16:25 +02:00
Janne Grunau
8e7ac9580a Fix typos in update-m1n1 kernel install script 2025-08-18 09:10:03 +02:00
Fedora Release Engineering
2f5f6f8562 Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-23 17:16:00 +00:00
Davide Cavalca
65b4ede499 Update to 20250713 2025-07-13 19:00:49 -07:00
Davide Cavalca
49e26631ee Preserve timestamps when installing the kernel-install script 2025-07-13 19:00:27 -07:00
Janne Grunau
6507e7f0a2 update-m1n1: Use kernel-install script instead of filetrigger for dtb updates
This has various advantages:
- a failure can prevent kernel-install to create a boot loader entry
  which in the worst case won't boot due to a 2nd stage m1n1 dtbs vs.
  kernel mismatch
- It would allow to replicate the logic in grubby's
  10-devicetree.install to avoid the dependency and work without
  /boot/dtb symlink. This would simplify the integration for immutable
  Fedora-Asahi-Remix variants.
- it is easier to discover as /usr/lib/kernel/install.d is the expected
  place for scripts to trigger during kernel installation/removal.
- It ensures update-m1n1 runs after the symlink is updated. The ordering
  between the filetrigger and kernel-install during package updates is
  not obviously clear.

There is no rollback mechanism if the kernel-install fails but this
should not differ from the filetrigger.
2025-07-13 23:36:58 +02:00
Janne Grunau
5f59936d3c update-m1n1: Depend on grubby for the /boot/dtb symlink 2025-07-13 23:36:58 +02:00
Davide Cavalca
dfca4e0e1a Own the macsmc-battery config file 2025-05-30 19:38:56 -07:00
Davide Cavalca
22d55c4391 Update to 20250426.1; Fixes: RHBZ#2293832 2025-04-26 15:35:20 -07:00
Davide Cavalca
aef3d9127c Trigger update-m1n1 on config changes 2025-04-16 14:51:55 -07:00
Hector Martin
9c406f8ce9 Give up on the obsoletes dance
This didn't work with dnf.

Drop /etc/m1n1.conf entirely, let users copy it from the example file in
the m1n1 package if they wish.
2025-02-04 04:26:24 +09:00
Hector Martin
7b9c0fa3a0 Argh. 2025-02-03 21:55:18 +09:00
Hector Martin
c1ad434f96 Fix dependencies again?
Third time's the charm, maybe?
2025-02-03 21:54:28 +09:00
Hector Martin
98044933e6 Fix dependencies 2025-02-03 21:40:40 +09:00
Hector Martin
e4e1bf166e Update to 20250130
Moves /etc/m1n1.conf from this package to m1n1.
2025-01-30 23:59:17 +09:00
Davide Cavalca
a425a997a2 Drop expired obsoletes 2025-01-29 09:13:34 +00:00
Hector Martin
9d0aa9aa67 Update to 20250128 2025-01-28 21:06:45 +09:00
Janne Grunau
376fa841fb update-m1n1: limit config to DTBs Mx (Pro/Max/Ultra) based devices 2025-01-28 12:05:05 +00:00
Fedora Release Engineering
1f02188ff7 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-16 11:36:38 +00:00
Janne Grunau
bc19f28cac Add missing build requirement systemd-rpm-macros for asahi-battery 2024-08-22 20:09:49 +02:00
Janne Grunau
83bc7c1259 Add missed .gitignore update for asahi-scripts-20240822 2024-08-22 19:52:50 +02:00
Janne Grunau
6b86b9e824 Update to 20240822
new package asahi-battery to restore non-persistent EC settings on boot
2024-08-22 19:24:43 +02:00
Fedora Release Engineering
389a477dc7 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-17 17:29:17 +00:00
Davide Cavalca
4d865a3049 Update to 20240429 2024-04-29 08:42:49 -07:00
Janne Grunau
584aefbe35 Add dracut kernel mod robustness patches, try 2
https://github.com/AsahiLinux/asahi-scripts/pull/46
2024-04-25 00:28:54 +02:00
Janne Grunau
1a04eb849b Add dracut kernel mod robustness patches
https://github.com/AsahiLinux/asahi-scripts/pull/45
2024-04-24 19:35:49 +02:00
Janne Grunau
8126e28398 Update to 20240411
Fixes: RHBZ#2245220
2024-04-18 08:57:03 +02:00
Fedora Release Engineering
19f0854961 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-22 23:29:48 +00:00
Fedora Release Engineering
d10ec15f5d Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-19 13:35:52 +00:00
Hector Martin
e3c72c4134 Update to 20231219.1 2023-12-19 19:47:18 +09:00
Hector Martin
3d211eaaea Update to 20231219 2023-12-19 19:06:53 +09:00
Hector Martin
572a1c3ac1 Update to 20231218 2023-12-17 22:45:39 +09:00
Hector Martin
d515f8386d Update to 20231217 2023-12-17 22:15:46 +09:00
Davide Cavalca
21dad697e2 Fix trigger for asahi-fwupdate 2023-10-11 16:25:43 -07:00
Davide Cavalca
bbfbd00175 Update to 20230821 2023-08-21 07:48:59 -07:00
Davide Cavalca
3b58fb7eaa Rework and fix file triggers 2023-08-03 14:04:35 +01:00
Neal Gompa
49e166feb1 Revert "Use stable dtbs path to always pick the latest"
This breaks the upgrade path in practice. It does not fire correctly
because /boot/dtb is a symlink and does not actually contain files.

This partly reverts commit 5dd80aff06.
2023-07-30 10:17:43 -04:00
Davide Cavalca
5dd80aff06 Use stable dtbs path to always pick the latest 2023-07-24 15:16:47 -07:00
Fedora Release Engineering
4967ed0c71 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-19 13:48:21 +00:00
Davide Cavalca
42d00c5dcb Expand fwupdate trigger to fire on fwextract updates 2023-06-18 18:06:29 +02:00
Davide Cavalca
efb07d58b3 Add trigger for asahi-fwupdate 2023-06-09 09:10:17 -07:00
Davide Cavalca
2e39d0ebfc Fix Requires for asahi-fwupdate 2023-06-08 10:02:33 -07:00
Davide Cavalca
695f66dc6a Rename asahi-fwextract to asahi-fwupdate to match upstream 2023-06-07 14:36:25 -07:00
Davide Cavalca
f589e123c0 Update to 20230606; Fixes: RHHBZ#2213093 2023-06-07 14:18:08 -07:00
Davide Cavalca
d8b114bef9 Update to 20230530; Fixes: RHBZ#2209183 2023-05-30 16:56:16 -07:00
Davide Cavalca
7dd1c9a2c8 Update to 20221220; Fixes: RHBZ#2155355 2023-05-06 15:49:06 -07:00
Fedora Release Engineering
0cc949eba1 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-18 22:10:11 +00:00
Davide Cavalca
3483812dd2 Update to 20221206; Fixes: RHBZ#2151445 2022-12-09 03:00:59 +00:00
Davide Cavalca
84cf42d014 Update to 20221129; Fixes: RHBZ#2149785 2022-12-04 10:12:08 -08:00
Davide Cavalca
88e1b77ca7 Update to 20221122; Fixes: RHBZ#2145036 2022-11-26 08:45:00 -08:00
12 changed files with 165 additions and 418 deletions

19
.gitignore vendored
View file

@ -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

View file

@ -0,0 +1,35 @@
From 5fb7712c7c2692b77c21a6d799db29f6cefb388f Mon Sep 17 00:00:00 2001
From: Janne Grunau <j@jannau.net>
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 <j@jannau.net>
---
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

View file

@ -0,0 +1,36 @@
From d24ee482717237afbf6cbbbabbd0dd4eea772f8a Mon Sep 17 00:00:00 2001
From: Janne Grunau <j@jannau.net>
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 <j@jannau.net>
---
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

22
15-update-m1n1.install Normal file
View file

@ -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

View file

@ -1,85 +0,0 @@
From 594967c090cd7c64ee7e8bdb1bc0696f00e4a3ec Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@fedoraproject.org>
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 <ngompa@fedoraproject.org>
---
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

View file

@ -1,23 +0,0 @@
From 780b7f21f8dc002a3a073b34036291655af7dd38 Mon Sep 17 00:00:00 2001
From: Davide Cavalca <dcavalca@fedoraproject.org>
Date: Mon, 31 Oct 2022 21:39:29 -0700
Subject: [PATCH] asahi-fwextract: fix overzealous quoting
Signed-off-by: Davide Cavalca <dcavalca@fedoraproject.org>
---
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"

View file

@ -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

View file

@ -1,79 +0,0 @@
From c749ccaa5d9b16d49b8ae49052f14c5838917cd7 Mon Sep 17 00:00:00 2001
From: Davide Cavalca <dcavalca@fedoraproject.org>
Date: Mon, 19 Sep 2022 14:09:57 +0200
Subject: [PATCH] Add asahi-fwextract script
Signed-off-by: Davide Cavalca <dcavalca@fedoraproject.org>
---
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

View file

@ -1,24 +0,0 @@
From f67757c036dd16334ec1fd3b8463e66667e71269 Mon Sep 17 00:00:00 2001
From: Hector Martin <marcan@marcan.st>
Date: Fri, 4 Nov 2022 10:00:39 +0900
Subject: [PATCH] dracut: Fix symlink direction
Fixes: #16
Signed-off-by: Hector Martin <marcan@marcan.st>
---
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}"/*

View file

@ -1,181 +0,0 @@
From f933d5510543e8adeb215c450b1002910fecdde7 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@fedoraproject.org>
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 <ngompa@fedoraproject.org>
---
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"
+}

View file

@ -1 +1 @@
SHA512 (asahi-scripts-20221027.tar.gz) = c3a323820fb457dde53ceff5904e18a4f34d1e8cb7c0b85ce10a02d2693baf6dc2ba73efebed55f9a3b36d55ed073fad28aee788ecb19b66703bdb5c36566255
SHA512 (asahi-scripts-20250713.tar.gz) = cb94711a556e4b8b4e171540d7026f93ad03afe3a359e8888bc63c09a17d521af1da3299fd3af89ad1fd3c3cb55b0b508ae307b4a9dacb48d45bbdfa50e4f767

View file

@ -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"