liminix-fork/kernel/default.nix
Daniel Barlow 77922c875b add per-device overlay
presently this is used to reference the appropriate kernel and (if
needed) openwrt source trees, but I would not be surprised if we find
other uses
2022-10-15 18:55:33 +01:00

44 lines
959 B
Nix

{
callPackage
, buildPackages
, stdenvNoCC
, fetchFromGitHub
, config
, checkedConfig
, sources
}:
let
# The kernel is huge and takes a long time just to
# download and unpack. This derivation creates
# a source tree in a suitable shape to build from -
# today it just patches some scripts but as we add
# support for boards/SoCs we expect the scope of
# "pre-treatment" to grow
tree = stdenvNoCC.mkDerivation {
name = "spindled-kernel-tree";
src = sources.kernel;
phases = [ "unpackPhase" "patchPhase" "patchScripts" "installPhase" ];
patches = [ ./random.patch ];
patchScripts = ''
patchShebangs scripts/
'';
installPhase = ''
mkdir -p $out
cp -a . $out
'';
};
in rec {
vmlinux = callPackage ./vmlinux.nix {
inherit tree config checkedConfig;
};
uimage = callPackage ./uimage.nix { };
dtb = callPackage ./dtb.nix {
openwrt = sources.openwrt;
kernel = tree;
};
}