Merge pull request #230 from mexisme/microsoft/surface/firmware-surface-go

This commit is contained in:
Jörg Thalheim 2021-03-13 16:14:14 +00:00 committed by GitHub
commit 31f61b90dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 118 additions and 18 deletions

View File

@ -129,6 +129,7 @@ See code for all available configurations.
| [Lenovo ThinkPad X1 (6th Gen)][] | `<nixos-hardware/lenovo/thinkpad/x1/6th-gen>` |
| [Lenovo ThinkPad X1 (7th Gen)][] | `<nixos-hardware/lenovo/thinkpad/x1/7th-gen>` |
| Lenovo ThinkPad X1 Extreme Gen 2 | `<nixos-hardware/lenovo/thinkpad/x1-extreme/gen2>` |
| [Microsoft Surface Range][] | `<nixos-hardware/microsoft/surface>` |
| [Microsoft Surface Pro 3][] | `<nixos-hardware/microsoft/surface-pro/3>` |
| PC Engines APU | `<nixos-hardware/pcengines/apu>` |
| [Raspberry Pi 2][] | `<nixos-hardware/raspberry-pi/2>` |

View File

@ -15,7 +15,7 @@ The kernel-specific derivations are under the `kernel/` sub-directory.
In order to simplify maintenance of the Nix code, only the most-recent kernel patch-set is expected
to be maintained in this repo.
_*NOTE:*_Some built-in Kernel config items need to be set, that aren't set by default:
_*NOTE:*_ Some built-in Kernel config items need to be set, that aren't set by default:
- https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing
## Firmware, Drivers and Support Tools
@ -59,11 +59,28 @@ See: https://github.com/linux-surface/linux-surface/blob/master/README.md
On the Surface Go, the standard firmware from the official Linux Firmware repo has issues with the
`ath10k` QCA6174 Wifi device.
You will see messages like "Can't ping firmware" *TODO - Copy messages from console*
You will see messages like "Can't ping firmware".
The most effective fix to-date is to remove the `board-2.bin` file or replace it with a copy of the
`board.bin` file.
The derivative in `firmware/surface-go/ath10k/` can configure this, if you set the option
`config.hardware.microsoft-surface.firmware.surface-go-ath10k.replace` to `true`.
_*NOTE:*_ This is destructive, as it deletes all the `board.bin` and `board-2.bin` files for the
`ath10k` QCA6174 device, and replaces them with KillerNetworking's version.
This is the only way (currently) to force the driver to use the new firmware.
For more details, see: https://github.com/linux-surface/linux-surface/wiki/Surface-Go#wifi-firmware
_*NOTE:*_ There's some work to patch the kernel to make it easier to override which firmware file
to use for QCA6174, which would obviate this more-destructuve approach:
- https://github.com/linux-surface/kernel/commit/22ef83836c4aa89e9eb98de9b47ed24b6c2a1d45
_*NOTE:*_ There was an attempt to get this firmware incorporated into the aggregate `board-2.bin`,
but (as of this writing) the request appears to have been ignored:
- https://github.com/linux-surface/linux-surface/issues/41
References:
- https://github.com/jakeday/linux-surface/issues/441
- https://www.reddit.com/r/SurfaceLinux/comments/e8quqg/surface_go_official_wifi_fix/

View File

@ -18,14 +18,27 @@
- [X] Install the binaries
** DONE Remove `ipts` firmware derivative
- This is only needed on the 4.19 kernel
** TODO Investigate problem with ath10k wifi firmware on Surface Go
*** TODO README entry explaining problem(s) with nonfree firmware on Surface Go
*** TODO Create derivative for `ath10k` firmware on Surface Go
** DONE Investigate problem with ath10k wifi firmware on Surface Go
:LOGBOOK:
- State "DOING" from "TODO" [2021-02-09 Tue 17:19]
- State "DONE" from "DOING" [2021-03-06 Sat 15:27]
:END:
*** DONE README entry explaining problem(s) with nonfree firmware on Surface Go
:LOGBOOK:
- State "DONE" from "TODO" [2021-02-09 Tue 17:17]
:END:
*** DONE Create derivative for `ath10k` firmware on Surface Go
:LOGBOOK:
- State "DOING" from "TODO" [2021-02-09 Tue 17:18]
:END:
- [X] Download github.com/kvalo/ath10k-firmware ?
- [X] Download kernel.org linux-firmware?
- [ ] Download `board.bin` from Killer Networks?
- [ ] Install ath10k firmware fix for Surface Go
- [X] Download `board.bin` from Killer Networks?
- [X] Install ath10k firmware fix for Surface Go
- `board-2.bin` needs to be removed / replaced with `board.bin`
- [X] Add a config option for enabling the Surface Go Firmware
- [-] Replace the vendorised `board.bin` with a `fetchurl`
- Getting HTTP 406 when using `fetchurl` or `nix-prefetch-url` that has to be diagnosed
* Support Tools
** TODO Incorporate @hpfr's function(s) from this commit:
- https://github.com/hpfr/system/commit/03fa1b0a83f8a336e812910d0d50f5247a8a630c

