all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#27521] [PATCH] build: Add iso9660 system image generator.
@ 2017-06-28 22:03 Danny Milosavljevic
  2017-06-28 22:22 ` [bug#27521] [PATCH v2] " Danny Milosavljevic
                   ` (4 more replies)
  0 siblings, 5 replies; 27+ messages in thread
From: Danny Milosavljevic @ 2017-06-28 22:03 UTC (permalink / raw)
  To: 27521

* 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-in-usb-image .
---
 build-aux/hydra/gnu-system.scm | 12 +++++++++++-
 gnu/bootloader/grub.scm        | 21 +++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/build-aux/hydra/gnu-system.scm b/build-aux/hydra/gnu-system.scm
index eeb7183a4..aa396df0c 100644
--- a/build-aux/hydra/gnu-system.scm
+++ b/build-aux/hydra/gnu-system.scm
@@ -162,7 +162,17 @@ system.")
                        (set-guile-for-build (default-guile))
                        (system-disk-image installation-os
                                           #:disk-image-size
-                                          (* 1024 MiB))))))
+                                          (* 1024 MiB)))))
+            (->job 'iso9660-image-in-usb-image
+                   (run-with-store store
+                     (mbegin %store-monad
+                       (set-guile-for-build (default-guile))
+                       ;; TODO extract /boot/boot.iso from the resulting image and just retain that.
+                       (system-disk-image (inherit installation-os
+                                            (bootloader (bootloader-configuration
+                                                          (bootloader grub-mkrescue-bootloader))))
+                                          #:disk-image-size
+                                          (* 2048 MiB))))))
       '()))
 
 (define (system-test-jobs store system)
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index f1cc3324d..7a32d7f8d 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 mount-point "/boot/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")))))
+
 \f
 
 ;;;
