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

linux: kernel: Add linux-ck for 4.14, 4.19 and 5.0 #59105

Closed
wants to merge 3 commits into from

Conversation

matthiasbeyer
Copy link
Contributor

Motivation for this change

Having linux-ck kernels in nixpkgs.

Stolen from https://github.com/kisonecat/nixos-linux-ck/blob/master/kernel.nix

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Evaluation will fail because of pkgs/os-specific/linux/tbs/default.nix being broken.

# linux-ck kernels.
linuxPackages_4_14_ck = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_14_ck);
linuxPackages_4_19_ck = recurseIntoAttrs (linuxPackagesFor pkgs.linux_4_19_ck);
linuxPackages_5_0_ck = recurseIntoAttrs (linuxPackagesFor pkgs.linux_5_0_ck);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really want these aliases ?

@teto
Copy link
Member

teto commented Apr 7, 2019

what is "ck" ? I have several ideas on the top of my head but none are realistic candidates xD

@matthiasbeyer
Copy link
Contributor Author

I honestly don't know. That's what the patches are called.

I assume that's the first and lastname of the author.

@vcunat
Copy link
Member

vcunat commented Apr 7, 2019

Here's some explanation of what it is, though without etymology: https://wiki.archlinux.org/index.php/Linux-ck


ck_5_0 = rec {
name = "patch-5.0-ck1.xz";
patch = fetchpatch {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error: Normalized patch '/build/76863d16a08e1b3c726b6c965f1bb7c672bd7317776810121062b13f9ea26780' is empty (while the fetched file was not)!
Did you maybe fetch a HTML representation of a patch instead of a raw patch?
Fetched file was:
...<BINARY>

Can't apply because it's still an archive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the time and resources to test-build this now... so wait for it, I'm tryin' it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So yes, the problem is indeed that I fetch .xz and not .patch ... I am working on a solution right now.

@matthiasbeyer
Copy link
Contributor Author

I honestly don't know how to do better and unfortunately it does not even work.

@worldofpeace
Copy link
Contributor

thing I did to unpack the patch:

diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix
index 1dacfe87486..ed557c12fd9 100644
--- a/pkgs/os-specific/linux/kernel/patches.nix
+++ b/pkgs/os-specific/linux/kernel/patches.nix
@@ -1,4 +1,4 @@
-{ fetchpatch, fetchurl }:
+{ stdenv, fetchpatch, fetchurl }:
 
 rec {
   bridge_stp_helper =
@@ -89,13 +89,22 @@ rec {
     { fn = "0016-Add-ck1-version.patch";                                      h = "1k1dd3bxm3vf6afzbgw64ddmsng0w4w9l0yg6kb3fz82l22cwpc8"; }
   ];
 
-  ck_4_19 = rec {
-    name = "patch-4.19-ck1";
-    patch = fetchurl {
-      inherit name;
-      url    = http://ck.kolivas.org/patches/4.0/4.19/4.19-ck1/patch-4.19-ck1.xz;
-      sha256 = "77863d16a08e1b3c726b6c965f1bb7c672bd7317776810121062b73f9ea26780";
+  ck_4_19 = let
+    unpackedPatch = stdenv.mkDerivation rec {
+      name = "4.19-ck1";
+
+      src = fetchurl {
+        url    = http://ck.kolivas.org/patches/4.0/4.19/4.19-ck1/patch-4.19-ck1.xz;
+        sha256 = "77863d16a08e1b3c726b6c965f1bb7c672bd7317776810121062b73f9ea26780";
+      };
+
+      unpackPhase = "true";
+      installPhase = ''
+        unxz -c $src > $out
+      '';
     };
+  in rec {
+    patch = unpackedPatch;
   };
 
   ck_5_0 = rec {

Maybe do something in postFetch for fetchurl instead of that.

Or perhaps we can just get a compare patch from github

@matthiasbeyer
Copy link
Contributor Author

Hm, github would be a nice idea, although I guess it is harder to find the actual patchset from github (for all the kernels) instead of just going to the website. I'll checkout your patch now!

'';
};
in rec {
patch = unpackedPatch;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately (@worldofpeace) does the patchset not apply on the kernel sources.

I'm not sure why, though. Maybe the kernel is too new (as in patchlevel-version)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...]
Hunk #1 succeeded at 155 (offset 24 lines).
patching file sound/usb/line6/pcm.c
patching file tools/objtool/Makefile
Hunk #1 FAILED at 31.
1 out of 1 hunk FAILED -- saving rejects to file tools/objtool/Makefile.rej
builder for '/nix/store/qb8k5whqxapcb3yknyqssfrfqpljif9p-linux-config-4.19.34.drv' failed with exit code 1                                                                                                       
cannot build derivation '/nix/store/lsdl2wy98a73d1s7rvl4qknnjp2s2ha6-linux-4.19.34.drv': 1 dependencies couldn't be built 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I don't think the author keep these patches in sync for very long.
So we might only be able to do patches for the latest, or fetch from places that have corrected the patch so it can apply.

@matthiasbeyer
Copy link
Contributor Author

@worldofpeace you're btw welcome to send me patches directly (as in "cherry-pick this commit") or tell me to pull from a branch of yours - no need to paste diffs here (which makes the whole conversation unnecessarily long).

@matthiasbeyer
Copy link
Contributor Author

Here we go with another approach.

Tell me if this looks good for you and I'll rebase and remove the unnecessary commits.

@matthiasbeyer
Copy link
Contributor Author

Hm, I do not understand the borg error message...

@worldofpeace
Copy link
Contributor

@matthiasbeyer This sounds like it might work. Though the rev's are a branch, so it's probably not stable.

Maybe pin them to a revision, or apply the patches to the kernel sources that the fork is at.

@worldofpeace
Copy link
Contributor

Hm, I do not understand the borg error message...

Maybe once we clean it up it'll magic resolve itself 😄

@matthiasbeyer
Copy link
Contributor Author

Lets see...

@matthiasbeyer
Copy link
Contributor Author

nope.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
@matthiasbeyer
Copy link
Contributor Author

Any ideas here?

@worldofpeace
Copy link
Contributor

The kernel built for me last time I checked. Though

Maybe pin them to a revision, or apply the patches to the kernel sources that the fork is at.

Still stands and eval is failing (you should probably do fetchFromGitHub not from args)

Also, since this is an older version of the kernels because the patches aren't kept in sync for long that can have security implications...

@matthiasbeyer matthiasbeyer deleted the add-linux-ck branch November 9, 2019 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants