summary refs log tree commit diff
path: root/gnu/system
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2024-05-12 20:51:50 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2024-05-29 22:01:23 -0400
commitafacfa33ec4b52cb9ffb9b0a7a0c1e68cf264673 (patch)
tree9d811f1d85d4ae892604ca421d653ea53fb654a0 /gnu/system
parentb72b6063cebbcfd64d43f5b05ba8470eb11c3f65 (diff)
downloadguix-afacfa33ec4b52cb9ffb9b0a7a0c1e68cf264673.tar.gz
gnu: linux-libre: Enable Zstd compression of kernel modules.
This brings the on disk size of the kernel from 164 MiB to 144 MiB, or about
12%.

* gnu/packages/linux.scm (default-extra-linux-options)
[version>=5.13]: Enable CONFIG_MODULE_COMPRESS_ZSTD, else
CONFIG_MODULE_COMPRESS_GZIP.
(make-linux-libre*) [phases] {set-environment}: Set ZSTD_CLEVEL environment
variable to 19.
[native-inputs]: Add zstd.
* gnu/build/linux-modules.scm (module-regex): Add .zst to regexp.  Update doc.
(modinfo-section-contents): Extend support to Zstd compressed module.
(dot-ko): Register the 'zstd compression type.
(ensure-dot-ko, file-name->module-name, load-linux-module*)
(module-name->file-name/guess, write-module-name-database)
(write-module-alias-database, write-module-device-database): Update doc.
(module-name-lookup): Also consider zstd-compressed modules.
* gnu/installer.scm (installer-program): Add guile-zstd extension to gexp.
* gnu/system/linux-initrd.scm (flat-linux-module-directory): Likewise.
Decompress zstd-compressed modules for use in initrd.
* guix/profiles.scm (linux-module-database): Add guile-zstd extension to gexp.

Change-Id: Ide899dc5c58ea5033583b1a91a92c025fc8d901a
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/linux-initrd.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index d448c78918..f902637e48 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -128,7 +128,7 @@ MODULES and taken from LINUX."
 
   (define build-exp
     (with-imported-modules imported-modules
-      (with-extensions (list guile-zlib)
+      (with-extensions (list guile-zlib guile-zstd)
         #~(begin
             (use-modules (gnu build linux-modules)
                          (guix build utils)
@@ -168,7 +168,9 @@ MODULES and taken from LINUX."
               ;; is already gzipped as a whole.
               (cond
                ((string-contains file ".ko.gz")
-                (invoke #+(file-append gzip "/bin/gunzip") file))))
+                (invoke #+(file-append gzip "/bin/gunzip") file))
+               ((string-contains file ".ko.zst")
+                (invoke #+(file-append zstd "/bin/zstd") "-d" file))))
 
             (mkdir #$output)
             (for-each (lambda (module)