default.nix (2516B)
1 { stdenv 2 , git 3 , python2 4 , which 5 , fetchgit 6 , fetchpatch 7 , fetchFromGitHub 8 , autoreconfHook 9 , coccinelle 10 }: 11 let 12 donorTree = fetchFromGitHub { 13 owner = "torvalds"; 14 repo = "linux"; 15 rev = "e2c1a934fd8e4288e7a32f4088ceaccf469eb74c"; # 5.15.94 16 hash= "sha256-Jg3EgL86CseuzYMAlUG3CDWPCo8glMSIZs10l7EuhWI="; 17 }; 18 backports = stdenv.mkDerivation { 19 name = "linux-backports"; 20 version = "dfe0f60ca8a"; 21 nativeBuildInputs = [ python2 ]; 22 23 src = fetchgit { 24 url = "https://git.kernel.org/pub/scm/linux/kernel/git/backports/backports.git"; 25 name = "backports"; 26 rev = "dfe0f60ca8a1065e63b4db703b3bd2708ee23a0e"; 27 hash = "sha256-V+unO0rCom+TZS7WuaXFrb3C1EBImmflCPuOoP+LvBY="; 28 }; 29 buildPhase = '' 30 patchShebangs . 31 ''; 32 installPhase = '' 33 mkdir -p $out 34 cp -a . $out 35 rm $out/patches/0073-netdevice-mtu-range.cocci 36 # fq.patch is obsoleted by kernel commit 48a54f6bc45 and no longer 37 # applies 38 # rm $out/patches/0091-fq-no-siphash_key_t/fq.patch 39 # don't know why this doesn't apply but it's only important for 40 # compiling against linux < 4.1 41 # rm $out/patches/0058-ptp_getsettime64/ptp_getsettime64.cocci 42 ''; 43 patches = [ 44 # (fetchpatch { 45 # url = "https://github.com/telent/nixwrt/blob/28ff2559e811c740b0a2922f52291b335804857b/nixwrt/kernel/gentree-writable-outputs.patch"; 46 # hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; 47 # })# 48 ./gentree-writable-outputs.patch 49 # ./update-usb-sg-backport-patch.patch 50 # ./backport_kfree_sensitive.patch 51 ]; 52 }; 53 in stdenv.mkDerivation rec { 54 inherit donorTree; 55 KERNEL_VERSION = builtins.substring 0 11 donorTree.rev; 56 BACKPORTS_VERSION = backports.version; 57 name = "backported-kernel-${KERNEL_VERSION}-${BACKPORTS_VERSION}"; 58 59 # gentree uses "which" at runtime to test for the presence of git, 60 # and I don't have the patience to patch it out. There is no other 61 # reason we need either of them as build inputs. 62 depsBuildBuild = [ coccinelle ]; 63 nativeBuildInputs = [ which git python2 ]; 64 65 phases = [ 66 "backportFromFuture" "installPhase" 67 ]; 68 69 backportFromFuture = '' 70 echo $KERNEL_VERSION $BACKPORTS_VERSION 71 WORK=`pwd`/build 72 mkdir -p $WORK 73 cat ${backports}/copy-list > copy-list 74 echo 'include/linux/key.h' >> copy-list 75 python ${backports}/gentree.py --verbose --clean --copy-list copy-list ${donorTree} $WORK 76 ''; 77 installPhase = '' 78 cp -a ./build/ $out 79 ''; 80 }