aboutsummaryrefslogtreecommitdiff
path: root/gnu/build/vm.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-05-06 22:53:58 +0200
committerMarius Bakke <mbakke@fastmail.com>2017-05-19 12:59:25 +0200
commit4d415f0c3c0cf4acbc1297ccf2b27121846a4289 (patch)
tree16b2432ebab6767fb9a5ff711c68e1a152ef1ddd /gnu/build/vm.scm
parent01cc84dadee4571e5793658e912ee05d60fbf060 (diff)
downloadguix-4d415f0c3c0cf4acbc1297ccf2b27121846a4289.tar
guix-4d415f0c3c0cf4acbc1297ccf2b27121846a4289.tar.gz
vm: Support creating FAT partitions.
* gnu/build/vm.scm (create-ext-file-system, create-fat-file-system): New procedures. (format-partition): Use them. Error for unknown file systems. * gnu/system/vm.scm (qemu-image): Include DOSFSTOOLS. * gnu/system/linux-initrd.scm (base-initrd): Always add nls_is8859-1.ko.
Diffstat (limited to 'gnu/build/vm.scm')
-rw-r--r--gnu/build/vm.scm30
1 files changed, 26 insertions, 4 deletions
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index c7449cfbef..7ce1ec8e1e 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -213,10 +213,10 @@ actual /dev name based on DEVICE."
(define MS_BIND 4096) ; <sys/mounts.h> again!
-(define* (format-partition partition type
- #:key label)
- "Create a file system TYPE on PARTITION. If LABEL is true, use that as the
-volume name."
+(define* (create-ext-file-system partition type
+ #:key label)
+ "Create an ext-family filesystem of TYPE on PARTITION. If LABEL is true,
+use that as the volume name."
(format #t "creating ~a partition...\n" type)
(unless (zero? (apply system* (string-append "mkfs." type)
"-F" partition
@@ -225,6 +225,28 @@ volume name."
'())))
(error "failed to create partition")))
+(define* (create-fat-file-system partition
+ #:key label)
+ "Create a FAT filesystem on PARTITION. The number of File Allocation Tables
+will be determined based on filesystem size. If LABEL is true, use that as the
+volume name."
+ (format #t "creating FAT partition...\n")
+ (unless (zero? (apply system* "mkfs.fat" partition
+ (if label
+ `("-n" ,label)
+ '())))
+ (error "failed to create FAT partition")))
+
+(define* (format-partition partition type
+ #:key label)
+ "Create a file system TYPE on PARTITION. If LABEL is true, use that as the
+volume name."
+ (cond ((string-prefix? "ext" type)
+ (create-ext-file-system partition type #:label label))
+ ((or (string-prefix? "fat" type) (string= "vfat" type))
+ (create-fat-file-system partition #:label label))
+ (else (error "Unsupported file system."))))
+
(define (initialize-partition partition)
"Format PARTITION, a <partition> object with a non-#f 'device' field, mount
it, run its initializer, and unmount it."