guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch wip-disk-image updated: iso: Make compression optional.


From: guix-commits
Subject: branch wip-disk-image updated: iso: Make compression optional.
Date: Fri, 24 Apr 2020 06:05:07 -0400

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch wip-disk-image
in repository guix.

The following commit(s) were added to refs/heads/wip-disk-image by this push:
     new d67caab  iso: Make compression optional.
d67caab is described below

commit d67caab385791ff4e33598dcc9c6c94bd8e7c29f
Author: Mathieu Othacehe <address@hidden>
AuthorDate: Fri Apr 24 12:04:20 2020 +0200

    iso: Make compression optional.
---
 gnu/build/disk-image.scm | 41 ++++++++++++++++++++++++++++++++++-------
 gnu/system/image.scm     |  9 ++-------
 2 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/gnu/build/disk-image.scm b/gnu/build/disk-image.scm
index 05b40bb..0dcc4a8 100644
--- a/gnu/build/disk-image.scm
+++ b/gnu/build/disk-image.scm
@@ -149,15 +149,17 @@ deduplicates files common to CLOSURE and the rest of 
PREFIX."
                                   #:deduplicate? deduplicate?))
               references-graphs))
 
-  (install-boot-config bootcfg bootcfg-location root)
+  (when bootcfg
+    (install-boot-config bootcfg bootcfg-location root)
 
-  ;; Register BOOTCFG as a GC root.
-  (register-bootcfg-root root bootcfg))
+    ;; Register BOOTCFG as a GC root.
+    (register-bootcfg-root root bootcfg)))
 
 (define* (make-iso9660-image xorriso grub-mkrescue-environment
                              grub bootcfg system-directory root target
                              #:key (volume-id "Guix_image") (volume-uuid #f)
-                             register-closures? (references-graphs '()))
+                             register-closures? (references-graphs '())
+                             (compression? #t))
   "Given a GRUB package, creates an iso image as TARGET, using BOOTCFG as
 GRUB configuration and OS-DRV as the stuff in it."
   (define grub-mkrescue
@@ -212,11 +214,36 @@ GRUB configuration and OS-DRV as the stuff in it."
          (string-append "boot/grub/grub.cfg=" bootcfg)
          root
          "--"
-         "-volid" (string-upcase volume-id)
-         (if volume-uuid
+         ;; Set all timestamps to 1.
+         "-volume_date" "all_file_dates" "=1"
+
+         `(,@(if compression?
+                 '(;; ‘zisofs’ compression reduces the total image size by
+                   ;; ~60%.
+                   "-zisofs" "level=9:block_size=128k" ; highest compression
+                   ;; It's transparent to our Linux-Libre kernel but not to
+                   ;; GRUB.  Don't compress the kernel, initrd, and other
+                   ;; files read by grub.cfg, as well as common
+                   ;; already-compressed file names.
+                   "-find" "/" "-type" "f"
+                   ;; XXX Even after "--" above, and despite documentation
+                   ;; claiming otherwise, "-or" is stolen by grub-mkrescue
+                   ;; which then chokes on it (as ‘-o …’) and dies.  Don't use
+                   ;; "-or".
+                   "-not" "-wholename" "/boot/*"
+                   "-not" "-wholename" "/System/*"
+                   "-not" "-name" "unicode.pf2"
+                   "-not" "-name" "bzImage"
+                   "-not" "-name" "*.gz"   ; initrd & all man pages
+                   "-not" "-name" "*.png"  ; includes grub-image.png
+                   "-exec" "set_filter" "--zisofs"
+                   "--")
+                 '())
+           "-volid" ,(string-upcase volume-id)
+           ,@(if volume-uuid
              `("-volume_date" "uuid"
                ,(string-filter (lambda (value)
                                  (not (char=? #\- value)))
                                (iso9660-uuid->string
                                 volume-uuid)))
-             `())))
+             '()))))
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index 916f4d4..20d0e47 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -311,13 +311,7 @@ image ~a {
            (initialize-root-partition #$output
                                       #:references-graphs '#$graph
                                       #:deduplicate? #f
-                                      #:system-directory #$os
-                                      #:bootloader-package
-                                      #$(bootloader-package bootloader)
-                                      #:bootcfg #$bootcfg
-                                      #:bootcfg-location
-                                      #$(bootloader-configuration-file
-                                         bootloader))))
+                                      #:system-directory #$os)))
          (image-root
           (computed-file "image-root" root-builder
                          #:options `(#:references-graphs ,inputs)))
@@ -335,6 +329,7 @@ image ~a {
                                  #$output
                                  #:references-graphs '#$graph
                                  #:register-closures? #t
+                                 #:compression? #f
                                  #:volume-id #$root-iso-label
                                  #:volume-uuid #$(and=> uuid
                                                         uuid-bytevector))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]