View File

@ -2,7 +2,7 @@
{
imports = [
./kernel
./firmware
./hardware_configuration.nix
./firmware/surface-go/ath10k
];
}

View File

@ -1,6 +0,0 @@
{ config, lib, pkgs, ... }:
{
hardware.enableAllFirmware = true;
hardware.firmware = [
];
}

View File

@ -0,0 +1,33 @@
{stdenv, lib, pkgs, firmwareLinuxNonfree, ...}:
let
repos = (pkgs.callPackage ../../../repos.nix {});
# killernetworking_firmware = ./K1535_Debian;
killernetworking_firmware = repos.ath10k-firmware + "/K1535_Debian";
in
firmwareLinuxNonfree.overrideAttrs (old: rec {
pname = "microsoft-surface-go-firmware-linux-nonfree";
srcs = [
firmwareLinuxNonfree.src
killernetworking_firmware
];
sourceRoot = firmwareLinuxNonfree.src;
dontMakeSourcesWritable = true;
postInstall = ''
# Delete the non-working firmware:
rm -v $out/lib/firmware/ath10k/QCA6174/{hw2.1,hw3.0}/board.bin
rm -v $out/lib/firmware/ath10k/QCA6174/{hw2.1,hw3.0}/board-2.bin
# Install the Surface Go Wifi firmware:
cp ${killernetworking_firmware}/board.bin $out/lib/firmware/ath10k/QCA6174/hw2.1/
cp ${killernetworking_firmware}/board.bin $out/lib/firmware/ath10k/QCA6174/hw3.0/
'';
outputHash = "1nc56qii96dfvxnv3ad3lxz2rzyqcbldk0h9rbm3l2pgamkvj8dw";
meta = with lib; {
description = "Standard binary firmware collection, adjusted with the Surface Go WiFi firmware";
platforms = platforms.linux;
priority = 5;
};
})

View File

@ -0,0 +1,22 @@
{ config, lib, pkgs, ... }:
let
cfg = config.hardware.microsoft-surface.firmware.surface-go-ath10k;
in
{
options = {
hardware.microsoft-surface.firmware.surface-go-ath10k = {
replace = lib.mkEnableOption ''Use the "board.bin" firmware for ath10k-based WiFi on Surface Go.'';
};
};
config = lib.mkIf cfg.replace {
hardware.enableAllFirmware = true;
hardware.firmware = [
(pkgs.callPackage ./ath10k-replace.nix {})
];
boot.extraModprobeConfig = lib.mkDefault ''
options ath10k_core skip_otp=Y
'';
};
}

View File

@ -6,7 +6,6 @@
options snd_ac97_codec power_save=1
options iwlwifi power_save=Y
options iwldvm force_cam=N
options ath10k_core skip_otp=Y
'';
boot.kernelParams = [ "mem_sleep_default=deep" ];

View File

@ -1,8 +1,29 @@
{ lib, pkgs, fetchgit }:
{ lib, pkgs, fetchFromGitHub, fetchurl }:
{
linux-surface = fetchgit {
url="https://github.com/linux-surface/linux-surface.git";
linux-surface = fetchFromGitHub {
owner="linux-surface";
repo="linux-surface";
rev="f8fab978a480a4ed57e9ebb6928683b2e443c1c5";
sha256="0zwybprwjckpapxm6gxzh6hwdd1w91g5sjxn6z52zlvvjpkmw959";
};
ath10k-firmware = fetchFromGitHub {
owner="kvalo";
repo="ath10k-firmware";
rev="84b47062aab31d67156e0a3ef593a6999a12864b";
sha256="0l8wfj8z4jbb31nzqkaxisby0n6061ix01c5di9bq66iby59j8py";
};
surface-go-ath10k-firmware_upstream = fetchurl {
url="https://support.killernetworking.com/K1535_Debian/board.bin";
# url="https://www.killernetworking.com/support/K1535_Debian/board.bin";
sha256="0l8wfj8z4jbb31nzqkaxisby0n6061ix01c5di9bq66iby59j8py";
};
surface-go-ath10k-firmware_backup = fetchFromGitHub {
owner="mexisme";
repo="linux-surface_ath10k-firmware";
rev="74e5409e699383d6ca2bc4da4a8433d16f3850b1";
sha256="169vgvxpgad9anmchs22fj5qm6ahzjfdnwhd8pc280q705vx6pjk";
};
}