Skip to content
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

Port of linux-surface/linux-surface Kernel patches to NixOS #221

Merged
merged 23 commits into from Jan 23, 2021

Conversation

mexisme
Copy link
Contributor

@mexisme mexisme commented Jan 3, 2021

This is an update and partial rewrite of the initial port of the linux-surface patches to NixOS, and replaces #170.
This specific PR intends to focus only on the Kernel patches, not any of the other fixes (e.g. ath10k firmware for Surface Go) or support binaries (e.g. iptsd or dtx).

It defaults to kernel 5.10.2, which includes initial support for the built-in WebCam.

The support matrix from the upstream repo is here:

@mexisme mexisme changed the title Microsoft/surface/fetch patches Port of linux-surface/linux-surface patches to NixOS Jan 3, 2021
@mexisme mexisme force-pushed the microsoft/surface/fetch-patches branch 2 times, most recently from 7ca578e to df6cc91 Compare January 3, 2021 13:03
@Mic92
Copy link
Member

Mic92 commented Jan 6, 2021

ci errors look unrelated.

@Mic92
Copy link
Member

Mic92 commented Jan 6, 2021

I try to fix CI in #222

@mexisme mexisme force-pushed the microsoft/surface/fetch-patches branch 5 times, most recently from d8d67c6 to f4e9166 Compare January 11, 2021 04:17
@mexisme mexisme force-pushed the microsoft/surface/fetch-patches branch 3 times, most recently from acc076d to 3b08c07 Compare January 11, 2021 10:59
… the patches and firmware binaries.

Add MS Surface Kernel patches from github.com/linux-surface/linux-surface

Add MS Surface Firmware from github.com/linux-surface/linux-surface

Add MS Surface Hardware config from github.com/linux-surface/linux-surface

Tie-together the Microsoft Surface .nix files

Set to use explicit version of Linux (5.4.7)

- Add the config for Linux 5.4.7

Add kernel 5.4.11

Add kernel 5.4.13

Remove unsupported patches

Revert to kernel 5.4.7 for now

- Problems initialising touchscreen & pen

Add kernel 5.4.15 and 5.4.16

Build kernel 5.4.16, instead

Add kernel 5.4.22

Update the patches for kernel 5.4

Placeholder for Linux kernel 5.5

Copy the IPTS kernel patch from the 5.5 dir to the 5.4 dir.

Conversation on https://gitter.im/linux-surface/community suggested this would
reenable IPTS on 5.4:

-----
@matrixbot Feb 29 15:33
hpfr Blaž Hrastnik (Gitter): thanks for the mention. mexisme (Gitter) finally, someone who actually knows Nix and isn't just a config nerd writing proper NixOS Surface configs! I am stuck on 4.19 at the moment because IPTS is now a proper reverse-engineered kernel driver (https://github.com/linux-surface/intel-precise-touch) instead of just a blob package, and I haven't had time to look at how to package that for Nix. If you're on 5.5, are you just not using IPTS? Would love to help out on packaging that for NixOS
hpfr also, development conversations seem to happen more at #linux-surface on freenode, which you can connect to with matrix via https://matrix.to/#/!OXIGGPCpnzaNVeGtCA:matrix.org if you don't like IRC clients

