This repository includes the files needed to build an optimized CachyOS kernel including custom patches for Microsoft Surface devices. The patches are based on the work from the linux-surface repository. The patches have been updated to ensure compatibility with CachyOS's patches.
The Microsoft Surface patches and per-version config fragment are pulled directly from the official linux-surface/linux-surface repository at build time. The git ref to check out is controlled by the _surface_ref variable in each PKGBUILD:
linux-cachyos-surfacebuilds against the pre-patched kernel tarball published by CachyOS at CachyOS/linux/releases (e.g.cachyos-7.2.11-1.tar.gz). This tarball is vanilla Linux with all the CachyOS base optimisations (BBR3, cachy, fixes, ntsync, t2, zstd, amd-cache-optimizer, …) pre-applied — it replaces the now-removed0001-cachyos-base-all.patchfor kernel 6.18+. The packaging revision is selected by_tagrel(independent of this PKGBUILD'spkgrel). The linux-surface tag to check out is built from_surface_ver(kernel version part, defaults to${pkgver}) and_surface_rel(e.g.1), giving a default_surface_ref="arch-${_surface_ver}-${_surface_rel}". It's important to keep the CachyOS and linux-surface kernel versions aligned — running a surface patch set built against a different point release can break hardware support (e.g. the touchscreen stopping working)._surface_veris split out only as an escape hatch for the times the two projects publish different point releases; override it only when you've confirmed a near-version patch set still works.linux-cachyos-surface-ltsdeliberately stays on a real kernel.org LTS line (currently Linux 6.12.x, supported by upstream LTS through approximately December 2026). It uses the stock kernel.org tarball plus the still-present${_major}/all/0001-cachyos-base-all.patchmeta-patch fromcachyos/kernel-patches— that meta-patch was retired for 6.18+ but remains available for 6.12. The PKGBUILD includes a commented-out template for the pre-baked tarball switch (along the lines used by the mainline variant) for the future kernel bump past 6.12. Its_surface_refdefaults tomasterbecause upstream'sarch_lts-*tag series stopped at 4.19. Note: upstreamCachyOS/linux-cachyos's ownlinux-cachyos-ltsvariant has redefined "lts" to mean "previous stable cachyos kernel"; this repo intentionally keeps the original kernel.org-LTS meaning so Surface owners get the longest maintenance window per major bump.
To bump the mainline kernel: pick a tag from CachyOS/linux/releases that matches an available linux-surface/linux-surface/tags kernel version, then update _major/_minor/_tagrel and _surface_rel. With _surface_ver defaulting to ${pkgver}, that's usually the only change needed. Only set _surface_ver explicitly if the two projects diverge on the point release for that month — and prefer waiting for them to realign, since mismatched versions can break Surface hardware (touchscreen, type cover, sensors). The patch set itself is discovered automatically from patches/${_major}/*.patch in the upstream repo.
NOTE: The configuration files and prebuilt kernels are optimized for X86_64_v3 instruction sets, this should be fine for most Surface devices, but might not work on very old (1st or 2nd gen) devices.
This variant is as close to the original cachyos kernel as possible, it is build using Clang LTO mode full with llvm for maximum performance.
This variant is based on the original cachyos lts kernel, but is build with gcc for better stability and support.
To build the kernel and header files from source, run the following commands within CachyOS (or any Arch derivative):
sudo pacman -S base-devel
git clone https://github.com/jonpetersathan/linux-cachyos-surface
cd linux-cachyos-surface/linux-cachyos-surface
makepkg -si --skipintegOr alternatively using docker:
docker run --name kernelbuild -v $PWD:/pkg cachyos/docker-makepkg-v3
sudo pacman -U linux-cachyos-surface-*.pkg.tar.zstNOTE: Per default the linux-cachyos-surface kernel is configured in LTO mode full, this may take a bit longer to compile and requires more ram. It can be changed by updating the following line in the PKGBUILD:
# Clang LTO mode, only available with the "llvm" compiler - options are "none", "full" or "thin".
# ATTENTION - one of three predefined values should be selected!
# "full: uses 1 thread for Linking, slow and uses more memory, theoretically with the highest performance gains."
# "thin: uses multiple threads, faster and uses less memory, may have a lower runtime performance than Full."
# "thin-dist: Similar to thin, but uses a distributed model rather than in-process: https://discourse.llvm.org/t/rfc-distributed-thinlto-build-for-kernel/85934"
# "none: disable LTO
: "${_use_llvm_lto:=full}"You can also just install one of the prebuilt kernels by downloading the kernel and header files from here and run:
sudo pacman -U linux-cachyos-surface-*.pkg.tar.zst- Maximilian Luz: surface-linux/surface-linux
- Peter Lung: CachyOS/linux-cachyos