aboutsummaryrefslogtreecommitdiff
path: root/gnu/build/vm.scm
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2017-07-10 14:37:53 -0400
committerLeo Famulari <leo@famulari.name>2017-07-10 14:37:53 -0400
commitc8eb2b8c60d954b4522555a5c75b7bb4be5a1a4d (patch)
tree3a2e569e333ccd9265237868d3f46b2d1e04e3a9 /gnu/build/vm.scm
parentad22c7185395a52bd90ea5890a2ac79f44d00352 (diff)
parent61adfb00b11cc16a70e60f19fd8e0a838a3ef608 (diff)
downloadpatches-c8eb2b8c60d954b4522555a5c75b7bb4be5a1a4d.tar
patches-c8eb2b8c60d954b4522555a5c75b7bb4be5a1a4d.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/build/vm.scm')
-rw-r--r--gnu/build/vm.scm30
1 files changed, 28 insertions, 2 deletions
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 8f7fc3c9c4..2d41c5756b 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -26,6 +26,7 @@
#:use-module (guix build syscalls)
#:use-module (gnu build linux-boot)
#:use-module (gnu build install)
+ #:use-module (gnu build file-systems)
#:use-module (guix records)
#:use-module ((guix combinators) #:select (fold2))
#:use-module (ice-9 format)
@@ -50,7 +51,8 @@
estimated-partition-size
root-partition-initializer
initialize-partition-table
- initialize-hard-disk))
+ initialize-hard-disk
+ make-iso9660-image))
;;; Commentary:
;;;
@@ -351,6 +353,30 @@ 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
+ #: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? (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)
+ ,@(if volume-uuid
+ `("-volume_date" "uuid"
+ ,(string-filter (lambda (value)
+ (not (char=? #\- value)))
+ (iso9660-uuid->string
+ volume-uuid)))
+ `()))))
+ (error "failed to create ISO9660 image"))))
+
(define* (initialize-hard-disk device
#:key
bootloader-package
@@ -405,7 +431,7 @@ passing it a directory name where it is mounted."
(lambda (port)
(format port
"insmod part_msdos~@
- search --set=root --label gnu-disk-image~@
+ search --set=root --label GuixSD~@
configfile /boot/grub/grub.cfg~%")))
(display "creating EFI firmware image...")