kernel-builder: Allow passing file directly
This can be used by more complex kernel builds. E.g. to use an
appended-dtb kernel file for a mainline-flavoured kernel build.
@@ -143,6 +143,15 @@ in
, isModular ? true
, kernelPatches ? []
+# Used as `.file` on the package to know the kernel image filename.
+, kernelFile ? kernelTarget + optionalString isImageGzDtb "-dtb"
+
+# Used to provide the default kernelFile
+, kernelFileExtension ? if isCompressed != false then ".${isCompressed}" else ""
+, kernelTarget ? if platform.linux-kernel.target == "Image"
+ then "${platform.linux-kernel.target}${kernelFileExtension}"
+ else platform.linux-kernel.target
+
, ...
} @ inputArgs:
@@ -175,10 +184,6 @@ let
'';
hasDTB = platform.linux-kernel ? DTB && platform.linux-kernel.DTB;
- kernelFileExtension = if isCompressed != false then ".${isCompressed}" else "";
- kernelTarget = if platform.linux-kernel.target == "Image"
- then "${platform.linux-kernel.target}${kernelFileExtension}"
- else platform.linux-kernel.target;
in
# This `let` block allows us to have a self-reference to this derivation.
@@ -523,7 +528,7 @@ stdenv.mkDerivation (inputArgs // {
kernelAtLeast = lib.versionAtLeast baseVersion;
# Used by consumers to refer to the kernel build product.
- file = kernelTarget + optionalString isImageGzDtb "-dtb";
+ file = kernelFile;
# Derivation with the as-built normalized kernel config
normalizedConfig = kernelDerivation.overrideAttrs({ ... }: {
