Add dracut kernel mod robustness patches

https://github.com/AsahiLinux/asahi-scripts/pull/45
This commit is contained in:
Janne Grunau 2024-04-24 19:35:49 +02:00
commit 1a04eb849b
4 changed files with 127 additions and 0 deletions

View file

@ -0,0 +1,62 @@
From 3409a3f32b1eaeedbcec6dfca8026288c2da22e5 Mon Sep 17 00:00:00 2001
From: Janne Grunau <j@jannau.net>
Date: Wed, 24 Apr 2024 19:06:31 +0200
Subject: [PATCH 1/3] dracut: conf: Use "drivers" instead of "add_drivers"
The only difference between those to variables is that "add_drivers"
checks for the existance of the module and fails to process further
modules. This is however just logged and not a fatal error for the
initramfs creation. So the verification is worse than useless.
No verification is done for 'drivers' so we can use that even to handle
the i2c module rename in Linux 6.8.6.
Fixes: f444f0a ("dracut: conf: Fix i2c module name")
Signed-off-by: Janne Grunau <j@jannau.net>
---
dracut/dracut.conf.d/10-asahi.conf | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/dracut/dracut.conf.d/10-asahi.conf b/dracut/dracut.conf.d/10-asahi.conf
index 8be5f83..215b186 100644
--- a/dracut/dracut.conf.d/10-asahi.conf
+++ b/dracut/dracut.conf.d/10-asahi.conf
@@ -1,28 +1,28 @@
# Modules necessary for using Linux on Apple Silicon Macs
# For NVMe & SMC
-add_drivers+=" apple-mailbox "
+drivers+=" apple-mailbox "
# For NVMe
-add_drivers+=" nvme_apple "
+drivers+=" nvme_apple "
# For USB and HID
-add_drivers+=" pinctrl-apple-gpio "
+drivers+=" pinctrl-apple-gpio "
# SMC core
-add_drivers+=" macsmc macsmc-rtkit "
+drivers+=" macsmc macsmc-rtkit "
# For USB
-add_drivers+=" i2c-pasemi-platform tps6598x apple-dart dwc3 dwc3-of-simple nvmem-apple-efuses phy-apple-atc xhci-plat-hcd xhci-pci pcie-apple gpio_macsmc "
+drivers+=" i2c-pasemi-platform tps6598x apple-dart dwc3 dwc3-of-simple nvmem-apple-efuses phy-apple-atc xhci-plat-hcd xhci-pci pcie-apple gpio_macsmc "
# For HID
-add_drivers+=" spi-apple spi-hid-apple spi-hid-apple-of "
+drivers+=" spi-apple spi-hid-apple spi-hid-apple-of "
# For RTC
-add_drivers+=" rtc-macsmc simple-mfd-spmi spmi-apple-controller nvmem_spmi_mfd "
+drivers+=" rtc-macsmc simple-mfd-spmi spmi-apple-controller nvmem_spmi_mfd "
# For MTP HID
-add_drivers+=" apple-dockchannel dockchannel-hid apple-rtkit-helper "
+drivers+=" apple-dockchannel dockchannel-hid apple-rtkit-helper "
# dwc3 instantiates xHCI asynchronously. To make things like init=/bin/sh work where udev is no longer running, force load this one.
force_drivers+=" xhci-plat-hcd "
--
2.44.0

View file

@ -0,0 +1,32 @@
From aad5e9f8a98e62ec19761e9685797f24713c2c21 Mon Sep 17 00:00:00 2001
From: Janne Grunau <j@jannau.net>
Date: Wed, 24 Apr 2024 19:14:07 +0200
Subject: [PATCH 2/3] dracut: conf: Include i2c-apple as installed kernel
module
Now that kernel modules are optional we can include both i2c-apple and
i2c-pasemi-platform.
Fixes: f444f0a ("dracut: conf: Fix i2c module name")
Signed-off-by: Janne Grunau <j@jannau.net>
---
dracut/dracut.conf.d/10-asahi.conf | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dracut/dracut.conf.d/10-asahi.conf b/dracut/dracut.conf.d/10-asahi.conf
index 215b186..f7f0bb0 100644
--- a/dracut/dracut.conf.d/10-asahi.conf
+++ b/dracut/dracut.conf.d/10-asahi.conf
@@ -13,7 +13,8 @@ drivers+=" pinctrl-apple-gpio "
drivers+=" macsmc macsmc-rtkit "
# For USB
-drivers+=" i2c-pasemi-platform tps6598x apple-dart dwc3 dwc3-of-simple nvmem-apple-efuses phy-apple-atc xhci-plat-hcd xhci-pci pcie-apple gpio_macsmc "
+# add both i2c-apple and i2c-pasemi-platform since Linux 6.8 renamed the module
+drivers+=" i2c-apple i2c-pasemi-platform tps6598x apple-dart dwc3 dwc3-of-simple nvmem-apple-efuses phy-apple-atc xhci-plat-hcd xhci-pci pcie-apple gpio_macsmc "
# For HID
drivers+=" spi-apple spi-hid-apple spi-hid-apple-of "
--
2.44.0

View file

@ -0,0 +1,28 @@
From 3e2d9b9adfd83fa3ee6b8ff66266893cd06e7d68 Mon Sep 17 00:00:00 2001
From: Janne Grunau <j@jannau.net>
Date: Wed, 24 Apr 2024 19:20:39 +0200
Subject: [PATCH 3/3] dracut: conf: Add additional drivers for M2* HDMI
displays
Signed-off-by: Janne Grunau <j@jannau.net>
---
dracut/dracut.conf.d/10-asahi.conf | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dracut/dracut.conf.d/10-asahi.conf b/dracut/dracut.conf.d/10-asahi.conf
index f7f0bb0..c2e5b4d 100644
--- a/dracut/dracut.conf.d/10-asahi.conf
+++ b/dracut/dracut.conf.d/10-asahi.conf
@@ -25,6 +25,9 @@ drivers+=" rtc-macsmc simple-mfd-spmi spmi-apple-controller nvmem_spmi_mfd "
# For MTP HID
drivers+=" apple-dockchannel dockchannel-hid apple-rtkit-helper "
+# For display (DPTX and DP audio)
+drivers+=" mux-apple-display-crossbar phy-apple-dptx apple-sio "
+
# dwc3 instantiates xHCI asynchronously. To make things like init=/bin/sh work where udev is no longer running, force load this one.
force_drivers+=" xhci-plat-hcd "
--
2.44.0

View file

@ -8,6 +8,11 @@ URL: https://github.com/AsahiLinux/asahi-scripts
Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Source: update-m1n1.sysconfig
# Patches to make dracut's kernel module handling robust against missing modules
Patch01: 0001-dracut-conf-Use-drivers-instead-of-add_drivers.patch
Patch02: 0002-dracut-conf-Include-i2c-apple-as-installed-kernel-mo.patch
Patch03: 0003-dracut-conf-Add-additional-drivers-for-M2-HDMI-displ.patch
BuildArch: noarch
BuildRequires: make