@matrixbot Feb 29 15:39
hpfr Also, I'm not using jakeday's patches, I'm using the more recent ones from the linux-surface/linux-surface repo, but yeah, for 4.19, so they're a bit different from the 5.x patchsets. afaik 4.19 is still supported because it's the last LTS release that supports the "official" IPTS blob before Linux made changes that required reverse engineering a driver that didn't use GuC submission (I'm just quoting here, I have no idea what that is haha)

@matrixbot Feb 29 19:27
Blaž > now a proper reverse-engineered kernel driver
Should be similar to before, we just offer it as a patch
Blaž https://github.com/linux-surface/linux-surface/blob/master/patches/5.5/0007-ipts.patch
Blaž Anyway I'm keeping an eye out on your NixOS builds since I'm thinking about giving it a try

@matrixbot Feb 29 19:32
Blaž Currently running Arch but using nix as a way to manage development environments for various projects

@matrixbot Mar 01 10:41
hpfr Blaž: well shoot is that patch all that’s necessary for building in-tree? It does all the things the linux-surface/intel-precise-touch repo does?

Dorian Stoll @StollD Mar 01 12:56
Yes
Just adds all the files from the repo to drivers/input/touchscreen and adds the necessary glue to drivers/input/touchscreen/{Makefile, Kconfig}

@matrixbot Mar 02 09:13
hpfr Dorian Stoll (Gitter): oof. Could’ve been on 5.4+ all this time!

Move kernnel *.nix packages under their respective kernel dirs

Use lib.mkDefault

Update to kernel 5.4.24

Update to kernel 5.5.8

Typo

Drivers are modules by default

Revert to 5.4.24 until can fix the config failures
- Delete the derivatives for 5.5.8, 5.9.2 and 5.10.4
- Nix build for kernel 5.10.2
- Update the kernel config for 5.10.4
@mexisme mexisme force-pushed the microsoft/surface/fetch-patches branch from 3b08c07 to c400fde Compare January 12, 2021 05:02
@mexisme mexisme force-pushed the microsoft/surface/fetch-patches branch from 7ab160f to 1275995 Compare January 12, 2021 19:16
- NOTE: The file is left, due to an incoming PR to fix for ath10k firmware not
  loading correctly on Surface Go range.
@mexisme mexisme force-pushed the microsoft/surface/fetch-patches branch from 1275995 to fc3efdc Compare January 12, 2021 19:18
@mexisme mexisme changed the title Port of linux-surface/linux-surface patches to NixOS [WIP] Port of linux-surface/linux-surface patches to NixOS Jan 14, 2021
@mexisme
Copy link
Contributor Author

mexisme commented Jan 14, 2021

FYI: issue #107346 appears to affect my building this in 20.09; builds fine in unstable.

@mexisme mexisme changed the title [WIP] Port of linux-surface/linux-surface patches to NixOS [WIP] Port of linux-surface/linux-surface Kernel patches to NixOS Jan 15, 2021
@mexisme
Copy link
Contributor Author

mexisme commented Jan 15, 2021

I've refactored the commit history in my branch to try to help with review.
As it stands, this PR should build the 5.10.2 kernel correctly for the MS Surface range.

There is a TODO.org file documenting the other work needed (and incoming) e.g:

  • Fix for ath10k firmware on Surface Go
  • Build +install iptsd user-mode HID/input daemon for the newer IPTS firmware
  • DTX and surface-control tools

If it's acceptable, I'd rather do those in follow-up PRs, but not sure whether that makes it OK to merge this into the main branch as is?

@mexisme mexisme changed the title [WIP] Port of linux-surface/linux-surface Kernel patches to NixOS Port of linux-surface/linux-surface Kernel patches to NixOS Jan 15, 2021
@mexisme mexisme marked this pull request as ready for review January 15, 2021 09:36
microsoft/surface/repos.nix Outdated Show resolved Hide resolved
microsoft/surface/repos.nix Outdated Show resolved Hide resolved
microsoft/surface/README.md Outdated Show resolved Hide resolved
microsoft/surface/README.md Outdated Show resolved Hide resolved
@Mic92
Copy link
Member

Mic92 commented Jan 15, 2021

If it's acceptable, I'd rather do those in follow-up PRs, but not sure whether that makes it OK to merge this into the main branch as is?

Fine with me.

@Mic92
Copy link
Member

Mic92 commented Jan 21, 2021

Looks good to me if #221 (comment) #221 (comment) and #221 (comment) is addressed.

@Mic92 Mic92 merged commit a0d8383 into NixOS:master Jan 23, 2021
@mexisme mexisme deleted the microsoft/surface/fetch-patches branch January 26, 2021 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants