-
Notifications
You must be signed in to change notification settings - Fork 75
Description
How to Install Kernel 6.17 and Fix Sound on Macs (Cirrus CS8409) Running Linux
If you run Linux on a Mac from 2017 or later (iMac or MacBook Pro), getting internal speakers to work is a known challenge. The community-standard driver, snd_hda_macbookpro (maintained by davidjo), works wonders on LTS kernels.
However, users seeking the latest hardware support often upgrade to newer kernels (like 6.17 via Debian Backports). Doing so usually breaks the audio driver installation because the build process fails on modern GCC versions with errors like incompatible-pointer-types.
This guide covers Part 1: Installing Kernel 6.17 from Trixie Backports and Part 2: Forcing the Audio Driver to compile on this new kernel.
Tested Environment: LMDE 7 (Debian Trixie base).
Part 1: Installing Kernel 6.17 (Trixie Backports)
Warning: Installing packages from "testing" or future backports (Trixie) on a stable system (Bookworm/LMDE 7) is an advanced procedure. Proceed with caution.
1. Add the Repository
First, ensure your system knows where to find the newer kernel packages. We need to add the trixie-backports repository source.
Open your terminal and run the following command to create a new source list file:
echo "deb http://deb.debian.org/debian trixie-backports main contrib non-free-firmware" | sudo tee /etc/apt/sources.list.d/trixie-backports.list
Now, update your package list:
sudo apt update
2. Install the Kernel and Headers
Run the following command to install the kernel image, headers (crucial for compiling drivers later), source, and updated firmware.
sudo apt install -t trixie-backports linux-headers-6.17.8+deb13-amd64 linux-source-6.17 linux-image-6.17.8+deb13-amd64 firmware-linux firmware-linux-nonfree
Note: This download might be large. After the installation completes, reboot your computer and select the new kernel (6.17) from the GRUB menu before proceeding to Part 2.
Part 2: Fixing the Audio Driver (CS8409)
Now that you are booting with Kernel 6.17, you likely lost your audio. If you try to install the driver normally, it will fail. Here is how to fix it using DKMS.
1. Prerequisites
Ensure you have the necessary build tools.
sudo apt install git dkms build-essential
2. Clean Up Previous Attempts
If you tried to install the audio driver before and failed, clean up the state to avoid conflicts.
# Remove the module from the DKMS tree
sudo dkms remove snd_hda_macbookpro/1.0 --all 2>/dev/null || true
# Remove the source files from the system
sudo rm -rf /usr/src/snd_hda_macbookpro-1.0
3. Download and Prepare Source Code
We need to clone the driver repository and set it up in the specific directory structure that DKMS expects.
cd ~/Downloads
git clone https://github.com/davidjo/snd_hda_macbookpro.git
cd snd_hda_macbookpro
# Create the system source directory and copy files
sudo mkdir -p /usr/src/snd_hda_macbookpro-1.0
sudo cp -r ./* /usr/src/snd_hda_macbookpro-1.0/
# Make the pre-build script executable
sudo chmod +x /usr/src/snd_hda_macbookpro-1.0/install.cirrus.driver.sh
4. The Fix (Configuring dkms.conf)
This is the critical step. We need to override the MAKE command to inject specific flags (-Wno-error, etc.) that tell the compiler to ignore non-critical code style mismatches typical in GCC 14+.
Edit the configuration file:
sudo nano /usr/src/snd_hda_macbookpro-1.0/dkms.conf
Delete the existing content and paste the following configuration block:
PACKAGE_NAME="snd_hda_macbookpro"
PACKAGE_VERSION="1.0"
# The script prepares the environment (downloads sources and applies patches)
PRE_BUILD="install.cirrus.driver.sh -k $kernelver"
# CUSTOM MAKE COMMAND
# 1. Explicitly defines KERNELRELEASE.
# 2. Injects CFLAGS_MODULE to disable fatal errors for harmless warnings.
MAKE="make KERNELRELEASE=${kernelver} KDIR=/lib/modules/${kernelver}/build M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/build/hda CFLAGS_MODULE='-DAPPLE_PINSENSE_FIXUP -DAPPLE_CODECS -DCONFIG_SND_HDA_RECONFIG=1 -Wno-unused-variable -Wno-unused-function -Wno-error -Wno-incompatible-pointer-types'"
# The name of the generated module
BUILT_MODULE_NAME[0]="snd-hda-codec-cs8409"
# Correct location where the .ko file is actually built
BUILT_MODULE_LOCATION[0]="build/hda/codecs/cirrus"
# Installation path
DEST_MODULE_LOCATION[0]="/updates/codecs/cirrus"
AUTOINSTALL="yes"
Press Ctrl+O to save and Ctrl+X to exit.
5. Build and Install
Add the module to DKMS and force the installation.
# Add the module to the tree
sudo dkms add -m snd_hda_macbookpro -v 1.0
# Build and Install (use --force to overwrite any old files)
sudo dkms install -m snd_hda_macbookpro -v 1.0 --force --verbose
If successful, you should see the message: DKMS: install completed.
6. Finish Up
Update your module dependencies and reboot one last time.
sudo depmod -a
sudo reboot
After rebooting, check if the module is loaded with lsmod | grep cs8409. Your internal speakers should now be working perfectly on Kernel 6.17!
License Gpl v2.0
original tutorial is here https://medium.com/@ranquetat/how-to-install-kernel-6-17-and-fix-sound-on-macs-cirrus-cs8409-running-linux-8641c1cf4d98?postPublishedType=initial