Skip to content

Add snd-hda-macbookpro-dkms for pre-T2 MacBook and iMac speakers - #249

Open
j7j7 wants to merge 3 commits into
omacom:masterfrom
j7j7:apple-cs8409-imac
Open

j7j7 wants to merge 3 commits into
omacom:masterfrom
j7j7:apple-cs8409-imac

Conversation

@j7j7

@j7j7 j7j7 commented Sep 1, 2026

Copy link
Copy Markdown

Summary

Pins commit 6c324f6 (verified on MacBookPro14,3 / linux 7.1.8). Same Apple CS8409 path applies to iMacs such as iMac18,3 (subsystem 0x106b1000).

source: local so an AUR sync does not replace it. Provides/conflicts with snd-hda-macbookpro-dkms-git.

Test plan

  • Package builds in omarchy-pkgs pipeline
  • On a CS8409 Mac: omarchy-pkg-add linux-headers snd-hda-macbookpro-dkms → DKMS install succeeds → reboot → speakers work

Can close #155 in favor of this once reviewed.

Made with Cursor

shawnyeager and others added 3 commits September 1, 2026 08:31
In-tree snd_hda_codec_cs8409 leaves the MAX98706/SSM3515/TAS5764L
amps unprogrammed. Pin davidjo's driver at the commit verified on
MacBookPro14,3 / linux 7.1.8, and ship the full tree so PRE_BUILD
can fetch kernel sources (wget + patch).
Arch's alpm hook parses /usr/src/<name>-<ver> and runs
`dkms install <name>/<ver>`. A hyphen dest made that
snd-hda-macbookpro/0.1, which exits 7 because dkms.conf
PACKAGE_NAME is snd_hda_macbookpro. Pair hook
omarchy-pkg-add relies on the hook succeeding.
Same CS8409 Apple path as the MacBook Pros; pairs with the omarchy
install hook that now also matches iMac18,x / iMac19,x.

Co-authored-by: Cursor <[email protected]>
@ari-ahm

ari-ahm commented Sep 2, 2026 •

Copy link
Copy Markdown

Heads-up on PRE_BUILD before this lands, because as written it ships a
~151 MB download to every affected user on every kernel update.

package() copies the whole tree and removes only .git and build/, so
upstream's dkms.conf ships verbatim — including:

PRE_BUILD="install.cirrus.driver.sh -k $kernelver --dkms"

That script is what wget is a dependency for:

wget -c https://cdn.kernel.org/pub/linux/kernel/v$major_version.x/linux-$kernel_version.tar.xz -P $build_dir

For linux-7.1.9 that's 158,435,316 bytes, of which it uses 2,490,543 — only
sound/hda. Because AUTOINSTALL="yes", it re-runs on every kernel bump, per
machine. Offline, behind a proxy, on a metered link, or on a box with a local
pacman mirror but no general internet, the DKMS build fails inside the pacman
transaction and the user's speakers go silent again after a routine update.

This is avoidable, and omarchy-pkgs is the ideal place to avoid it

Everything PRE_BUILD does is deterministic and kernel-source-only: fetch
sound/hda, swap in upstream's cut-down makefiles/, copy the patch_cirrus/
headers, apply patch_cs8409.{c,h}.diff. None of it needs to happen on the
user's machine.

Since omarchy-pkgs builds packages centrally, doing it in prepare() means the
tarball is fetched once in your pipeline, not once per user per kernel. Ship
the prepared tree and drop PRE_BUILD; dkms.conf then reduces to:

MAKE[0]="make KERNELRELEASE=${kernelver}"
AUTOINSTALL="yes"

DKMS rebuilds run make and nothing else, and wget leaves depends.

Rough shape — add the kernel tarball to source=() with noextract, then:

prepare() {
  cd "$srcdir/snd_hda_macbookpro"
  install -d build
  tar --strip-components=2 -xf "$srcdir/linux-${_ksrcver}.tar.xz" \
      -C build "linux-${_ksrcver}/sound/hda"
  # upstream's cut-down Makefiles + patch_cirrus headers, then:
  cd build/hda
  patch -b -p1 <"$srcdir/snd_hda_macbookpro/patch_cs8409.c.diff"
  patch -b -p1 <"$srcdir/snd_hda_macbookpro/patch_cs8409.h.diff"
}

A working version is at
https://github.com/ari-ahm/snd-hda-macbookpro-dkms (GPL-2.0-only, same
_commit 6c324f6 you pin). It vendors its sources, which suits a local build
but probably isn't what you want in-repo — the prepare() and dkms.conf are
the transferable parts. Take, adapt or ignore; no attribution needed.

Verified under unshare -n with no network interfaces: both the DKMS rebuild
and makepkg itself succeed with cdn.kernel.org unreachable.

There's a second benefit for a distro package: patching at build time means a
conflict against a newer kernel fails your pipeline, instead of silently
breaking users' audio on a kernel update months later. The two diffs currently
apply to 7.1.9 with offsets and some fuzz, so that will matter eventually.

Two smaller things

  • The header comment says the AUR package "does not depend on wget". It does —
    snd-hda-macbookpro-dkms-git 0.1-3 lists wget in depends. The other
    reasons for a separate package still hold (partial tree, exec bits, the
    PACKAGE_NAME mismatch making dkms install exit 7), so only the premise is
    off.
  • optdepends=('linux-headers: ...') makes headers optional, which reproduces
    the silent failure described in omarchy#8285: with no headers, Arch's DKMS
    hook globs usr/lib/modules/*/build, matches nothing, builds nothing and
    exits 0, leaving dkms status empty and no error anywhere. It works today
    only because the install hook adds linux-headers separately. A hard
    depends would make the package correct on its own.

Coverage data point

Confirmed working on MacBookPro14,1 (codec subsystem 0x106b3300), Omarchy
4.0.2, linux 7.1.9-arch1-2, gcc 16.2.1 — no source changes beyond upstream's own
two diffs — alongside the 14,3 and iMac18,3 already verified. Upstream handles 0x106b3300 and 0x106b3600 in the
same branch, so 13,1/14,1/14,2 come together.

ahmadtv added a commit to ahmadtv/omarchy-imac18-3 that referenced this pull request Oct 1, 2026
omacom/omarchy#12689 (draft) plus omacom/omarchy-pkgs#249 would install
davidjo's snd-hda-macbookpro-dkms on iMac18,x/19,x. It registers as
snd_hda_macbookpro/0.1 -- our DKMS name, another version -- and
audio_rival_dkms skipped every entry with our name, so the clash went
unnoticed until a kernel update let the wrong build win updates/dkms
(no headset capture, no remote buttons).

- audio_rival_dkms reports our name with any other version, plus any
  other package building snd-hda-codec-cs8409, as before
- a rival whose source tree a pacman package owns is removed with
  pacman -R; deleting its files left the package registered, and its
  next upgrade restored them
- mod_audio_detect reports partial while a rival exists, so the status
  banner flags it right after the Omarchy update, before a kernel update
- the 0.2 version lives in one constant, AUDIO_DKMS_VER; AUDIO_SRCROOT
  makes the source root overridable for testing

Tested against a fake source root (ours only; plus davidjo 0.1; plus an
other-named cs8409 driver; plus unrelated APFS DKMS) and on the live
machine (no rival, audio still "applied"). The pacman -R branch is not
exercised live: that needs the rival package installed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants