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

matthiasbeyer commented Apr 7, 2019

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);

This comment has been minimized.

Copy link
@teto

teto Apr 7, 2019

Contributor

do we really want these aliases ?

@teto

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

matthiasbeyer commented Apr 7, 2019

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

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

@vcunat

This comment has been minimized.

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 {

This comment has been minimized.

Copy link
@worldofpeace

worldofpeace Apr 7, 2019

Member
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.

This comment has been minimized.

Copy link
@matthiasbeyer

matthiasbeyer Apr 8, 2019

Author Contributor

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

This comment has been minimized.

Copy link
@matthiasbeyer

matthiasbeyer Apr 8, 2019

Author Contributor

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

@matthiasbeyer

This comment has been minimized.

Copy link
Contributor Author

matthiasbeyer commented Apr 8, 2019

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

@worldofpeace

This comment has been minimized.

Copy link
Member

worldofpeace commented Apr 8, 2019

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

This comment has been minimized.

Copy link
Contributor Author

matthiasbeyer commented Apr 8, 2019

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;

This comment has been minimized.

Copy link
@matthiasbeyer

matthiasbeyer Apr 8, 2019

Author Contributor

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)?

This comment has been minimized.

Copy link
@matthiasbeyer

matthiasbeyer Apr 8, 2019

Author Contributor
[...]
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 

This comment has been minimized.

Copy link
@worldofpeace

worldofpeace Apr 8, 2019

Member

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

This comment has been minimized.

Copy link
Contributor Author

matthiasbeyer commented Apr 8, 2019

@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

This comment has been minimized.

Copy link
Contributor Author

matthiasbeyer commented Apr 10, 2019

Here we go with another approach.

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

@matthiasbeyer

This comment has been minimized.

Copy link
Contributor Author

matthiasbeyer commented Apr 10, 2019

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

@worldofpeace

This comment has been minimized.

Copy link
Member

worldofpeace commented Apr 10, 2019

@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

This comment has been minimized.

Copy link
Member

worldofpeace commented Apr 10, 2019

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

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

@matthiasbeyer matthiasbeyer force-pushed the matthiasbeyer:add-linux-ck branch from 42314b6 to f4746da Apr 10, 2019
@matthiasbeyer

This comment has been minimized.

Copy link
Contributor Author

matthiasbeyer commented Apr 10, 2019

Lets see...

@matthiasbeyer

This comment has been minimized.

Copy link
Contributor Author

matthiasbeyer commented Apr 10, 2019

nope.

@matthiasbeyer matthiasbeyer force-pushed the matthiasbeyer:add-linux-ck branch from f4746da to 61dfb6d May 2, 2019
@ofborg ofborg bot removed the 6.topic: kernel label May 2, 2019
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 matthiasbeyer force-pushed the matthiasbeyer:add-linux-ck branch from 5788a9f to 6c8b2d2 May 18, 2019
@matthiasbeyer

This comment has been minimized.

Copy link
Contributor Author

matthiasbeyer commented May 18, 2019

Any ideas here?

@worldofpeace

This comment has been minimized.

Copy link
Member

worldofpeace commented May 18, 2019

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 matthiasbeyer:add-linux-ck branch Nov 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.