summary refs log tree commit diff
diff options
context:
space:
mode:
authorPavel Shlyak <p.shlyak@pantherx.org>2022-05-22 16:52:45 +0300
committerMathieu Othacehe <othacehe@gnu.org>2022-05-23 09:17:12 +0200
commit76139eb2535b6b4ac53178c7066d92550f817d7e (patch)
tree184d8edd78d495706d3842522d3116413612f864
parentdb3193f55b455440958c8ce0386a88cf8f75b1e5 (diff)
downloadguix-76139eb2535b6b4ac53178c7066d92550f817d7e.tar.gz
system: image: Support MBR vfat partitions.
* gnu/system/image.scm (system-disk-image): Support them.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
-rw-r--r--gnu/system/image.scm13
1 files changed, 11 insertions, 2 deletions
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index 2cd035e4e7..cdb6c09633 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2020, 2021 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2022 Pavel Shlyak <p.shlyak@pantherx.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -305,10 +306,18 @@ used in the image."
     (define (partition->dos-type partition)
       ;; Return the MBR partition type corresponding to the given PARTITION.
       ;; See: https://en.wikipedia.org/wiki/Partition_type.
-      (let ((flags (partition-flags partition)))
+      (let ((flags (partition-flags partition))
+            (file-system (partition-file-system partition)))
         (cond
          ((member 'esp flags) "0xEF")
-         (else "0x83"))))
+         ((string-prefix? "ext" file-system) "0x83")
+         ((string=? file-system "vfat") "0x0E")
+         (else
+          (raise (condition
+                  (&message
+                   (message
+                    (format #f (G_ "unsupported partition type: ~a")
+                            file-system)))))))))
 
     (define (partition->gpt-type partition)
       ;; Return the genimage GPT partition type code corresponding to PARTITION.