@@ -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)))
+
 \f
 ;;;
 ;;; Compatibility macros.

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH v2] build: Add iso9660 system image generator.
  2017-06-28 22:03 [bug#27521] [PATCH] build: Add iso9660 system image generator Danny Milosavljevic
@ 2017-06-28 22:22 ` Danny Milosavljevic
  2017-06-28 22:48 ` [bug#27521] [PATCH v3] " Danny Milosavljevic
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 27+ messages in thread
From: Danny Milosavljevic @ 2017-06-28 22:22 UTC (permalink / raw)
  To: 27521

* 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-in-usb-image .
---
 build-aux/hydra/gnu-system.scm | 12 +++++++++++-
 gnu/bootloader/grub.scm        | 21 +++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/build-aux/hydra/gnu-system.scm b/build-aux/hydra/gnu-system.scm
index eeb7183a4..aa396df0c 100644
--- a/build-aux/hydra/gnu-system.scm
+++ b/build-aux/hydra/gnu-system.scm
@@ -162,7 +162,17 @@ system.")
                        (set-guile-for-build (default-guile))
                        (system-disk-image installation-os
                                           #:disk-image-size
-                                          (* 1024 MiB))))))
+                                          (* 1024 MiB)))))
+            (->job 'iso9660-image-in-usb-image
+                   (run-with-store store
+                     (mbegin %store-monad
+                       (set-guile-for-build (default-guile))
+                       ;; TODO extract /boot/boot.iso from the resulting image and just retain that.
+                       (system-disk-image (inherit installation-os
+                                            (bootloader (bootloader-configuration
+                                                          (bootloader grub-mkrescue-bootloader))))
+                                          #:disk-image-size
+                                          (* 2048 MiB))))))
       '()))
 
 (define (system-test-jobs store system)
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")))))
+
 \f
 
 ;;;
@@ -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)))
+
 \f
 ;;;
 ;;; Compatibility macros.

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH v3] build: Add iso9660 system image generator.
  2017-06-28 22:03 [bug#27521] [PATCH] build: Add iso9660 system image generator Danny Milosavljevic
  2017-06-28 22:22 ` [bug#27521] [PATCH v2] " Danny Milosavljevic
@ 2017-06-28 22:48 ` Danny Milosavljevic
  2017-06-29  2:09 ` [bug#27521] [PATCH v4] " Danny Milosavljevic
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 27+ messages in thread
From: Danny Milosavljevic @ 2017-06-28 22:48 UTC (permalink / raw)
  To: 27521

* 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")))))
+
 \f
 
 ;;;
@@ -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)))
+
 \f
 ;;;
 ;;; 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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH v4] build: Add iso9660 system image generator.
  2017-06-28 22:03 [bug#27521] [PATCH] build: Add iso9660 system image generator Danny Milosavljevic
  2017-06-28 22:22 ` [bug#27521] [PATCH v2] " Danny Milosavljevic
  2017-06-28 22:48 ` [bug#27521] [PATCH v3] " Danny Milosavljevic
@ 2017-06-29  2:09 ` Danny Milosavljevic
  2017-06-29 13:47   ` [bug#27521] [PATCH v5] " Danny Milosavljevic
  2017-06-29  3:17 ` [bug#27521] [PATCH] linux-initrd: Add isofs if necessary Danny Milosavljevic
  2017-07-03 18:02 ` [bug#27521] [PATCH] guix system: Add file system label and uuid to iso9660-image Danny Milosavljevic
  4 siblings, 1 reply; 27+ messages in thread
From: Danny Milosavljevic @ 2017-06-29  2:09 UTC (permalink / raw)
  To: 27521

* build-aux/hydra/gnu-system.scm (qemu-jobs): Add 'iso9660-image .
* guix/script/system.scm: Add "iso9660-disk-image" action.
* gnu/build/vm.scm (make-iso9660-image): New variable.  Export it.
* gnu/system/vm.scm (iso9660-image): New variable.  Use make-iso9660-image.
(system-disk-image): Use iso9660-image.
---
 build-aux/hydra/gnu-system.scm |  7 ++++
 gnu/build/vm.scm               | 13 ++++++-
 gnu/system/vm.scm              | 83 +++++++++++++++++++++++++++++++++++-------
 guix/scripts/system.scm        | 20 ++++++----
 4 files changed, 102 insertions(+), 21 deletions(-)

diff --git a/build-aux/hydra/gnu-system.scm b/build-aux/hydra/gnu-system.scm
index eeb7183a4..0b49ce971 100644
--- a/build-aux/hydra/gnu-system.scm
+++ b/build-aux/hydra/gnu-system.scm
@@ -162,6 +162,13 @@ 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 installation-os
+                                          #:disk-image-size
                                           (* 1024 MiB))))))
       '()))
 
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 57619764c..f2ef923b8 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -48,7 +48,8 @@
 
             root-partition-initializer
             initialize-partition-table
-            initialize-hard-disk))
+            initialize-hard-disk
+            make-iso9660-image))
 
 ;;; Commentary:
 ;;;
@@ -344,6 +345,16 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
                             (string-append "boot/grub/grub.cfg=" config-file)))
       (error "failed to create GRUB EFI image"))))
 
+(define (make-iso9660-image grub config-file os-drv target)
+  "Given a GRUB package, creates an iso image as TARGET, using CONFIG-FILE as
+Grub configuration and OS-DRV as the stuff in it."
+  (let ((grub-mkrescue (string-append grub "/bin/grub-mkrescue")))
+    (unless (zero? (system* grub-mkrescue "-o" target
+                            (string-append "boot/grub/grub.cfg=" config-file)
+                            (string-append "gnu/store=" os-drv "/..")
+                            "--" "-volid" "GUIXSD"))
+      (error "failed to create ISO image"))))
+
 (define* (initialize-hard-disk device
                                #:key
                                bootloader-package
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 392737d07..5a865d24b 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -34,6 +34,7 @@
                 #:select (qemu-command))
   #:use-module (gnu packages base)
   #:use-module (gnu packages bootloaders)
+  #:use-module (gnu packages cdrom)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages bash)
@@ -170,6 +171,51 @@ made available under the /xchg CIFS share."
                       #:guile-for-build guile-for-build
                       #:references-graphs references-graphs)))
 
+(define* (iso9660-image #:key
+                        (name "iso9660-image")
+                        (system (%current-system))
+                        (qemu qemu-minimal)
+                        os-drv
+                        bootcfg-drv
+                        bootloader
+                        (inputs '()))
+  "Return a bootable, stand-alone iso9660 image.
+
+INPUTS is a list of inputs (as for packages)."
+  (expression->derivation-in-linux-vm
+   name
+   (with-imported-modules (source-module-closure '((gnu build vm)
+                                                   (guix build utils)))
+     #~(begin
+         (use-modules (gnu build vm)
+                      (guix build utils))
+
+         (let ((inputs
+                '#$(append (list qemu parted e2fsprogs dosfstools xorriso)
+                           (map canonical-package
+                                (list sed grep coreutils findutils gawk))))
+
+               ;; This variable is unused but allows us to add INPUTS-TO-COPY
+               ;; as inputs.
+               (to-register
+                '#$(map (match-lambda
+                          ((name thing) thing)
+                          ((name thing output) `(,thing ,output)))
+                        inputs)))
+
+           (set-path-environment-variable "PATH" '("bin" "sbin") inputs)
+           (mkdir-p "/tmp")
+           ;(mount "none" "/tmp" "tmpfs")
+           ;(mkdir-p "/tmp/extra")
+           (make-iso9660-image #$(bootloader-package bootloader)
+                               #$bootcfg-drv
+                               #$os-drv
+                               "/xchg/guixsd.iso")
+           (reboot))))
+   #:system system
+   #:make-disk-image? #f
+   #:references-graphs inputs))
+
 (define* (qemu-image #:key
                      (name "qemu-image")
                      (system (%current-system))
@@ -308,19 +354,30 @@ to USB sticks meant to be read-only."
 
     (mlet* %store-monad ((os-drv   (operating-system-derivation os))
                          (bootcfg  (operating-system-bootcfg os)))
-      (qemu-image #:name name
-                  #:os-drv os-drv
-                  #:bootcfg-drv bootcfg
-                  #:bootloader (bootloader-configuration-bootloader
-                                (operating-system-bootloader os))
-                  #:disk-image-size disk-image-size
-                  #:disk-image-format "raw"
-                  #:file-system-type file-system-type
-                  #:file-system-label root-label
-                  #:copy-inputs? #t
-                  #:register-closures? #t
-                  #:inputs `(("system" ,os-drv)
-                             ("bootcfg" ,bootcfg))))))
+      (if (string=? "iso9660" file-system-type)
+          (iso9660-image #:name name
+                         #:os-drv os-drv
+                         #:bootcfg-drv bootcfg
+                         #:bootloader (bootloader-configuration-bootloader
+                                        (operating-system-bootloader os))
+                         #:inputs `(("system" ,os-drv)
+                                    ("bootcfg" ,bootcfg)))
+          (qemu-image #:name name
+                      #:os-drv os-drv
+                      #:bootcfg-drv bootcfg
+                      #:bootloader (bootloader-configuration-bootloader
+                                    (operating-system-bootloader os))
+                      #:disk-image-size disk-image-size
+                      #:disk-image-format "raw"
+                      #:file-system-type (if (string=? "iso9660"
+                                                       file-system-type)
+                                             "ext4"
+                                             file-system-type)
+                      #:file-system-label root-label
+                      #:copy-inputs? #t
+                      #:register-closures? #t
+                      #:inputs `(("system" ,os-drv)
+                                 ("bootcfg" ,bootcfg)))))))
 
 (define* (system-qemu-image os
                             #:key
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 35675cc01..da0f5b04b 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -578,7 +578,9 @@ PATTERN, a string.  When PATTERN is #f, display all the system generations."
                                                 (* 70 (expt 2 20)))
                                             #:mappings mappings))
     ((disk-image)
-     (system-disk-image os #:disk-image-size image-size))))
+     (system-disk-image os #:disk-image-size image-size))
+    ((iso9660-disk-image)
+     (system-disk-image os #:file-system-type "iso9660"))))
 
 (define (maybe-suggest-running-guix-pull)
   "Suggest running 'guix pull' if this has never been done before."
@@ -616,7 +618,8 @@ and TARGET arguments."
   "Perform ACTION for OS.  INSTALL-BOOTLOADER? specifies whether to install
 bootloader; DEVICE is the target devices for bootloader; TARGET is the target
 root directory; IMAGE-SIZE is the size of the image to be built, for the
-'vm-image' and 'disk-image' actions.  FULL-BOOT? is used for the 'vm' action;
+'vm-image', 'iso9660-disk-image' and 'disk-image' actions.
+FULL-BOOT? is used for the 'vm' action;
 it determines whether to boot directly to the kernel or to the bootloader.
 
 When DERIVATIONS-ONLY? is true, print the derivation file name(s) without
@@ -764,6 +767,8 @@ Some ACTIONS support additional ARGS.\n"))
   (display (G_ "\
    init             initialize a root file system to run GNU\n"))
   (display (G_ "\
+   iso9660-disk-image  build a disk image, suitable for a CD or DVD\n"))
+  (display (G_ "\
    extension-graph  emit the service extension graph in Dot format\n"))
   (display (G_ "\
    shepherd-graph   emit the graph of shepherd services in Dot format\n"))
@@ -781,9 +786,9 @@ Some ACTIONS support additional ARGS.\n"))
   (display (G_ "
       --share=SPEC       for 'vm', share host file system according to SPEC"))
   (display (G_ "
-  -r, --root=FILE        for 'vm', 'vm-image', 'disk-image', 'container',
-                         and 'build', make FILE a symlink to the result, and
-                         register it as a garbage collector root"))
+  -r, --root=FILE        for 'vm', 'vm-image', 'disk-image', 'iso9660-disk-image',
+                         'container', and 'build', make FILE a symlink to the
+                         result, and register it as a garbage collector root"))
   (display (G_ "
       --expose=SPEC      for 'vm', expose host file system according to SPEC"))
   (display (G_ "
@@ -957,7 +962,8 @@ argument list and OPTS is the option alist."
         (alist-cons 'argument arg result)
         (let ((action (string->symbol arg)))
           (case action
-            ((build container vm vm-image disk-image reconfigure init
+            ((build container vm vm-image disk-image iso9660-disk-image
+              reconfigure init
               extension-graph shepherd-graph list-generations roll-back
               switch-generation)
              (alist-cons 'action action result))
@@ -987,7 +993,7 @@ argument list and OPTS is the option alist."
         (exit 1))
 
       (case action
-        ((build container vm vm-image disk-image reconfigure)
+        ((build container vm vm-image disk-image iso9660-disk-image reconfigure)
          (unless (= count 1)
            (fail)))
         ((init)

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] linux-initrd: Add isofs if necessary.
  2017-06-28 22:03 [bug#27521] [PATCH] build: Add iso9660 system image generator Danny Milosavljevic
                   ` (2 preceding siblings ...)
  2017-06-29  2:09 ` [bug#27521] [PATCH v4] " Danny Milosavljevic
@ 2017-06-29  3:17 ` Danny Milosavljevic
  2017-07-02 14:56   ` Ludovic Courtès
  2017-07-03 18:02 ` [bug#27521] [PATCH] guix system: Add file system label and uuid to iso9660-image Danny Milosavljevic
  4 siblings, 1 reply; 27+ messages in thread
From: Danny Milosavljevic @ 2017-06-29  3:17 UTC (permalink / raw)
  To: 27521

* gnu/system/linux-initrd.scm (base-initrd): Add isofs.
---
 gnu/system/linux-initrd.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 3a5e76034..89caf8325 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -285,6 +285,9 @@ loaded at boot time in the order in which they appear."
       ,@(if (find (file-system-type-predicate "btrfs") file-systems)
             '("btrfs")
             '())
+      ,@(if (find (file-system-type-predicate "iso9660") file-systems)
+            '("isofs")
+            '())
       ,@(if volatile-root?
             '("fuse")
             '())

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH v5] build: Add iso9660 system image generator.
  2017-06-29  2:09 ` [bug#27521] [PATCH v4] " Danny Milosavljevic
@ 2017-06-29 13:47   ` Danny Milosavljevic
  2017-06-30 10:13     ` Danny Milosavljevic
  2017-07-02 14:55     ` Ludovic Courtès
  0 siblings, 2 replies; 27+ messages in thread
From: Danny Milosavljevic @ 2017-06-29 13:47 UTC (permalink / raw)
  To: 27521

* build-aux/hydra/gnu-system.scm (qemu-jobs): Add 'iso9660-image .
* guix/script/system.scm: Add "iso9660-disk-image" action.
* gnu/build/vm.scm (make-iso9660-image): New variable.  Export it.
* gnu/system/vm.scm (iso9660-image): New variable.  Use make-iso9660-image.
(system-disk-image): Use iso9660-image.
---
 build-aux/hydra/gnu-system.scm |  7 ++++
 gnu/build/vm.scm               | 17 ++++++++-
 gnu/system/vm.scm              | 83 +++++++++++++++++++++++++++++++++++-------
 guix/scripts/system.scm        | 20 ++++++----
 4 files changed, 106 insertions(+), 21 deletions(-)

diff --git a/build-aux/hydra/gnu-system.scm b/build-aux/hydra/gnu-system.scm
index eeb7183a4..0b49ce971 100644
--- a/build-aux/hydra/gnu-system.scm
+++ b/build-aux/hydra/gnu-system.scm
@@ -162,6 +162,13 @@ 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 installation-os
+                                          #:disk-image-size
                                           (* 1024 MiB))))))
       '()))
 
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 57619764c..e930e4c86 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -48,7 +48,8 @@
 
             root-partition-initializer
             initialize-partition-table
-            initialize-hard-disk))
+            initialize-hard-disk
+            make-iso9660-image))
 
 ;;; Commentary:
 ;;;
@@ -344,6 +345,20 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
                             (string-append "boot/grub/grub.cfg=" config-file)))
       (error "failed to create GRUB EFI image"))))
 
+(define (make-iso9660-image grub config-file os-drv target)
+  "Given a GRUB package, creates an iso image as TARGET, using CONFIG-FILE as
+Grub configuration and OS-DRV as the stuff in it."
+  (let ((grub-mkrescue (string-append grub "/bin/grub-mkrescue")))
+    (mkdir-p "/tmp/root/var/run")
+    (mkdir-p "/tmp/root/run")
+    (unless (zero? (system* grub-mkrescue "-o" target
+                            (string-append "boot/grub/grub.cfg=" config-file)
+                            (string-append "gnu/store=" os-drv "/..")
+                            "var=/tmp/root/var"
+                            "run=/tmp/root/run"
+                            "--" "-volid" "GUIXSD"))
+      (error "failed to create ISO image"))))
+
 (define* (initialize-hard-disk device
                                #:key
                                bootloader-package
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 392737d07..5a865d24b 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -34,6 +34,7 @@
                 #:select (qemu-command))
   #:use-module (gnu packages base)
   #:use-module (gnu packages bootloaders)
+  #:use-module (gnu packages cdrom)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages bash)
@@ -170,6 +171,51 @@ made available under the /xchg CIFS share."
                       #:guile-for-build guile-for-build
                       #:references-graphs references-graphs)))
 
+(define* (iso9660-image #:key
+                        (name "iso9660-image")
+                        (system (%current-system))
+                        (qemu qemu-minimal)
+                        os-drv
+                        bootcfg-drv
+                        bootloader
+                        (inputs '()))
+  "Return a bootable, stand-alone iso9660 image.
+
+INPUTS is a list of inputs (as for packages)."
+  (expression->derivation-in-linux-vm
+   name
+   (with-imported-modules (source-module-closure '((gnu build vm)
+                                                   (guix build utils)))
+     #~(begin
+         (use-modules (gnu build vm)
+                      (guix build utils))
+
+         (let ((inputs
+                '#$(append (list qemu parted e2fsprogs dosfstools xorriso)
+                           (map canonical-package
+                                (list sed grep coreutils findutils gawk))))
+
+               ;; This variable is unused but allows us to add INPUTS-TO-COPY
+               ;; as inputs.
+               (to-register
+                '#$(map (match-lambda
+                          ((name thing) thing)
+                          ((name thing output) `(,thing ,output)))
+                        inputs)))
+
+           (set-path-environment-variable "PATH" '("bin" "sbin") inputs)
+           (mkdir-p "/tmp")
+           ;(mount "none" "/tmp" "tmpfs")
+           ;(mkdir-p "/tmp/extra")
+           (make-iso9660-image #$(bootloader-package bootloader)
+                               #$bootcfg-drv
+                               #$os-drv
+                               "/xchg/guixsd.iso")
+           (reboot))))
+   #:system system
+   #:make-disk-image? #f
+   #:references-graphs inputs))
+
 (define* (qemu-image #:key
                      (name "qemu-image")
                      (system (%current-system))
@@ -308,19 +354,30 @@ to USB sticks meant to be read-only."
 
     (mlet* %store-monad ((os-drv   (operating-system-derivation os))
                          (bootcfg  (operating-system-bootcfg os)))
-      (qemu-image #:name name
-                  #:os-drv os-drv
-                  #:bootcfg-drv bootcfg
-                  #:bootloader (bootloader-configuration-bootloader
-                                (operating-system-bootloader os))
-                  #:disk-image-size disk-image-size
-                  #:disk-image-format "raw"
-                  #:file-system-type file-system-type
-                  #:file-system-label root-label
-                  #:copy-inputs? #t
-                  #:register-closures? #t
-                  #:inputs `(("system" ,os-drv)
-                             ("bootcfg" ,bootcfg))))))
+      (if (string=? "iso9660" file-system-type)
+          (iso9660-image #:name name
+                         #:os-drv os-drv
+                         #:bootcfg-drv bootcfg
+                         #:bootloader (bootloader-configuration-bootloader
+                                        (operating-system-bootloader os))
+                         #:inputs `(("system" ,os-drv)
+                                    ("bootcfg" ,bootcfg)))
+          (qemu-image #:name name
+                      #:os-drv os-drv
+                      #:bootcfg-drv bootcfg
+                      #:bootloader (bootloader-configuration-bootloader
+                                    (operating-system-bootloader os))
+                      #:disk-image-size disk-image-size
+                      #:disk-image-format "raw"
+                      #:file-system-type (if (string=? "iso9660"
+                                                       file-system-type)
+                                             "ext4"
+                                             file-system-type)
+                      #:file-system-label root-label
+                      #:copy-inputs? #t
+                      #:register-closures? #t
+                      #:inputs `(("system" ,os-drv)
+                                 ("bootcfg" ,bootcfg)))))))
 
 (define* (system-qemu-image os
                             #:key
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 35675cc01..da0f5b04b 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -578,7 +578,9 @@ PATTERN, a string.  When PATTERN is #f, display all the system generations."
                                                 (* 70 (expt 2 20)))
                                             #:mappings mappings))
     ((disk-image)
-     (system-disk-image os #:disk-image-size image-size))))
+     (system-disk-image os #:disk-image-size image-size))
+    ((iso9660-disk-image)
+     (system-disk-image os #:file-system-type "iso9660"))))
 
 (define (maybe-suggest-running-guix-pull)
   "Suggest running 'guix pull' if this has never been done before."
@@ -616,7 +618,8 @@ and TARGET arguments."
   "Perform ACTION for OS.  INSTALL-BOOTLOADER? specifies whether to install
 bootloader; DEVICE is the target devices for bootloader; TARGET is the target
 root directory; IMAGE-SIZE is the size of the image to be built, for the
-'vm-image' and 'disk-image' actions.  FULL-BOOT? is used for the 'vm' action;
+'vm-image', 'iso9660-disk-image' and 'disk-image' actions.
+FULL-BOOT? is used for the 'vm' action;
 it determines whether to boot directly to the kernel or to the bootloader.
 
 When DERIVATIONS-ONLY? is true, print the derivation file name(s) without
@@ -764,6 +767,8 @@ Some ACTIONS support additional ARGS.\n"))
   (display (G_ "\
    init             initialize a root file system to run GNU\n"))
   (display (G_ "\
+   iso9660-disk-image  build a disk image, suitable for a CD or DVD\n"))
+  (display (G_ "\
    extension-graph  emit the service extension graph in Dot format\n"))
   (display (G_ "\
    shepherd-graph   emit the graph of shepherd services in Dot format\n"))
@@ -781,9 +786,9 @@ Some ACTIONS support additional ARGS.\n"))
   (display (G_ "
       --share=SPEC       for 'vm', share host file system according to SPEC"))
   (display (G_ "
-  -r, --root=FILE        for 'vm', 'vm-image', 'disk-image', 'container',
-                         and 'build', make FILE a symlink to the result, and
-                         register it as a garbage collector root"))
+  -r, --root=FILE        for 'vm', 'vm-image', 'disk-image', 'iso9660-disk-image',
+                         'container', and 'build', make FILE a symlink to the
+                         result, and register it as a garbage collector root"))
   (display (G_ "
       --expose=SPEC      for 'vm', expose host file system according to SPEC"))
   (display (G_ "
@@ -957,7 +962,8 @@ argument list and OPTS is the option alist."
         (alist-cons 'argument arg result)
         (let ((action (string->symbol arg)))
           (case action
-            ((build container vm vm-image disk-image reconfigure init
+            ((build container vm vm-image disk-image iso9660-disk-image
+              reconfigure init
               extension-graph shepherd-graph list-generations roll-back
               switch-generation)
              (alist-cons 'action action result))
@@ -987,7 +993,7 @@ argument list and OPTS is the option alist."
         (exit 1))
 
       (case action
-        ((build container vm vm-image disk-image reconfigure)
+        ((build container vm vm-image disk-image iso9660-disk-image reconfigure)
          (unless (= count 1)
            (fail)))
         ((init)

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH v5] build: Add iso9660 system image generator.
  2017-06-29 13:47   ` [bug#27521] [PATCH v5] " Danny Milosavljevic
@ 2017-06-30 10:13     ` Danny Milosavljevic
  2017-07-02 14:55     ` Ludovic Courtès
  1 sibling, 0 replies; 27+ messages in thread
From: Danny Milosavljevic @ 2017-06-30 10:13 UTC (permalink / raw)
  To: 27521

> +(define* (iso9660-image #:key
[...]

> +           (mkdir-p "/tmp")

Also works without this.

> +           ;(mount "none" "/tmp" "tmpfs")

No idea why I don't have to do this. But it works.

> +           ;(mkdir-p "/tmp/extra")

> diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
> index 35675cc01..da0f5b04b 100644
> --- a/guix/scripts/system.scm
> +++ b/guix/scripts/system.scm
> @@ -578,7 +578,9 @@ PATTERN, a string.  When PATTERN is #f, display all the system generations."
>                                                  (* 70 (expt 2 20)))
>                                              #:mappings mappings))
>      ((disk-image)
> -     (system-disk-image os #:disk-image-size image-size))))
> +     (system-disk-image os #:disk-image-size image-size))
> +    ((iso9660-disk-image)
> +     (system-disk-image os #:file-system-type "iso9660"))))

If we wanted, we also could replace disk-image by iso9660-disk-image entirely.  It should also boot from USB (and from floppy if it fits there).

Do we want to?

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH v5] build: Add iso9660 system image generator.
  2017-06-29 13:47   ` [bug#27521] [PATCH v5] " Danny Milosavljevic
  2017-06-30 10:13     ` Danny Milosavljevic
@ 2017-07-02 14:55     ` Ludovic Courtès
  2017-07-02 18:37       ` Danny Milosavljevic
  1 sibling, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2017-07-02 14:55 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 27521

Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> * build-aux/hydra/gnu-system.scm (qemu-jobs): Add 'iso9660-image .
> * guix/script/system.scm: Add "iso9660-disk-image" action.
> * gnu/build/vm.scm (make-iso9660-image): New variable.  Export it.
> * gnu/system/vm.scm (iso9660-image): New variable.  Use make-iso9660-image.
> (system-disk-image): Use iso9660-image.

This all sounds like excellent news!

(BTW it’s funny to see new versions of this patch set come in regularly;
at least it acts as a reminder.  ;-))

> --- a/gnu/build/vm.scm
> +++ b/gnu/build/vm.scm
> @@ -48,7 +48,8 @@
>  
>              root-partition-initializer
>              initialize-partition-table
> -            initialize-hard-disk))
> +            initialize-hard-disk
> +            make-iso9660-image))
>  
>  ;;; Commentary:
>  ;;;
> @@ -344,6 +345,20 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
>                              (string-append "boot/grub/grub.cfg=" config-file)))
>        (error "failed to create GRUB EFI image"))))
>  
> +(define (make-iso9660-image grub config-file os-drv target)
> +  "Given a GRUB package, creates an iso image as TARGET, using CONFIG-FILE as
> +Grub configuration and OS-DRV as the stuff in it."
> +  (let ((grub-mkrescue (string-append grub "/bin/grub-mkrescue")))
> +    (mkdir-p "/tmp/root/var/run")
> +    (mkdir-p "/tmp/root/run")
> +    (unless (zero? (system* grub-mkrescue "-o" target
> +                            (string-append "boot/grub/grub.cfg=" config-file)
> +                            (string-append "gnu/store=" os-drv "/..")
> +                            "var=/tmp/root/var"
> +                            "run=/tmp/root/run"
> +                            "--" "-volid" "GUIXSD"))

Let’s add #:key (volume-id "GuixSD") and then:

  "--" "-volid" (string-upcase volume-id)

> diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
> index 392737d07..5a865d24b 100644
> --- a/gnu/system/vm.scm
> +++ b/gnu/system/vm.scm
> @@ -34,6 +34,7 @@
>                  #:select (qemu-command))
>    #:use-module (gnu packages base)
>    #:use-module (gnu packages bootloaders)
> +  #:use-module (gnu packages cdrom)
>    #:use-module (gnu packages guile)
>    #:use-module (gnu packages gawk)
>    #:use-module (gnu packages bash)
> @@ -170,6 +171,51 @@ made available under the /xchg CIFS share."
>                        #:guile-for-build guile-for-build
>                        #:references-graphs references-graphs)))
>  
> +(define* (iso9660-image #:key
> +                        (name "iso9660-image")
> +                        (system (%current-system))
> +                        (qemu qemu-minimal)
> +                        os-drv
> +                        bootcfg-drv
> +                        bootloader
> +                        (inputs '()))
> +  "Return a bootable, stand-alone iso9660 image.
> +
> +INPUTS is a list of inputs (as for packages)."
> +  (expression->derivation-in-linux-vm
> +   name
> +   (with-imported-modules (source-module-closure '((gnu build vm)
> +                                                   (guix build utils)))
> +     #~(begin
> +         (use-modules (gnu build vm)
> +                      (guix build utils))
> +
> +         (let ((inputs
> +                '#$(append (list qemu parted e2fsprogs dosfstools xorriso)
> +                           (map canonical-package
> +                                (list sed grep coreutils findutils gawk))))
> +
> +               ;; This variable is unused but allows us to add INPUTS-TO-COPY
> +               ;; as inputs.
> +               (to-register
> +                '#$(map (match-lambda
> +                          ((name thing) thing)
> +                          ((name thing output) `(,thing ,output)))
> +                        inputs)))
> +
> +           (set-path-environment-variable "PATH" '("bin" "sbin") inputs)
> +           (mkdir-p "/tmp")
> +           ;(mount "none" "/tmp" "tmpfs")
> +           ;(mkdir-p "/tmp/extra")
> +           (make-iso9660-image #$(bootloader-package bootloader)
> +                               #$bootcfg-drv
> +                               #$os-drv
> +                               "/xchg/guixsd.iso")
> +           (reboot))))
> +   #:system system
> +   #:make-disk-image? #f
> +   #:references-graphs inputs))

Since this doesn’t have much to do with VMs, what about adding these
things to (gnu system iso9660) and (gnu build iso9660)?

They may have to use procedure from the ‘vm’ modules, but that’s OK.

>  (define* (qemu-image #:key
>                       (name "qemu-image")
>                       (system (%current-system))
> @@ -308,19 +354,30 @@ to USB sticks meant to be read-only."
>  
>      (mlet* %store-monad ((os-drv   (operating-system-derivation os))
>                           (bootcfg  (operating-system-bootcfg os)))
> -      (qemu-image #:name name
> -                  #:os-drv os-drv
> -                  #:bootcfg-drv bootcfg
> -                  #:bootloader (bootloader-configuration-bootloader
> -                                (operating-system-bootloader os))
> -                  #:disk-image-size disk-image-size
> -                  #:disk-image-format "raw"
> -                  #:file-system-type file-system-type
> -                  #:file-system-label root-label
> -                  #:copy-inputs? #t
> -                  #:register-closures? #t
> -                  #:inputs `(("system" ,os-drv)
> -                             ("bootcfg" ,bootcfg))))))
> +      (if (string=? "iso9660" file-system-type)
> +          (iso9660-image #:name name
> +                         #:os-drv os-drv
> +                         #:bootcfg-drv bootcfg
> +                         #:bootloader (bootloader-configuration-bootloader
> +                                        (operating-system-bootloader os))
> +                         #:inputs `(("system" ,os-drv)
> +                                    ("bootcfg" ,bootcfg)))
> +          (qemu-image #:name name

We can also remove this ‘if’: it’s not natural for ‘qemu-image’ to
produce something that’s not a “QEMU image.”

Could you update “Invoking guix system” accordingly?

We could add a installation test that boots from an ISO image, but we
can do that later if you want.

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] linux-initrd: Add isofs if necessary.
  2017-06-29  3:17 ` [bug#27521] [PATCH] linux-initrd: Add isofs if necessary Danny Milosavljevic
@ 2017-07-02 14:56   ` Ludovic Courtès
  2017-07-02 18:28     ` Danny Milosavljevic
  0 siblings, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2017-07-02 14:56 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 27521

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> * gnu/system/linux-initrd.scm (base-initrd): Add isofs.

LGTM!

Ludo'.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] linux-initrd: Add isofs if necessary.
  2017-07-02 14:56   ` Ludovic Courtès
@ 2017-07-02 18:28     ` Danny Milosavljevic
  0 siblings, 0 replies; 27+ messages in thread
From: Danny Milosavljevic @ 2017-07-02 18:28 UTC (permalink / raw)
  Cc: 27521

Pushed only this patch as ed3485fa9c6c758bff1fb7391c8360c2c93e7337 to master.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH v5] build: Add iso9660 system image generator.
  2017-07-02 14:55     ` Ludovic Courtès
@ 2017-07-02 18:37       ` Danny Milosavljevic
  2017-07-02 20:09         ` Ludovic Courtès
  0 siblings, 1 reply; 27+ messages in thread
From: Danny Milosavljevic @ 2017-07-02 18:37 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 27521

Hi Ludo,

> Let’s add #:key (volume-id "GuixSD") and then:
> 
>   "--" "-volid" (string-upcase volume-id)

It will fail when booting from CD because GuixSD can't find the root fs.

> Since this doesn’t have much to do with VMs, what about adding these
> things to (gnu system iso9660) and (gnu build iso9660)?

I'd be fine with it but I think adding it to system-disk-image (as this patch does) is actually quite fitting - also, most of the stuff in there is not for VMs either.  There are comments all over system-disk-image how it makes sure not to set up the stuff for qemu but for real hardware.

> We can also remove this ‘if’: it’s not natural for ‘qemu-image’ to
> produce something that’s not a “QEMU image.”

The patch context is misleading :)

What it actually does is extend system-disk-image:

(define (system-disk-image ... file-system-type)
  ...
  (if (= file-system-type "iso9660")
      (iso9660-image ...)
      (qemu-image)))

And if we want we could actually drop the entire non-iso9660 hydra image (after testing, of course) because the grub-mkrescue image will boot from usb stick as well.  So no need to have two different ones, actually.

> Could you update “Invoking guix system” accordingly?

We could replace the old "guix system disk-image" by a new "guix system disk-image" which always creates the iso9660 image.

Or are there other use cases of "guix system disk-image" ?

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH v5] build: Add iso9660 system image generator.
  2017-07-02 18:37       ` Danny Milosavljevic
@ 2017-07-02 20:09         ` Ludovic Courtès
  2017-07-02 22:01           ` Danny Milosavljevic
  0 siblings, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2017-07-02 20:09 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 27521

Heya,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

>> Let’s add #:key (volume-id "GuixSD") and then:
>> 
>>   "--" "-volid" (string-upcase volume-id)
>
> It will fail when booting from CD because GuixSD can't find the root fs.

I don’t understand.  What I suggest here is equivalent to what was in
the patch (“-volid GUIXSD”), except that it avoids hard-coding the
value; it’s purely cosmetic.

>> Since this doesn’t have much to do with VMs, what about adding these
>> things to (gnu system iso9660) and (gnu build iso9660)?
>
> I'd be fine with it but I think adding it to system-disk-image (as this patch does) is actually quite fitting - also, most of the stuff in there is not for VMs either.  There are comments all over system-disk-image how it makes sure not to set up the stuff for qemu but for real hardware.

Riiight.

>> We can also remove this ‘if’: it’s not natural for ‘qemu-image’ to
>> produce something that’s not a “QEMU image.”
>
> The patch context is misleading :)
>
> What it actually does is extend system-disk-image:
>
> (define (system-disk-image ... file-system-type)
>   ...
>   (if (= file-system-type "iso9660")
>       (iso9660-image ...)
>       (qemu-image)))

Oh OK, my bad.

> And if we want we could actually drop the entire non-iso9660 hydra image (after testing, of course) because the grub-mkrescue image will boot from usb stick as well.  So no need to have two different ones, actually.

You mean we could always use ‘grub-mkrescue’ instead of using it in one
case and using ‘grub-install’ & co. in the other case, right?

If that works, that sounds like a good idea to me.

>> Could you update “Invoking guix system” accordingly?
>
> We could replace the old "guix system disk-image" by a new "guix system disk-image" which always creates the iso9660 image.
>
> Or are there other use cases of "guix system disk-image" ?

“guix system disk-image” is documented as returning a raw disk image,
which I think can be useful to keep.

So what about having:

  guix system vm-image   # qcow2
  guix system disk-image # raw
  guix system iso-image  # iso9660

?

Alternately, we could of course do:

  guix system image -f FORMAT

where FORMAT is one of the above.

Thoughts?

Perhaps it’s simpler to just add “guix system iso-image” in this patch
series and to think about the other option separately.

Ludo’.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH v5] build: Add iso9660 system image generator.
  2017-07-02 20:09         ` Ludovic Courtès
@ 2017-07-02 22:01           ` Danny Milosavljevic
  2017-07-03  7:38             ` Ludovic Courtès
  0 siblings, 1 reply; 27+ messages in thread
From: Danny Milosavljevic @ 2017-07-02 22:01 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 27521

On Sun, 02 Jul 2017 22:09:28 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

> Heya,
> 
> Danny Milosavljevic <dannym@scratchpost.org> skribis:
> 
> >> Let’s add #:key (volume-id "GuixSD") and then:
> >> 
> >>   "--" "-volid" (string-upcase volume-id)  
> >
> > It will fail when booting from CD because GuixSD can't find the root fs.  
> 
> I don’t understand.  What I suggest here is equivalent to what was in
> the patch (“-volid GUIXSD”), except that it avoids hard-coding the
> value; it’s purely cosmetic.

Yeah, sorry.  Ok :)

>You mean we could always use ‘grub-mkrescue’ instead of using it in one case and using ‘grub-install’ & co. in the other case, right?

Yeah that.  The only problem is it doesn't work yet for real in the USB stick case.  I tried it now :)

grub-mkrescue documents the fact that it should work from USB quite clearly - so it probably does (probably after I found all the uuid / label conversion problem locations).

Note that ISO9660 is read-only so the ISO9660 image is not a good replacement for an actual installed system.

>  guix system image -f FORMAT

Sounds good.  I think with three formats my threshold for having an option "-f" is reached :)

>Perhaps it’s simpler to just add “guix system iso-image” in this patch
series and to think about the other option separately.

Okay.  If we want to keep the stuff where it is I can commit it now.  I've tested the ISO9660 image with "qemu -cdrom", works fine.

Or if we want we can also move both system-disk-image and iso9660-image into a new module - something like (gnu system image) ?

Moving only one of them, on the other hand, wouldn't decrease the potential confusion - especially once there is a common "guix system image" :)

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH v5] build: Add iso9660 system image generator.
  2017-07-02 22:01           ` Danny Milosavljevic
@ 2017-07-03  7:38             ` Ludovic Courtès
  2017-07-03 10:31               ` Danny Milosavljevic
                                 ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Ludovic Courtès @ 2017-07-03  7:38 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 27521

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> On Sun, 02 Jul 2017 22:09:28 +0200
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> Heya,
>> 
>> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>> 
>> >> Let’s add #:key (volume-id "GuixSD") and then:
>> >> 
>> >>   "--" "-volid" (string-upcase volume-id)  
>> >
>> > It will fail when booting from CD because GuixSD can't find the root fs.  
>> 
>> I don’t understand.  What I suggest here is equivalent to what was in
>> the patch (“-volid GUIXSD”), except that it avoids hard-coding the
>> value; it’s purely cosmetic.
>
> Yeah, sorry.  Ok :)
>
>>You mean we could always use ‘grub-mkrescue’ instead of using it in one case and using ‘grub-install’ & co. in the other case, right?
>
> Yeah that.  The only problem is it doesn't work yet for real in the USB stick case.  I tried it now :)

OK.  :-)  Let’s keep that for a future patch series then.

>>  guix system image -f FORMAT
>
> Sounds good.  I think with three formats my threshold for having an option "-f" is reached :)

Good.

>>Perhaps it’s simpler to just add “guix system iso-image” in this patch
> series and to think about the other option separately.
>
> Okay.  If we want to keep the stuff where it is I can commit it now.  I've tested the ISO9660 image with "qemu -cdrom", works fine.

Yes, sounds good to me.  Make sure to update guix.texi though.

> Or if we want we can also move both system-disk-image and iso9660-image into a new module - something like (gnu system image) ?

Yeah dunno, we’ll have to think about it; “vm” no longer looks
accurate.  :-)

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH v5] build: Add iso9660 system image generator.
  2017-07-03  7:38             ` Ludovic Courtès
@ 2017-07-03 10:31               ` Danny Milosavljevic
  2017-07-03 11:49                 ` Ludovic Courtès
  2017-07-03 10:34               ` [bug#27521] [PATCH] guix system: Add "--file-system-type" option Danny Milosavljevic
  2017-07-03 11:10               ` [bug#27521] [PATCH] build: Allow specifying volume-uuid with make-iso9660-image Danny Milosavljevic
  2 siblings, 1 reply; 27+ messages in thread
From: Danny Milosavljevic @ 2017-07-03 10:31 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 27521

On Mon, 03 Jul 2017 09:38:19 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

> >>  guix system image -f FORMAT  
> >
> > Sounds good.  I think with three formats my threshold for having an option "-f" is reached :)  

I'll try to add this part next.

> > Okay.  If we want to keep the stuff where it is I can commit it now.  I've tested the ISO9660 image with "qemu -cdrom", works fine.  

I've thought about it some more.  I'd add 'iso9660-disk-image in a whole bunch of places only to remove it again.  Therefore, I left out the guix/scripts/system.scm part entirely for now and committed the rest to master (the Hydra image will still build).

> > Or if we want we can also move both system-disk-image and iso9660-image into a new module - something like (gnu system image) ?  
> 
> Yeah dunno, we’ll have to think about it; “vm” no longer looks
> accurate.  :-)

Anyone: Feel free to move them - although I'm not sure how build-aux/hydra/gnu-system.scm finds its modules.  Probably would have to be amended somehow, too.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] guix system: Add "--file-system-type" option.
  2017-07-03  7:38             ` Ludovic Courtès
  2017-07-03 10:31               ` Danny Milosavljevic
@ 2017-07-03 10:34               ` Danny Milosavljevic
  2017-07-03 11:56                 ` Ludovic Courtès
  2017-07-03 14:42                 ` Danny Milosavljevic
  2017-07-03 11:10               ` [bug#27521] [PATCH] build: Allow specifying volume-uuid with make-iso9660-image Danny Milosavljevic
  2 siblings, 2 replies; 27+ messages in thread
From: Danny Milosavljevic @ 2017-07-03 10:34 UTC (permalink / raw)
  To: 27521

* guix/scripts/system.scm (process-action): Pass file-system-type to ...
(perform-action): ... here.  Add new keyword argument.  Pass new value to ...
(system-derivation-for-action): ... here.  Add new keyword argument.
Pass new value to system-disk-image.
* doc/guix.texi (disk-image): Document new option.
---
 doc/guix.texi           |  3 +++
 guix/scripts/system.scm | 23 +++++++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index d61a5b751..25354b8c9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -16190,6 +16190,9 @@ in @var{file} that stands alone.  By default, @command{guix system}
 estimates the size of the image needed to store the system, but you can
 use the @option{--image-size} option to specify a value.
 
+You can specify the root file system type by using the
+@option{--file-system-type} option.  It defaults to "ext4".
+
 When using @code{vm-image}, the returned image is in qcow2 format, which
 the QEMU emulator can efficiently use. @xref{Running GuixSD in a VM},
 for more information on how to run the image in a virtual machine.
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 7e20b10da..ff6c53716 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -560,7 +560,8 @@ PATTERN, a string.  When PATTERN is #f, display all the system generations."
 ;;;
 
 (define* (system-derivation-for-action os action
-                                       #:key image-size full-boot? mappings)
+                                       #:key image-size file-system-type
+                                       full-boot? mappings)
   "Return as a monadic value the derivation for OS according to ACTION."
   (case action
     ((build init reconfigure)
@@ -578,7 +579,8 @@ PATTERN, a string.  When PATTERN is #f, display all the system generations."
                                                 (* 70 (expt 2 20)))
                                             #:mappings mappings))
     ((disk-image)
-     (system-disk-image os #:disk-image-size image-size))))
+     (system-disk-image os #:disk-image-size image-size
+                           #:file-system-type file-system-type))))
 
 (define (maybe-suggest-running-guix-pull)
   "Suggest running 'guix pull' if this has never been done before."
@@ -610,13 +612,15 @@ and TARGET arguments."
                          #:key install-bootloader?
                          dry-run? derivations-only?
                          use-substitutes? device target
-                         image-size full-boot?
+                         image-size file-system-type full-boot?
                          (mappings '())
                          (gc-root #f))
   "Perform ACTION for OS.  INSTALL-BOOTLOADER? specifies whether to install
 bootloader; DEVICE is the target devices for bootloader; TARGET is the target
 root directory; IMAGE-SIZE is the size of the image to be built, for the
-'vm-image' and 'disk-image' actions.  FULL-BOOT? is used for the 'vm' action;
+'vm-image' and 'disk-image' actions.
+The root filesystem is created as a FILE-SYSTEM-TYPE filesystem.
+FULL-BOOT? is used for the 'vm' action;
 it determines whether to boot directly to the kernel or to the bootloader.
 
 When DERIVATIONS-ONLY? is true, print the derivation file name(s) without
@@ -632,6 +636,7 @@ output when building a system derivation, such as a disk image."
 
   (mlet* %store-monad
       ((sys       (system-derivation-for-action os action
+                                                #:file-system-type file-system-type
                                                 #:image-size image-size
                                                 #:full-boot? full-boot?
                                                 #:mappings mappings))
@@ -775,6 +780,10 @@ Some ACTIONS support additional ARGS.\n"))
       --on-error=STRATEGY
                          apply STRATEGY when an error occurs while reading FILE"))
   (display (G_ "
+      --file-system-type=TYPE
+                         for 'disk-image', produce a root file system of TYPE
+                         (one of 'ext4', 'iso9660')"))
+  (display (G_ "
       --image-size=SIZE  for 'vm-image', produce an image of SIZE"))
   (display (G_ "
       --no-bootloader    for 'init', do not install a bootloader"))
@@ -812,6 +821,10 @@ Some ACTIONS support additional ARGS.\n"))
                  (lambda (opt name arg result)
                    (alist-cons 'on-error (string->symbol arg)
                                result)))
+         (option '(#\f "file-system-type") #t #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'file-system-type arg
+                               result)))
          (option '("image-size") #t #f
                  (lambda (opt name arg result)
                    (alist-cons 'image-size (size->number arg)
@@ -854,6 +867,7 @@ Some ACTIONS support additional ARGS.\n"))
     (build-hook? . #t)
     (max-silent-time . 3600)
     (verbosity . 0)
+    (file-system-type . "ext4")
     (image-size . guess)
     (install-bootloader? . #t)))
 
@@ -906,6 +920,7 @@ resulting from command-line parsing."
                              #:derivations-only? (assoc-ref opts
                                                             'derivations-only?)
                              #:use-substitutes? (assoc-ref opts 'substitutes?)
+                             #:file-system-type (assoc-ref opts 'file-system-type)
                              #:image-size (assoc-ref opts 'image-size)
                              #:full-boot? (assoc-ref opts 'full-boot?)
                              #:mappings (filter-map (match-lambda

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] build: Allow specifying volume-uuid with make-iso9660-image.
  2017-07-03  7:38             ` Ludovic Courtès
  2017-07-03 10:31               ` Danny Milosavljevic
  2017-07-03 10:34               ` [bug#27521] [PATCH] guix system: Add "--file-system-type" option Danny Milosavljevic
@ 2017-07-03 11:10               ` Danny Milosavljevic
  2017-07-03 11:58                 ` Ludovic Courtès
  2 siblings, 1 reply; 27+ messages in thread
From: Danny Milosavljevic @ 2017-07-03 11:10 UTC (permalink / raw)
  To: 27521

* gnu/build/file-systems.scm (iso9660-uuid->string): Export.
* gnu/build/vm.scm (make-iso9660-image): Add volume-uuid.
---
 gnu/build/file-systems.scm |  1 +
 gnu/build/vm.scm           | 19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 16160a659..b6930497d 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -48,6 +48,7 @@
             string->ext3-uuid
             string->ext4-uuid
             string->btrfs-uuid
+            iso9660-uuid->string
 
             bind-mount
 
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 860c98346..4239bc2fb 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -353,18 +353,27 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
       (error "failed to create GRUB EFI image"))))
 
 (define* (make-iso9660-image grub config-file os-drv target
-                             #:key (volume-id "GuixSD"))
+                             #:key (volume-id "GuixSD") (volume-uuid #f))
   "Given a GRUB package, creates an iso image as TARGET, using CONFIG-FILE as
 Grub configuration and OS-DRV as the stuff in it."
   (let ((grub-mkrescue (string-append grub "/bin/grub-mkrescue")))
     (mkdir-p "/tmp/root/var/run")
     (mkdir-p "/tmp/root/run")
-    (unless (zero? (system* grub-mkrescue "-o" target
-                            (string-append "boot/grub/grub.cfg=" config-file)
-                            (string-append "gnu/store=" os-drv "/..")
+    (unless (zero? (apply system*
+                          `(,grub-mkrescue "-o" ,target
+                            ,(string-append "boot/grub/grub.cfg=" config-file)
+                            ,(string-append "gnu/store=" os-drv "/..")
                             "var=/tmp/root/var"
                             "run=/tmp/root/run"
-                            "--" "-volid" (string-upcase volume-id)))
+                            "--"
+                            "-volid" ,(string-upcase volume-id)
+                            ,@(if volume-uuid
+                                  `("-volume_date" "uuid"
+                                    ,(string-filter (lambda (value)
+                                                      (not (char=? #\- value)))
+                                                    (iso9660-uuid->string
+                                                     volume-uuid)))
+                                  `()))))
       (error "failed to create ISO image"))))
 
 (define* (initialize-hard-disk device

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH v5] build: Add iso9660 system image generator.
  2017-07-03 10:31               ` Danny Milosavljevic
@ 2017-07-03 11:49                 ` Ludovic Courtès
  0 siblings, 0 replies; 27+ messages in thread
From: Ludovic Courtès @ 2017-07-03 11:49 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 27521

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> On Mon, 03 Jul 2017 09:38:19 +0200
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> >>  guix system image -f FORMAT  
>> >
>> > Sounds good.  I think with three formats my threshold for having an option "-f" is reached :)  
>
> I'll try to add this part next.
>
>> > Okay.  If we want to keep the stuff where it is I can commit it now.  I've tested the ISO9660 image with "qemu -cdrom", works fine.  
>
> I've thought about it some more.  I'd add 'iso9660-disk-image in a whole bunch of places only to remove it again.  Therefore, I left out the guix/scripts/system.scm part entirely for now and committed the rest to master (the Hydra image will still build).

Sounds good, thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] guix system: Add "--file-system-type" option.
  2017-07-03 10:34               ` [bug#27521] [PATCH] guix system: Add "--file-system-type" option Danny Milosavljevic
@ 2017-07-03 11:56                 ` Ludovic Courtès
  2017-07-03 13:14                   ` Danny Milosavljevic
  2017-07-03 14:42                 ` Danny Milosavljevic
  1 sibling, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2017-07-03 11:56 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 27521

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> * guix/scripts/system.scm (process-action): Pass file-system-type to ...
> (perform-action): ... here.  Add new keyword argument.  Pass new value to ...
> (system-derivation-for-action): ... here.  Add new keyword argument.
> Pass new value to system-disk-image.
> * doc/guix.texi (disk-image): Document new option.
> ---
>  doc/guix.texi           |  3 +++
>  guix/scripts/system.scm | 23 +++++++++++++++++++----
>  2 files changed, 22 insertions(+), 4 deletions(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index d61a5b751..25354b8c9 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -16190,6 +16190,9 @@ in @var{file} that stands alone.  By default, @command{guix system}
>  estimates the size of the image needed to store the system, but you can
>  use the @option{--image-size} option to specify a value.
>  
> +You can specify the root file system type by using the
> +@option{--file-system-type} option.  It defaults to "ext4".

s/"ext4"/@code{ext4}/

You also need to add an @item for --file-system-type in the option
table.

Also, it might be good to add examples of other supported values, like:

  @cindex ISO-9660 format
  @cindex CD image format
  @cindex DVD image format
  @code{--file-system-type=iso9660} produces an ISO-9660 image, suitable
  for burning on CDs and DVDs.

> +         (option '(#\f "file-system-type") #t #f
> +                 (lambda (opt name arg result)
> +                   (alist-cons 'file-system-type arg
> +                               result)))

I’m not sure we want to use the “-f” shortcut here.  Initially I thought
we’d have -f/--format for the image format, i.e., qcow2 vs. raw (are
there any others?).

Thoughts?

Besides, I think “guix system disk-image --file-system-format=foobarbaz”
fails badly, but I’m not sure how to fix it without having to maintain a
list of valid file system names.  Maybe we should just ignore this
issue.

Thoughts?

Ludo’.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] build: Allow specifying volume-uuid with make-iso9660-image.
  2017-07-03 11:10               ` [bug#27521] [PATCH] build: Allow specifying volume-uuid with make-iso9660-image Danny Milosavljevic
@ 2017-07-03 11:58                 ` Ludovic Courtès
  0 siblings, 0 replies; 27+ messages in thread
From: Ludovic Courtès @ 2017-07-03 11:58 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 27521

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> * gnu/build/file-systems.scm (iso9660-uuid->string): Export.
> * gnu/build/vm.scm (make-iso9660-image): Add volume-uuid.
> ---
>  gnu/build/file-systems.scm |  1 +
>  gnu/build/vm.scm           | 19 ++++++++++++++-----
>  2 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
> index 16160a659..b6930497d 100644
> --- a/gnu/build/file-systems.scm
> +++ b/gnu/build/file-systems.scm
> @@ -48,6 +48,7 @@
>              string->ext3-uuid
>              string->ext4-uuid
>              string->btrfs-uuid
> +            iso9660-uuid->string
>  
>              bind-mount
>  
> diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
> index 860c98346..4239bc2fb 100644
> --- a/gnu/build/vm.scm
> +++ b/gnu/build/vm.scm
> @@ -353,18 +353,27 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
>        (error "failed to create GRUB EFI image"))))
>  
>  (define* (make-iso9660-image grub config-file os-drv target
> -                             #:key (volume-id "GuixSD"))
> +                             #:key (volume-id "GuixSD") (volume-uuid #f))
>    "Given a GRUB package, creates an iso image as TARGET, using CONFIG-FILE as
>  Grub configuration and OS-DRV as the stuff in it."
>    (let ((grub-mkrescue (string-append grub "/bin/grub-mkrescue")))
>      (mkdir-p "/tmp/root/var/run")
>      (mkdir-p "/tmp/root/run")
> -    (unless (zero? (system* grub-mkrescue "-o" target
> -                            (string-append "boot/grub/grub.cfg=" config-file)
> -                            (string-append "gnu/store=" os-drv "/..")
> +    (unless (zero? (apply system*
> +                          `(,grub-mkrescue "-o" ,target
> +                            ,(string-append "boot/grub/grub.cfg=" config-file)
> +                            ,(string-append "gnu/store=" os-drv "/..")
>                              "var=/tmp/root/var"
>                              "run=/tmp/root/run"
> -                            "--" "-volid" (string-upcase volume-id)))
> +                            "--"
> +                            "-volid" ,(string-upcase volume-id)
> +                            ,@(if volume-uuid
> +                                  `("-volume_date" "uuid"
> +                                    ,(string-filter (lambda (value)
> +                                                      (not (char=? #\- value)))
> +                                                    (iso9660-uuid->string
> +                                                     volume-uuid)))

This last part can be written:

  (string-filter (char-set-complement (char-set #\/)) …)

though that’s not really more concise…

LGTM!

Ludo’.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] guix system: Add "--file-system-type" option.
  2017-07-03 11:56                 ` Ludovic Courtès
@ 2017-07-03 13:14                   ` Danny Milosavljevic
  2017-07-03 14:17                     ` Ludovic Courtès
  0 siblings, 1 reply; 27+ messages in thread
From: Danny Milosavljevic @ 2017-07-03 13:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 27521

Hi Ludo,

On Mon, 03 Jul 2017 13:56:40 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

> s/"ext4"/@code{ext4}/
> 
> You also need to add an @item for --file-system-type in the option
> table.

Right.

> > +         (option '(#\f "file-system-type") #t #f
> > +                 (lambda (opt name arg result)
> > +                   (alist-cons 'file-system-type arg
> > +                               result)))  
> 
> I’m not sure we want to use the “-f” shortcut here.  Initially I thought
> we’d have -f/--format for the image format, 

How about "-t" like mkfs has?  Or only providing the long option?

>i.e., qcow2 vs. raw (are
> there any others?).

Good question.  It seems the image format is an implementation detail of VMs where they probably can use some areas for rollback/versioning information (where the guest OS is none the wiser).

On the other hand, the filesystem type is something that the guest OS needs to know and not an implementation detail.

I had actually added a disk-image-format option to guix/scripts/system.scm before and then thought better of it because guix system vm-image uses qcow2 and guix system disk-image uses raw and I can't think of any more - so it would be redundant.

Even the ISO9660 fs will just be stored on a "raw" image.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] guix system: Add "--file-system-type" option.
  2017-07-03 13:14                   ` Danny Milosavljevic
@ 2017-07-03 14:17                     ` Ludovic Courtès
  2017-07-03 14:20                       ` Danny Milosavljevic
  0 siblings, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2017-07-03 14:17 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 27521

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> On Mon, 03 Jul 2017 13:56:40 +0200
> ludo@gnu.org (Ludovic Courtès) wrote:

[...]

>> > +         (option '(#\f "file-system-type") #t #f
>> > +                 (lambda (opt name arg result)
>> > +                   (alist-cons 'file-system-type arg
>> > +                               result)))  
>> 
>> I’m not sure we want to use the “-f” shortcut here.  Initially I thought
>> we’d have -f/--format for the image format, 
>
> How about "-t" like mkfs has?  Or only providing the long option?

“-t” sounds good to me.

>>i.e., qcow2 vs. raw (are
>> there any others?).
>
> Good question.  It seems the image format is an implementation detail of VMs where they probably can use some areas for rollback/versioning information (where the guest OS is none the wiser).
>
> On the other hand, the filesystem type is something that the guest OS needs to know and not an implementation detail.
>
> I had actually added a disk-image-format option to guix/scripts/system.scm before and then thought better of it because guix system vm-image uses qcow2 and guix system disk-image uses raw and I can't think of any more - so it would be redundant.
>
> Even the ISO9660 fs will just be stored on a "raw" image.

Right, so how do you suggest that we expose qcow2 vs. raw?

Ludo’.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] guix system: Add "--file-system-type" option.
  2017-07-03 14:17                     ` Ludovic Courtès
@ 2017-07-03 14:20                       ` Danny Milosavljevic
  2017-07-03 15:31                         ` Ludovic Courtès
  0 siblings, 1 reply; 27+ messages in thread
From: Danny Milosavljevic @ 2017-07-03 14:20 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 27521

> Right, so how do you suggest that we expose qcow2 vs. raw?

$ guix system vm-image config.scm # qcow2

vs

$ guix system disk-image config.scm # raw

I don't know whether there are other differences.
If there are any then it maybe makes sense to go further...

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] guix system: Add "--file-system-type" option.
  2017-07-03 10:34               ` [bug#27521] [PATCH] guix system: Add "--file-system-type" option Danny Milosavljevic
  2017-07-03 11:56                 ` Ludovic Courtès
@ 2017-07-03 14:42                 ` Danny Milosavljevic
  1 sibling, 0 replies; 27+ messages in thread
From: Danny Milosavljevic @ 2017-07-03 14:42 UTC (permalink / raw)
  To: 27521

Applied a variant of this patch to master as 3f4d8a7f66060e93a247797a9bbd2fcbee6922a3.

Keeping this bug report open for further refinements.

Note that the patch from bug# 27520 (or something similar) is required in order to make the resulting ISO-9660 image boot.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] guix system: Add "--file-system-type" option.
  2017-07-03 14:20                       ` Danny Milosavljevic
@ 2017-07-03 15:31                         ` Ludovic Courtès
  0 siblings, 0 replies; 27+ messages in thread
From: Ludovic Courtès @ 2017-07-03 15:31 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 27521

Danny Milosavljevic <dannym@scratchpost.org> skribis:

>> Right, so how do you suggest that we expose qcow2 vs. raw?
>
> $ guix system vm-image config.scm # qcow2
>
> vs
>
> $ guix system disk-image config.scm # raw
>
> I don't know whether there are other differences.
> If there are any then it maybe makes sense to go further...

OK, sounds good!

Ludo'.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] guix system: Add file system label and uuid to iso9660-image.
  2017-06-28 22:03 [bug#27521] [PATCH] build: Add iso9660 system image generator Danny Milosavljevic
                   ` (3 preceding siblings ...)
  2017-06-29  3:17 ` [bug#27521] [PATCH] linux-initrd: Add isofs if necessary Danny Milosavljevic
@ 2017-07-03 18:02 ` Danny Milosavljevic
  2017-07-07 16:06   ` Danny Milosavljevic
  4 siblings, 1 reply; 27+ messages in thread
From: Danny Milosavljevic @ 2017-07-03 18:02 UTC (permalink / raw)
  To: 27521

* gnu/system/vm.scm (system-disk-image): Pass root-label to ...
(iso9660-image): ... here.  Add keyword arguments #:file-system-label
and #:file-system-uuid.
---
 gnu/system/vm.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index f1c650c97..3e722d081 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -177,6 +177,8 @@ made available under the /xchg CIFS share."
 
 (define* (iso9660-image #:key
                         (name "iso9660-image")
+                        file-system-label
+                        file-system-uuid
                         (system (%current-system))
                         (qemu qemu-minimal)
                         os-drv
@@ -211,7 +213,9 @@ INPUTS is a list of inputs (as for packages)."
            (make-iso9660-image #$(bootloader-package bootloader)
                                #$bootcfg-drv
                                #$os-drv
-                               "/xchg/guixsd.iso")
+                               "/xchg/guixsd.iso"
+                               #:volume-id #$file-system-label
+                               #:volume-uuid #$file-system-uuid)
            (reboot))))
    #:system system
    #:make-disk-image? #f
@@ -363,6 +367,8 @@ to USB sticks meant to be read-only."
                          (bootcfg  (operating-system-bootcfg os)))
       (if (string=? "iso9660" file-system-type)
           (iso9660-image #:name name
+                         #:file-system-label root-label
+                         #:file-system-uuid #f
                          #:os-drv os-drv
                          #:bootcfg-drv bootcfg
                          #:bootloader (bootloader-configuration-bootloader

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#27521] [PATCH] guix system: Add file system label and uuid to iso9660-image.
  2017-07-03 18:02 ` [bug#27521] [PATCH] guix system: Add file system label and uuid to iso9660-image Danny Milosavljevic
@ 2017-07-07 16:06   ` Danny Milosavljevic
  0 siblings, 0 replies; 27+ messages in thread
From: Danny Milosavljevic @ 2017-07-07 16:06 UTC (permalink / raw)
  To: 27521

On Mon,  3 Jul 2017 20:02:58 +0200
Danny Milosavljevic <dannym@scratchpost.org> wrote:

>        (if (string=? "iso9660" file-system-type)
>            (iso9660-image #:name name
> +                         #:file-system-label root-label
> +                         #:file-system-uuid #f
>                           #:os-drv os-drv
>                           #:bootcfg-drv bootcfg
>                           #:bootloader (bootloader-configuration-bootloader

I've pushed this to master as acc0f6bb5885e661a406a367a9543debc455221a.  That means that the iso file system will use the root-label from system-disk-image (body) as well.

uuid support is missing as you can see, but that's fine for the time being.

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2017-07-07 16:07 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-28 22:03 [bug#27521] [PATCH] build: Add iso9660 system image generator Danny Milosavljevic
2017-06-28 22:22 ` [bug#27521] [PATCH v2] " Danny Milosavljevic
2017-06-28 22:48 ` [bug#27521] [PATCH v3] " Danny Milosavljevic
2017-06-29  2:09 ` [bug#27521] [PATCH v4] " Danny Milosavljevic
2017-06-29 13:47   ` [bug#27521] [PATCH v5] " Danny Milosavljevic
2017-06-30 10:13     ` Danny Milosavljevic
2017-07-02 14:55     ` Ludovic Courtès
2017-07-02 18:37       ` Danny Milosavljevic
2017-07-02 20:09         ` Ludovic Courtès
2017-07-02 22:01           ` Danny Milosavljevic
2017-07-03  7:38             ` Ludovic Courtès
2017-07-03 10:31               ` Danny Milosavljevic
2017-07-03 11:49                 ` Ludovic Courtès
2017-07-03 10:34               ` [bug#27521] [PATCH] guix system: Add "--file-system-type" option Danny Milosavljevic
2017-07-03 11:56                 ` Ludovic Courtès
2017-07-03 13:14                   ` Danny Milosavljevic
2017-07-03 14:17                     ` Ludovic Courtès
2017-07-03 14:20                       ` Danny Milosavljevic
2017-07-03 15:31                         ` Ludovic Courtès
2017-07-03 14:42                 ` Danny Milosavljevic
2017-07-03 11:10               ` [bug#27521] [PATCH] build: Allow specifying volume-uuid with make-iso9660-image Danny Milosavljevic
2017-07-03 11:58                 ` Ludovic Courtès
2017-06-29  3:17 ` [bug#27521] [PATCH] linux-initrd: Add isofs if necessary Danny Milosavljevic
2017-07-02 14:56   ` Ludovic Courtès
2017-07-02 18:28     ` Danny Milosavljevic
2017-07-03 18:02 ` [bug#27521] [PATCH] guix system: Add file system label and uuid to iso9660-image Danny Milosavljevic
2017-07-07 16:06   ` Danny Milosavljevic

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.