summary refs log tree commit diff
path: root/pkgs/build-support/kernel/initrd-compressor-meta.nix
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2020-09-04 18:18:32 +0200
committerLinus Heckemann <git@sphalerite.org>2020-12-17 11:37:04 +0100
commit14fbf575ecd47451dc1b2b3122f56ce8ac670030 (patch)
tree949750beda5e2f4dcfccd76410caf3792a66e8b0 /pkgs/build-support/kernel/initrd-compressor-meta.nix
parent2ee35e1fcecdae598651fd9b1452f451ac221384 (diff)
downloadnixpkgs-14fbf575ecd47451dc1b2b3122f56ce8ac670030.tar
nixpkgs-14fbf575ecd47451dc1b2b3122f56ce8ac670030.tar.gz
nixpkgs-14fbf575ecd47451dc1b2b3122f56ce8ac670030.tar.bz2
nixpkgs-14fbf575ecd47451dc1b2b3122f56ce8ac670030.tar.lz
nixpkgs-14fbf575ecd47451dc1b2b3122f56ce8ac670030.tar.xz
nixpkgs-14fbf575ecd47451dc1b2b3122f56ce8ac670030.tar.zst
nixpkgs-14fbf575ecd47451dc1b2b3122f56ce8ac670030.zip
make-initrd: various improvements
- Generate a link to the initramfs file with an appropriate file
  extension, guessed based on the compressor by default
- Use correct metadata in u-boot images if generated, up to now this
  was hardcoded to gzip and would silently generate an erroneous image
  if another compressor was specified
- Document all the parameters
- Improve cross-building compatibility, by allowing passing either a
  string as before, or a function taking a package set and returning the
  path to a compressor in the "compressor" argument of the
  function.
- Support more compression algorithms
- Place compressor executable function and arguments in passthru, for
  reuse when appending initramfses

Co-Authored-By: Dominik Xaver Hörl <hoe.dom@gmx.de>
Diffstat (limited to 'pkgs/build-support/kernel/initrd-compressor-meta.nix')
-rw-r--r--pkgs/build-support/kernel/initrd-compressor-meta.nix53
1 files changed, 53 insertions, 0 deletions
diff --git a/pkgs/build-support/kernel/initrd-compressor-meta.nix b/pkgs/build-support/kernel/initrd-compressor-meta.nix
new file mode 100644
index 00000000000..443e599a239
--- /dev/null
+++ b/pkgs/build-support/kernel/initrd-compressor-meta.nix
@@ -0,0 +1,53 @@
+rec {
+  cat = {
+    executable = pkgs: "cat";
+    ubootName = "none";
+    extension = ".cpio";
+  };
+  gzip = {
+    executable = pkgs: "${pkgs.gzip}/bin/gzip";
+    defaultArgs = ["-9n"];
+    ubootName = "gzip";
+    extension = ".gz";
+  };
+  bzip2 = {
+    executable = pkgs: "${pkgs.bzip2}/bin/bzip2";
+    ubootName = "bzip2";
+    extension = ".bz2";
+  };
+  xz = {
+    executable = pkgs: "${pkgs.xz}/bin/xz";
+    defaultArgs = ["--check=crc32" "--lzma2=dict=512KiB"];
+    extension = ".xz";
+  };
+  lzma = {
+    executable = pkgs: "${pkgs.xz}/bin/lzma";
+    defaultArgs = ["--check=crc32" "--lzma1=dict=512KiB"];
+    ubootName = "lzma";
+    extension = ".lzma";
+  };
+  lz4 = {
+    executable = pkgs: "${pkgs.lz4}/bin/lz4";
+    defaultArgs = ["-l"];
+    ubootName = "lz4";
+    extension = ".lz4";
+  };
+  lzop = {
+    executable = pkgs: "${pkgs.lzop}/bin/lzop";
+    ubootName = "lzo";
+    extension = ".lzo";
+  };
+  zstd = {
+    executable = pkgs: "${pkgs.zstd}/bin/zstd";
+    defaultArgs = ["-10"];
+    ubootName = "zstd";
+    extension = ".zst";
+  };
+  pigz = gzip // {
+    executable = pkgs: "${pkgs.pigz}/bin/pigz";
+  };
+  pixz = xz // {
+    executable = pkgs: "${pkgs.pixz}/bin/pixz";
+    defaultArgs = [];
+  };
+}