From ec65ce70cfb26a9936099cdb0d1a156a747fa42b Mon Sep 17 00:00:00 2001
From: Pavel Shlyak <p.shlyak@pantherx.org>
Date: Sun, 22 May 2022 16:52:45 +0300
Subject: [PATCH 1/4] Image API: support VFAT partitions in MBR

---
 gnu/system/image.scm | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index 42e215f614..a83f844682 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -304,10 +304,15 @@ (define (format->image-type format)
     (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"))))
+          ((member 'esp flags) "0xEF")
+          ((string-prefix? "ext" file-system) "0x83")
+          ((string=? file-system "vfat") "0x0E")
+          (else
+            (raise (condition
+              (&message
+               (message "unsupported partition type"))))))))
 
     (define (partition->gpt-type partition)
       ;; Return the genimage GPT partition type code corresponding to PARTITION.
-- 
2.32.1 (Apple Git-133)

