-
-
Notifications
You must be signed in to change notification settings - Fork 829
Port of linux-surface/linux-surface Kernel patches to NixOS #221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
540c80a
Initial port from github.com/linux-surface/linux-surface, vendorising…
mexisme 6ee57bb
Add a TODO tracking doc
mexisme eda6f9d
Add Kernel 5.9.2 patches
mexisme d3fb0c7
Use Kernel 5.9.2 on Surface Go
mexisme ac8f98f
Create a "repos" nix file
mexisme 54b7d7e
Drop the ath10k firmware, build the ipts firmware (again)
mexisme 233c69d
Use the upstream repo to provide the ipts firmware
mexisme bf271c9
Delete vendored IPTS and ath10k firmware
mexisme 4533632
Build the 5.10.4 kernel using the upstream patches, instead of local …
mexisme d6a9c7e
Refactor kernels and patches for MS Surface
mexisme aa0dc15
Remove vendored 5.1, 5.2, 5.3, 5.4, 5.5 and 5.9 kernel patches
mexisme 079b01a
Update Kernels
mexisme 2243dad
Update TODO.org
mexisme c400fde
Beginnings of README
mexisme db5fb34
Update README
mexisme fc3efdc
Remove `ipts` firmware derivative.
mexisme 7b884ec
Merge remote-tracking branch 'upstream/master' into microsoft/surface…
mexisme 5af4629
Fix for enabling Keyboard and Trackpad on Surface Laptop 3 (et al)
mexisme b5d482b
Update README
mexisme c72a04b
Remove obsolete surface-ipts-firmware repo entry
mexisme a8d7159
Remove the libwacom-surface repos
mexisme cbad2d9
Update README
mexisme 09f8a21
Update TODO's
mexisme File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Derivatives for Microsoft Surface notebooks | ||
|
|
||
| These derivatives use the patches from the [linux-surface repo](https://github.com/linux-surface/linux-surface/tree/master/patches). | ||
|
|
||
| ## Kernel | ||
|
|
||
| The kernel needs several patches to make it work correctly with some of the hardware on various | ||
| Surface models, e.g. keyboard/trackpad, camera, wifi. | ||
|
|
||
| Not all hardware is fully supported, but the | ||
| [linux-surface feature matrix](https://github.com/linux-surface/linux-surface/wiki/Supported-Devices-and-Features#feature-matrix) | ||
| provides details on which devices are supported on which types of machine. | ||
|
|
||
| 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: | ||
| - https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing | ||
|
|
||
| ## Firmware, Drivers and Support Tools | ||
|
|
||
| ### WiFi | ||
|
|
||
| For the Surface Go, please see the "Issues" sections below. | ||
|
|
||
| ### IPTS | ||
|
|
||
| IPTS is used on most of the Surface range, except for Surface Go and Surface Laptop 3 (AMD version). | ||
|
|
||
| Older kernels used specialised firmware which used a method that's no longer supported by the | ||
| more-recent kernels. | ||
|
|
||
| Newer kernels use the kernel-space `intel-precise-touch` driver and user-space `ipstd` daemon. | ||
|
|
||
| The `iptsd` daemon works with the `intel-precise-touch` driver to convert raw touch data from the | ||
| kernel-space driver into events for the HID / input sub-system. | ||
|
|
||
| - https://github.com/linux-surface/iptsd | ||
| - https://github.com/linux-surface/intel-precise-touch | ||
| - _*NOTE:*_ The patches from this repo are included in the above kernel patches, already. | ||
|
|
||
| ### DTX, `surface-control` | ||
|
|
||
| *TODO* | ||
|
|
||
| # ToDo's Not Done | ||
|
|
||
| See: [TODO.org](./TODO.org) | ||
|
|
||
| # Issues | ||
|
|
||
| ## TLP daemon | ||
|
|
||
| TLP is known to cause problems on Surface unless correctly configured. | ||
| See: https://github.com/linux-surface/linux-surface/blob/master/README.md | ||
|
|
||
| ## Wifi Firmware for Surface Go | ||
|
|
||
| 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* | ||
|
|
||
| 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. | ||
|
|
||
| References: | ||
| - https://github.com/jakeday/linux-surface/issues/441 | ||
| - https://www.reddit.com/r/SurfaceLinux/comments/e8quqg/surface_go_official_wifi_fix/ | ||
| - https://hackmd.io/@dasgeek/ryA5i5Dor | ||
| - https://github.com/thebitstick/surfacego-wifi | ||
| - https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/ath10k | ||
| - https://wireless.wiki.kernel.org/en/users/drivers/ath10k/firmware | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| * Kernel Patching | ||
| ** DONE Create derivative to patch kernel 5.10.2 | ||
| - Latest from linux-surface | ||
| - [X] Download github.com/linux-surface/linux-surface kernel patches | ||
| - [X] Build kernel using downloaded patches | ||
| ** TODO Create a function for selecting preferred kernel | ||
| ** DONE Fix how Keyboard & Trackpad are not being enabled on SL3 | ||
| - https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing | ||
| * Firmware | ||
| ** DONE Remove old firmware binaries | ||
| - Looks like the ath10k files aren't needed, any more | ||
| ** DONE Create derivative for `ipts` firmware | ||
| - [X] Download github.com/linux-surface/surface-ipts-firmware firmware | ||
| - [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 | ||
| - [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 | ||
| - `board-2.bin` needs to be removed / replaced with `board.bin` | ||
| * Support Tools | ||
| ** TODO Incorporate @hpfr's function(s) from this commit: | ||
| - https://github.com/hpfr/system/commit/03fa1b0a83f8a336e812910d0d50f5247a8a630c | ||
| ** TODO Create derivative for `iptsd` touch-screen daemon | ||
| - [ ] Download | ||
| - [ ] Install binary | ||
| - [ ] Enable via systemd | ||
| ** TODO Create derivative to patch and rebuild libwacom | ||
| - github.com/linux-surface/libwacom-surface | ||
| - The plan is to do this in a separate PR against `nixpkgs` instead of `nixos-hardware` | ||
| ** TODO Create derivative to install `surface-control` | ||
| - Download github.com/linux-surface/surface-control | ||
| ** TODO Create derivative to install `surface-dtx-daemon` | ||
| - Download github.com/linux-surface/surface-dtx-daemon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { config, lib, pkgs, ... }: | ||
| { | ||
| imports = [ | ||
| ./kernel | ||
| ./firmware | ||
| ./hardware_configuration.nix | ||
| ]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { config, lib, pkgs, ... }: | ||
| { | ||
| hardware.enableAllFirmware = true; | ||
| hardware.firmware = [ | ||
| ]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { config, lib, pkgs, ... }: | ||
| { | ||
| boot.extraModprobeConfig = lib.mkDefault '' | ||
| options i915 enable_fbc=1 enable_rc6=1 modeset=1 | ||
| options snd_hda_intel power_save=1 | ||
| 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" ]; | ||
|
|
||
| # NOTE: Check the README before enabling TLP: | ||
| services.tlp.enable = lib.mkDefault false; | ||
|
|
||
| hardware.sensor.iio.enable = lib.mkDefault true; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { config, lib, pkgs, ... }: | ||
|
|
||
| { | ||
| boot.kernelPackages = pkgs.callPackage ./linux-5.10.2 {}; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| { config, lib, pkgs, ... }: | ||
| let | ||
| repos = (pkgs.callPackage ../../repos.nix {}); | ||
| # TODO: Can I append the path ./patches instead of a string? | ||
| patches = repos.linux-surface + "/patches"; | ||
| surface_kernelPatches = [ | ||
| { name = "microsoft-surface-patches-linux-5.10.2"; | ||
| patch = null; | ||
| extraConfig = '' | ||
| # | ||
| # Surface Aggregator Module | ||
| # | ||
| SURFACE_AGGREGATOR m | ||
| SURFACE_AGGREGATOR_ERROR_INJECTION n | ||
| SURFACE_AGGREGATOR_BUS y | ||
| SURFACE_AGGREGATOR_CDEV m | ||
| SURFACE_AGGREGATOR_REGISTRY m | ||
| SURFACE_ACPI_NOTIFY m | ||
| SURFACE_BATTERY m | ||
| SURFACE_DTX m | ||
| SURFACE_HID m | ||
| SURFACE_PERFMODE m | ||
|
|
||
| # | ||
| # These built-in modules are required for the Surface Aggregator Module | ||
| # See: https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing | ||
| # | ||
| SERIAL_DEV_BUS y | ||
| SERIAL_DEV_CTRL_TTYPORT y | ||
|
|
||
| # | ||
| # Surface Hotplug | ||
| # | ||
| SURFACE_HOTPLUG m | ||
|
|
||
| # | ||
| # IPTS touchscreen | ||
| # | ||
| # This only enables the user interface for IPTS data. | ||
| # For the touchscreen to work, you need to install iptsd. | ||
| # | ||
| MISC_IPTS m | ||
|
|
||
| # | ||
| # Cameras: IPU3 | ||
| # | ||
| ## TODO: Fix for kernel 5.10.2: | ||
| ##VIDEO_IPU3_IMGU m | ||
| VIDEO_IPU3_CIO2 m | ||
| CIO2_BRIDGE y | ||
| INT3472 m | ||
|
|
||
| # | ||
| # Cameras: Sensor drivers | ||
| # | ||
| VIDEO_OV5693 m | ||
| ## TODO: Fix for kernel 5.10.2: | ||
| ##VIDEO_OV8865 m | ||
|
|
||
| # | ||
| # Other Drivers | ||
| # | ||
| INPUT_SOC_BUTTON_ARRAY m | ||
| SURFACE_3_BUTTON m | ||
| SURFACE_3_POWER_OPREGION m | ||
| SURFACE_PRO3_BUTTON m | ||
| SURFACE_GPE m | ||
| SURFACE_BOOK1_DGPU_SWITCH m | ||
| ''; | ||
| } | ||
| { | ||
| name = "ms-surface/0001-surface3-oemb"; | ||
| patch = patches + "/5.10/0001-surface3-oemb.patch"; | ||
| } | ||
| { | ||
| name = "ms-surface/0002-wifi"; | ||
| patch = patches + "/5.10/0002-wifi.patch"; | ||
| } | ||
| { | ||
| name = "ms-surface/0003-ipts"; | ||
| patch = patches + "/5.10/0003-ipts.patch"; | ||
| } | ||
| { | ||
| name = "ms-surface/0004-surface-gpe"; | ||
| patch = patches + "/5.10/0004-surface-gpe.patch"; | ||
| } | ||
| { | ||
| name = "ms-surface/0005-surface-sam-over-hid"; | ||
| patch = patches + "/5.10/0005-surface-sam-over-hid.patch"; | ||
| } | ||
| { | ||
| name = "ms-surface/0006-surface-sam"; | ||
| patch = patches + "/5.10/0006-surface-sam.patch"; | ||
| } | ||
| { | ||
| name = "ms-surface/0007-surface-hotplug"; | ||
| patch = patches + "/5.10/0007-surface-hotplug.patch"; | ||
| } | ||
| { | ||
| name = "ms-surface/0008-surface-typecover"; | ||
| patch = patches + "/5.10/0008-surface-typecover.patch"; | ||
| } | ||
| { | ||
| name = "ms-surface/0009-cameras"; | ||
| patch = patches + "/5.10/0009-cameras.patch"; | ||
| } | ||
| ]; | ||
| in (with pkgs; recurseIntoAttrs (linuxPackagesFor ( | ||
| callPackage ./linux-5.10.2.nix { | ||
| kernelPatches = surface_kernelPatches; | ||
| } | ||
| ))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { stdenv, buildPackages, fetchurl, perl, buildLinux, modDirVersionArg ? null, ... } @ args: | ||
|
|
||
| with stdenv.lib; | ||
|
|
||
| buildLinux (args // rec { | ||
| version = "5.10.2"; | ||
|
|
||
| # modDirVersion needs to be x.y.z, will automatically add .0 if needed | ||
| modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg; | ||
|
|
||
| # branchVersion needs to be x.y | ||
| extraMeta.branch = versions.majorMinor version; | ||
|
|
||
| src = fetchurl { | ||
| url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz"; | ||
| sha256 = "18l1ywp99inm90434fm74w8rjfl4yl974kfcpizg2sp2p8xf311v"; | ||
| }; | ||
| } // (args.argsOverride or {})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { lib, pkgs, fetchgit }: | ||
| { | ||
| linux-surface = fetchgit { | ||
| url="https://github.com/linux-surface/linux-surface.git"; | ||
| rev="25ab2cf75e5eda5ab9739db1907300010c06dacf"; | ||
| sha256="0h8624d7ix1p6ysw9bllmnnwnv164z8xkx56zj3vdczn91vmqcf9"; | ||
| }; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.