Pin to Linux 5.10.18 for patches. Remove upstreamed wi-fi firmware.

Pin to the latest stable 5.10.18 release in order to ensure patches
don't unexpectedly conflict in newer linux versions.

The wi-fi firmware has since been upstreamed to the `linux-firmware`
repo, and as such is now available via `enableRedistributableFirmware`.
As a result we can remove the old expr that pulled the firmware from
kvalo's github.

Also removes two patches that have since been upstreamed.
This commit is contained in:
mitchmindtree 2021-02-26 11:41:03 +01:00
parent cc5d84ccef
commit 0359644c22
2 changed files with 225 additions and 264 deletions

View file

@ -1,21 +1,29 @@
{ lib, pkgs, ... }: {
imports = [ ../../../common/cpu/intel ../../../common/pc/laptop ];
# TODO: Remove `qca6390-wifi-firmware.nix` once it is available via
# `firmware-linux-nonfree` package.
nixpkgs.overlays = [
(final: previous: {
qca6390-wifi-firmware = final.callPackage ./qca6390-wifi-firmware.nix { };
})
];
# Includes the Wi-Fi (and likely Bluetooth) firmware for the QCA6390.
hardware.enableRedistributableFirmware = true;
hardware.firmware = lib.mkBefore [ pkgs.qca6390-wifi-firmware ];
# Wi-Fi currently requires a specific set of patches to function.
# To ensure these patches do not conflict, we pin to a specific version here.
# TODO: Remove this once patches have finally landed in mainline.
boot.kernelPackages = let
linux_patched_pkg =
{ buildLinux, fetchurl, modDirVersionArg ? null, ... }@args:
buildLinux (args // rec {
version = "5.10.18";
modDirVersion = if (modDirVersionArg == null) then
builtins.replaceStrings [ "-" ] [ ".0-" ] version
else
modDirVersionArg;
src = fetchurl {
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
sha256 = "04dnkg5j73f6cd8ws1prrrjx37srz7rm66bj6slmnfzp3cmyxh9v";
};
# Patches are based on the 5.10 release.
boot.kernelPackages = pkgs.linuxPackages_5_10;
boot.kernelPatches = [
# kvalo qca6390 patches
# https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/log/?h=ath11k-qca6390-bringup
kernelPatches = [
{
name = "add-64-bit-check-before-reading-msi-high-addr";
patch = pkgs.fetchpatch {
@ -32,14 +40,6 @@
sha256 = "0sxbb58bnryb9hic1cyc8dzrzachhca7a6hywyzz1pksh9syhs5y";
};
}
{
name = "try-to-allocate-big-block-of-dma-memory-firstly";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=0d8b0aff6b77ea5a8d715ba5d0089f9dffbabf21";
sha256 = "120zqivqhs5080b64h62x69svi6bq02scgnkswa0hbvdncsy63y8";
};
}
{
name = "fix-monitor-status-dma-unmap-direction";
patch = pkgs.fetchpatch {
@ -184,14 +184,6 @@
sha256 = "17pgbmsryg96626xpbkzd0c27z71lsy7ygli4c6d4dzk5b9594zn";
};
}
{
name = "fix-incorrect-tlvs-in-scan-start-command";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=bfa226b7e2e988609631e7f6cd0d4e9ede423f6b";
sha256 = "03qb5d0dm77l2ifmcy87p064qd55bg9kqx9nmxy6lrvz83crizpb";
};
}
{
name = "vdev-delete-sync-with-fw";
patch = pkgs.fetchpatch {
@ -233,6 +225,9 @@
};
}
];
} // (args.argsOverride or { }));
linux_patched = pkgs.callPackage linux_patched_pkg { };
in pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_patched);
# Confirmed necessary to get audio working as of 2020-11-13:
# https://bbs.archlinux.org/viewtopic.php?pid=1933643#p1933643

View file

@ -1,34 +0,0 @@
# Based on instructions from kvalo at: http://lists.infradead.org/pipermail/ath11k/2020-November/000537.html
# The xps/13-9360/qca6174-firmware.nix was a useful reference for how to setup this module.
{ stdenv, fetchFromGitHub }:
stdenv.mkDerivation rec {
name = "${target}-wifi-firmware-${version}";
version = "${branch}-00042";
branch = "master";
target = "QCA6390";
src = fetchFromGitHub {
owner = "kvalo";
repo = "ath11k-firmware";
rev = "45a6c45a19799d3b06fc2287d5ba44e19ee0aa00";
sha256 = "1slfjzy2b9zi8744gyw8piz9gfvrh8s38wmyzzqj525iy76zn4qv";
};
buildCommand = ''
mkdir -p $out/lib/firmware/ath11k/${target}/hw2.0/
cp $src/QCA6390/hw2.0/1.0.1/WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1/*.bin $out/lib/firmware/ath11k/QCA6390/hw2.0/
cp $src/QCA6390/hw2.0/board-2.bin $out/lib/firmware/ath11k/QCA6390/hw2.0/
'';
meta = with stdenv.lib; {
description = ''
Firmware for the QCA6390 wireless chip.
This derivation is based on the instructions provided by kvalo in:
http://lists.infradead.org/pipermail/ath11k/2020-November/000537.html
'';
homepage =
"https://github.com/kvalo/ath11k-firmware/tree/master/QCA6390/hw2.0";
license = licenses.unfreeRedistributable;
maintainers = with maintainers; [ mitchmindtree ];
platforms = platforms.linux;
};
}