Skip to content

Instantly share code, notes, and snippets.

@katyo
Last active January 31, 2023 17:34
Show Gist options
  • Save katyo/1246ad22ce61be943f30092fc92438f9 to your computer and use it in GitHub Desktop.
Save katyo/1246ad22ce61be943f30092fc92438f9 to your computer and use it in GitHub Desktop.
Teclast F5 onboard sound support for NixOS

To get onboard sound working on Teclast F5 with ES8336 codec we needs to use Linux kernel patches from SOF Project and the latest sof-firmware (v1.9).

On NixOS modify your configuration.nix like the following:

{ config, pkgs, lib, ... }:
{
  imports = [
    ./hardware-configuration.nix
    ./hardware-fixes/asoc-es8336.nix
  ];
  boot.kernelPackages = pkgs.linuxPackages_5_14;
}
{ pkgs, ... }:
with pkgs;
{
boot.kernelPatches = [
{
name = "ES8336 Support";
patch = fetchurl {
url = "https://patchwork.kernel.org/series/557373/mbox/";
sha256 = "0dvvbb8r63d4r1n2z1scjyvwb33f5g15jffcn5ylfbcca89pfb4x";
};
extraConfig = ''
SND_SOC_INTEL_SOF_ES8336_MACH m
'';
}
{
name = "ES8336 Support Hack";
patch = fetchurl {
url = "https://github.com/thesofproject/linux/pull/3107.patch";
sha256 = "0pnajp23ahnd94gnghdsr97jylfafi0k61mcyip5amb0sgxgj8br";
};
}
];
nixpkgs.overlays = [
(self: super: {
sof-firmware = callPackage ./sof-firmware.nix {};
})
];
}
{ lib, stdenvNoCC, fetchFromGitHub }:
stdenvNoCC.mkDerivation rec {
pname = "sof-firmware";
version = "1.9";
src = fetchFromGitHub {
owner = "thesofproject";
repo = "sof-bin";
rev = "v${version}";
sha256 = "sha256-yife3gO8lXOGwRye213II9rCQqDic7B7w1xW1o7ajF8=";
};
dontFixup = true;
installPhase = ''
runHook preInstall
cd "v${version}.x"
mkdir -p $out/lib/firmware/intel/
cp -a sof-v${version} $out/lib/firmware/intel/sof
cp -a sof-tplg-v${version} $out/lib/firmware/intel/sof-tplg
runHook postInstall
'';
}
@katyo
Copy link
Author

katyo commented Jan 31, 2023

@tshipenchko Thanks

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