Compare commits

..

12 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
7 changed files with 113 additions and 4 deletions

3
.gitignore vendored
View file

@ -19,3 +19,6 @@
/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,5 +1,5 @@
Name: asahi-scripts
Version: 20250130
Version: 20250713
Release: %autorelease
Summary: Miscellaneous admin scripts for Asahi Linux
@ -7,6 +7,10 @@ License: MIT
URL: https://github.com/AsahiLinux/asahi-scripts
Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Source: update-m1n1.sysconfig
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
@ -18,6 +22,7 @@ Requires: bash
Requires: coreutils
Requires: grep
Requires: sed
Requires: systemd-udev
Requires: util-linux-core
%description
@ -59,6 +64,9 @@ 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.
@ -88,6 +96,8 @@ on system start.
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 asahi-fwupdate -- %{_sbindir}/asahi-fwupdate %{_bindir}/asahi-fwextract
%{_sbindir}/asahi-fwupdate || :
@ -97,13 +107,14 @@ install -Dpm0644 %SOURCE1 %{buildroot}%{_sysconfdir}/sysconfig/update-m1n1
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 /boot/dtb-
%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-fwupdate
%license LICENSE
@ -122,12 +133,14 @@ grep -q 'asahi_firmware' && %{_sbindir}/asahi-fwupdate || :
%files -n update-m1n1
%license LICENSE
%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 +1 @@
SHA512 (asahi-scripts-20250130.tar.gz) = 87052bc66c74d616021abe1a62481800e11a6a73889717d02bc581e723915ba8c8ffced4e17b53d35e33d2bf85e91d1c9c1a2dca462ceb62ac88d736fba5d9ee
SHA512 (asahi-scripts-20250713.tar.gz) = cb94711a556e4b8b4e171540d7026f93ad03afe3a359e8888bc63c09a17d521af1da3299fd3af89ad1fd3c3cb55b0b508ae307b4a9dacb48d45bbdfa50e4f767

View file

@ -1,4 +1,4 @@
M1N1="/usr/lib64/m1n1/m1n1.bin"
U_BOOT="/usr/share/uboot/apple_m1/u-boot-nodtb.bin"
# limit DTBS to Mx and Mx Pro/Max/Ultra
DTBS="/boot/dtb/apple/t6*.dtb /boot/dtb/apple/t81*.dtb"
DTBS="/boot/dtb"