Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions install/hardware/apple/fix-spi-keyboard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ if [[ $product_name =~ MacBook[89],1|MacBook1[02],1|MacBookPro13,[123]|MacBookPr
if [[ $product_name == "MacBook8,1" ]]; then
echo "MODULES=(applespi spi_pxa2xx_platform spi_pxa2xx_pci)" | \
sudo tee /etc/mkinitcpio.conf.d/macbook_spi_modules.conf >/dev/null

# The Wildcat Point GSPI controller (00:15.4) does transfers through the
# companion DesignWare DMA engine (00:15.0). On this board those DMA
# transfers never complete: applespi times out with -110 and IRQ 21 stays
# at zero. dw_dmac_pci is builtin, so it cannot be blacklisted as a module.
# Blacklisting its initcall forces spi-pxa2xx into PIO, which works.
# Deep/S3 sleep then wedges the same SPI device until reboot; s2idle does not.
sudo mkdir -p /etc/limine-entry-tool.d
sudo tee /etc/limine-entry-tool.d/macbook81-spi-pio.conf >/dev/null <<'EOF'
# MacBook8,1: DesignWare DMA never completes GSPI transfers.
KERNEL_CMDLINE[default]+=" initcall_blacklist=dw_pci_driver_init mem_sleep_default=s2idle"
EOF
else
echo "MODULES=(applespi intel_lpss_pci spi_pxa2xx_platform)" | \
sudo tee /etc/mkinitcpio.conf.d/macbook_spi_modules.conf >/dev/null
Expand Down
2 changes: 2 additions & 0 deletions manual/44-mac-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ It is necessary to disable Apple's Secure Boot in order to boot the bootable USB

The installer detects Mac hardware and applies the needed fixes automatically: Broadcom Wi-Fi drivers and firmware, the SPI keyboard driver on the MacBook models that need it, and an NVMe suspend fix for those same models.

The 12-inch Early 2015 (MacBook8,1) needs a USB keyboard for the installer itself. After the first reboot the built-in keyboard and trackpad work: DMA on that board never completes SPI transfers, so the installer forces the controller into PIO and defaults sleep to s2idle.

### Known Limitations

Members of the community are constantly working on solutions to these challenges so if these are problematic for you, join #omarchy-on-other in our [Discord](https://discord.gg/tXFUdasqhY) and see if there's any up-to-date methods for resolving these.
Expand Down
51 changes: 51 additions & 0 deletions migrations/1788318101.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
echo "Force SPI PIO on MacBook8,1 so the built-in keyboard works"

# The install-time leaf already loads applespi for this model, but that is not
# enough: DesignWare DMA on 00:15.0 never completes GSPI transfers, so the
# keyboard and trackpad time out until the controller is forced into PIO.
# See install/hardware/apple/fix-spi-keyboard.sh.
product="${OMARCHY_MACBOOK81_DMI_PRODUCT:-/sys/class/dmi/id/product_name}"
limine_conf="${OMARCHY_MACBOOK81_LIMINE_CONF:-/etc/limine-entry-tool.d/macbook81-spi-pio.conf}"
repair_marker="${OMARCHY_MACBOOK81_REPAIR_MARKER:-/var/lib/omarchy/migrations/1788318101}"
running_cmdline="${OMARCHY_MACBOOK81_RUNNING_CMDLINE:-/proc/cmdline}"

product_name="$(cat "$product" 2>/dev/null || true)"
if [[ $product_name != "MacBook8,1" ]]; then
exit 0
fi

needs_limine_rebuild=0

if [[ ! -f $limine_conf ]] || ! grep -q 'initcall_blacklist=dw_pci_driver_init' "$limine_conf"; then
sudo mkdir -p "$(dirname "$limine_conf")"
sudo tee "$limine_conf" >/dev/null <<'EOF'
# MacBook8,1: DesignWare DMA never completes GSPI transfers.
KERNEL_CMDLINE[default]+=" initcall_blacklist=dw_pci_driver_init mem_sleep_default=s2idle"
EOF
needs_limine_rebuild=1
fi

# The current kernel keeps its old command line until reboot. Record a
# successful machine-wide rebuild so another user's migration does not repeat
# it before then, while a missing marker still retries an interrupted rebuild.
if [[ -f $limine_conf ]] &&
[[ ! -e $repair_marker ]] &&
grep -q 'initcall_blacklist=dw_pci_driver_init' "$limine_conf" &&
{ [[ ! -r $running_cmdline ]] ||
! grep -Eq '(^| )initcall_blacklist=dw_pci_driver_init( |$)' "$running_cmdline"; }; then
needs_limine_rebuild=1
fi

if (( needs_limine_rebuild )); then
rebuild_log=$(mktemp)
trap 'rm -f "$rebuild_log"' EXIT
sudo limine-mkinitcpio 2>&1 | tee "$rebuild_log"

# limine-mkinitcpio reports a kernel it could not rebuild and still exits 0.
# Without the marker, this migration stays pending and retries.
if grep -q 'mkinitcpio failed for kernel' "$rebuild_log"; then
echo "Could not rebuild the boot image; this migration stays pending." >&2
exit 1
fi
sudo install -Dm644 /dev/null "$repair_marker"
fi
2 changes: 1 addition & 1 deletion test/shell.d/hardware-quirks-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ while IFS='|' read -r leaf name want; do
[[ $got == "$want" ]] || fail "install/$leaf on $name: $want" "got: $got"
done <<'ROWS'
hardware/apple/fix-spi-keyboard.sh|macbookpro13|0|pkg-add macbook12-spi-driver-dkms|wrote etc/mkinitcpio.conf.d/macbook_spi_modules.conf
hardware/apple/fix-spi-keyboard.sh|macbook8|0|pkg-add macbook12-spi-driver-dkms|wrote etc/mkinitcpio.conf.d/macbook_spi_modules.conf
hardware/apple/fix-spi-keyboard.sh|macbook8|0|pkg-add macbook12-spi-driver-dkms|wrote etc/mkinitcpio.conf.d/macbook_spi_modules.conf|wrote etc/limine-entry-tool.d/macbook81-spi-pio.conf
hardware/apple/fix-spi-keyboard.sh|macbookpro13+unreadable|0
hardware/apple/fix-spi-keyboard.sh|macbookpro15|0
hardware/fix-synaptic-touchpad.sh|synaptics|0|modprobe psmouse synaptics_intertouch=1
Expand Down