guix-patches
[Top][All Lists]
Advanced

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

[bug#27521] [PATCH v3] build: Add iso9660 system image generator.


From: Danny Milosavljevic
Subject: [bug#27521] [PATCH v3] build: Add iso9660 system image generator.
Date: Thu, 29 Jun 2017 00:48:35 +0200

* gnu/bootloader/grub.scm (install-grub-mkrescue-image): New variable.
(grub-mkrescue-bootloader): New variable.  Export it.
* build-aux/hydra/gnu-system.scm (qemu-jobs): Add 'iso9660-image .
* gnu/system/vm.scm (qemu-image): Add #:make-disk-image? parameter.
(system-disk-image): Pass #:make-disk-image? parameter to qemu-image.
---
 build-aux/hydra/gnu-system.scm | 10 ++++++++++
 gnu/bootloader/grub.scm        | 21 +++++++++++++++++++++
 gnu/system/vm.scm              | 10 ++++++++--
 3 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/build-aux/hydra/gnu-system.scm b/build-aux/hydra/gnu-system.scm
index eeb7183a4..645ec6c94 100644
--- a/build-aux/hydra/gnu-system.scm
+++ b/build-aux/hydra/gnu-system.scm
@@ -162,6 +162,16 @@ system.")
                        (set-guile-for-build (default-guile))
                        (system-disk-image installation-os
                                           #:disk-image-size
+                                          (* 1024 MiB)))))
+            (->job 'iso9660-image
+                   (run-with-store store
+                     (mbegin %store-monad
+                       (set-guile-for-build (default-guile))
+                       (system-disk-image (inherit installation-os
+                                            (bootloader 
(bootloader-configuration
+                                                          (bootloader 
grub-mkrescue-bootloader))))
+                                          #:file-system-type "iso9660"
+                                          #:disk-image-size
                                           (* 1024 MiB))))))
       '()))
 
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index f1cc3324d..82717a327 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -54,6 +54,7 @@
 
             grub-bootloader
             grub-efi-bootloader
+            grub-mkrescue-bootloader
 
             grub-configuration))
 
@@ -388,6 +389,20 @@ submenu \"GNU system, old configurations...\" {~%")
                                 device))
           (error "failed to install GRUB")))))
 
+(define install-grub-mkrescue-image
+  #~(lambda (bootloader device mount-point)
+      ;; Install an iso9660 image containing the entire system which is 
mounted at MOUNT-POINT.
+      (let ((grub-mkrescue (string-append bootloader "/bin/grub-mkrescue"))
+            (installation-file (string-append "/xchg/boot.iso")))
+        ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or
+        ;; root partition.
+        (setenv "GRUB_ENABLE_CRYPTODISK" "y")
+
+        (unless (zero? (system* grub-mkrescue "-o" installation-file "/" "--"
+                                "-volid" "GUIXSD"
+                                "-volume_date" "uuid" "2007010203040506"))
+          (error "failed to install grub-mkrescue's ISO9660 image")))))
+
 
 
 ;;;
@@ -408,6 +423,12 @@ submenu \"GNU system, old configurations...\" {~%")
    (name 'grub-efi)
    (package grub-efi)))
 
+(define* grub-mkrescue-bootloader
+  (bootloader
+   (inherit grub-bootloader)
+   (name 'grub-mkrescue)
+   (installer install-grub-mkrescue-image)))
+
 
 ;;;
 ;;; Compatibility macros.
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 392737d07..e7ae17383 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -174,6 +174,7 @@ made available under the /xchg CIFS share."
                      (name "qemu-image")
                      (system (%current-system))
                      (qemu qemu-minimal)
+                     (make-disk-image? #t)
                      (disk-image-size (* 100 (expt 2 20)))
                      (disk-image-format "qcow2")
                      (file-system-type "ext4")
@@ -258,7 +259,7 @@ the image."
                                    #$(bootloader-installer bootloader))
              (reboot)))))
    #:system system
-   #:make-disk-image? #t
+   #:make-disk-image? make-disk-image?
    #:disk-image-size disk-image-size
    #:disk-image-format disk-image-format
    #:references-graphs inputs))
@@ -313,9 +314,14 @@ to USB sticks meant to be read-only."
                   #:bootcfg-drv bootcfg
                   #:bootloader (bootloader-configuration-bootloader
                                 (operating-system-bootloader os))
+                  #:make-disk-image? (not (string=? "iso9660"
+                                                    file-system-type))
                   #:disk-image-size disk-image-size
                   #:disk-image-format "raw"
-                  #:file-system-type file-system-type
+                  #:file-system-type (if (string=? "iso9660"
+                                                   file-system-type)
+                                         "ext4"
+                                         file-system-type)
                   #:file-system-label root-label
                   #:copy-inputs? #t
                   #:register-closures? #t





reply via email to

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