summary refs log tree commit diff
path: root/pkgs/build-support/kernel/make-initrd-ng.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/kernel/make-initrd-ng.nix')
-rw-r--r--pkgs/build-support/kernel/make-initrd-ng.nix13
1 files changed, 9 insertions, 4 deletions
diff --git a/pkgs/build-support/kernel/make-initrd-ng.nix b/pkgs/build-support/kernel/make-initrd-ng.nix
index 5f0a70f8a96..23ed9f3f74e 100644
--- a/pkgs/build-support/kernel/make-initrd-ng.nix
+++ b/pkgs/build-support/kernel/make-initrd-ng.nix
@@ -8,10 +8,12 @@ let
   # compression type and filename extension.
   compressorName = fullCommand: builtins.elemAt (builtins.match "([^ ]*/)?([^ ]+).*" fullCommand) 1;
 in
-{ stdenvNoCC, perl, cpio, ubootTools, lib, pkgsBuildHost, makeInitrdNGTool, patchelf, runCommand
+{ stdenvNoCC, perl, cpio, ubootTools, lib, pkgsBuildHost, makeInitrdNGTool, patchelf, binutils, runCommand
 # Name of the derivation (not of the resulting file!)
 , name ? "initrd"
 
+, strip ? true
+
 # Program used to compress the cpio archive; use "cat" for no compression.
 # This can also be a function which takes a package set and returns the path to the compressor,
 # such as `pkgs: "${pkgs.lzop}/bin/lzop"`.
@@ -59,7 +61,7 @@ in
 # If this isn't guessed, you may want to complete the metadata above and send a PR :)
 , uInitrdCompression ? _compressorMeta.ubootName or
     (throw "Unrecognised compressor ${_compressorName}, please specify uInitrdCompression")
-}: runCommand name {
+}: runCommand name ({
   compress = "${_compressorExecutable} ${lib.escapeShellArgs _compressorArgsReal}";
   passthru = {
     compressorExecutableFunction = _compressorFunction;
@@ -72,8 +74,11 @@ in
   passAsFile = ["contents"];
   contents = lib.concatMapStringsSep "\n" ({ object, symlink, ... }: "${object}\n${if symlink == null then "" else symlink}") contents + "\n";
 
-  nativeBuildInputs = [makeInitrdNGTool patchelf cpio] ++ lib.optional makeUInitrd ubootTools;
-} ''
+  nativeBuildInputs = [makeInitrdNGTool patchelf cpio] ++ lib.optional makeUInitrd ubootTools ++ lib.optional strip binutils;
+
+} // lib.optionalAttrs strip {
+  STRIP = "${(binutils.nativeDrv or binutils).targetPrefix}strip";
+}) ''
   mkdir ./root
   make-initrd-ng "$contentsPath" ./root
   mkdir "$out"