From 8b680b00d49bdd1064918ffd221ffbcc11ba902a Mon Sep 17 00:00:00 2001 From: Pavel Shlyak Date: Thu, 26 May 2022 21:00:51 +0300 Subject: image: Add fat32 support. * gnu/build/image.scm (make-vfat-image): Pass fs-bits as an argument and force 1kb logical sector size only if "ESP" flag is set. (make-partition-image): Add "fat32" partition type, support explicit "fat16" type with vfat alias. * gnu/system/image.scm (partition->dos-type partition): Return file system IDs for "fat16" and "fat32" partitions. (partition->gpt-type partition): Ditto. Signed-off-by: Mathieu Othacehe --- gnu/build/image.scm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'gnu/build/image.scm') diff --git a/gnu/build/image.scm b/gnu/build/image.scm index 3e8b94e2d6..ddfd34c111 100644 --- a/gnu/build/image.scm +++ b/gnu/build/image.scm @@ -95,16 +95,18 @@ (define* (make-ext-image partition target root (estimate-partition-size root) size))))))) -(define* (make-vfat-image partition target root) +(define* (make-vfat-image partition target root fs-bits) "Handle the creation of VFAT partition images. See 'make-partition-image'." (let ((size (partition-size partition)) - (label (partition-label partition))) - (invoke "fakeroot" "mkdosfs" "-n" label "-C" target - "-F" "16" "-S" "1024" - (size-in-kib - (if (eq? size 'guess) - (estimate-partition-size root) - size))) + (label (partition-label partition)) + (flags (partition-flags partition))) + (apply invoke "fakeroot" "mkdosfs" "-n" label "-C" target + "-F" (number->string fs-bits) + (size-in-kib + (if (eq? size 'guess) + (estimate-partition-size root) + size)) + (if (member 'esp flags) (list "-S" "1024") '())) (for-each (lambda (file) (unless (member file '("." "..")) (invoke "mcopy" "-bsp" "-i" target @@ -120,8 +122,10 @@ (define* (make-partition-image partition-sexp target root) (cond ((string-prefix? "ext" type) (make-ext-image partition target root)) - ((string=? type "vfat") - (make-vfat-image partition target root)) + ((or (string=? type "vfat") (string=? type "fat16")) + (make-vfat-image partition target root 16)) + ((string=? type "fat32") + (make-vfat-image partition target root 32)) (else (raise (condition (&message -- cgit v1.2.3