guix-commits
[Top][All Lists]
Advanced

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

branch master updated: image: Add fat32 support.


From: guix-commits
Subject: branch master updated: image: Add fat32 support.
Date: Tue, 31 May 2022 09:04:46 -0400

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new 8b680b00d4 image: Add fat32 support.
8b680b00d4 is described below

commit 8b680b00d49bdd1064918ffd221ffbcc11ba902a
Author: Pavel Shlyak <p.shlyak@pantherx.org>
AuthorDate: Thu May 26 21:00:51 2022 +0300

    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 <othacehe@gnu.org>
---
 gnu/build/image.scm  | 24 ++++++++++++++----------
 gnu/system/image.scm |  8 ++++++--
 2 files changed, 20 insertions(+), 12 deletions(-)

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 @@ turn doesn't take any constant overhead into account, force 
a 1-MiB minimum."
                            (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 @@ ROOT directory to populate the image."
     (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
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index dd32e58c2d..f02f6e0b8c 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -312,7 +312,9 @@ used in the image."
         (cond
          ((member 'esp flags) "0xEF")
          ((string-prefix? "ext" file-system) "0x83")
-         ((string=? file-system "vfat") "0x0E")
+         ((or (string=? file-system "vfat")
+              (string=? file-system "fat16")) "0x0E")
+         ((string=? file-system "fat32") "0x0C")
          (else
           (raise (condition
                   (&message
@@ -329,7 +331,9 @@ used in the image."
         (cond
          ((member 'esp flags) "U")
          ((string-prefix? "ext" file-system) "L")
-         ((string=? file-system "vfat") "F")
+         ((or (string=? file-system "vfat")
+              (string=? file-system "fat16")
+              (string=? file-system "fat32")) "F")
          (else
           (raise (condition
                   (&message



reply via email to

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