Files
omarchy/install/config/hardware/fix-apple-t2.sh
2025-09-28 00:41:37 -04:00

50 lines
1.6 KiB
Bash

OMARCHY_DESCRIPTION="Apple T2 MacBook Support"
# Detect T2 MacBook models using PCI IDs: 106b:1801 or 106b:1802
should_run() {
lspci -nn | grep -q "106b:180[12]"
}
# Installation function
omarchy_install() {
should_run || return 0
echo "Detected MacBook with T2 chip. Installing support items..."
sudo pacman -S --noconfirm --needed \
linux-t2 \
linux-t2-headers \
apple-t2-audio-config \
apple-bcm-firmware \
t2fanrd \
tiny-dfr
echo "apple-bce" | sudo tee /etc/modules-load.d/t2.conf >/dev/null
echo "MODULES+=(apple-bce usbhid hid_apple hid_generic xhci_pci xhci_hcd)" | sudo tee /etc/mkinitcpio.conf.d/apple-t2.conf >/dev/null
cat <<EOF | sudo tee /etc/modprobe.d/brcmfmac.conf >/dev/null
# Fix for T2 MacBook WiFi connectivity issues
options brcmfmac feature_disable=0x82000
EOF
sudo mkdir -p /etc/limine-entry-tool.d
cat <<EOF | sudo tee /etc/limine-entry-tool.d/t2-mac.conf >/dev/null
# Generated by Omarchy installer for T2 Mac support
KERNEL_CMDLINE[default]+="intel_iommu=on iommu=pt pcie_ports=compat"
EOF
}
# Verification function
omarchy_verify() {
should_run || return 2
pacman -Q linux-t2 &>/dev/null || add_error "T2 Linux kernel not installed"
# Check if config files exist
[[ -f /etc/modules-load.d/t2.conf ]] || add_error "T2 modules config missing"
[[ -f /etc/mkinitcpio.conf.d/apple-t2.conf ]] || add_error "T2 mkinitcpio config missing"
[[ -f /etc/modprobe.d/brcmfmac.conf ]] || add_error "T2 WiFi fix config missing"
[[ -f /etc/limine-entry-tool.d/t2-mac.conf ]] || add_error "T2 boot config missing"
}