From 87dd32f21450c4f84c55f6afc11ba1979e201ec9 Mon Sep 17 00:00:00 2001
From: Pavel Shlyak <p.shlyak@pantherx.org>
Date: Sun, 22 May 2022 16:53:30 +0300
Subject: [PATCH 2/4] Image API: support VFAT partitions in GPT

---
 gnu/system/image.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index a83f844682..a6267feab2 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -317,10 +317,15 @@ (define (partition->dos-type partition)
     (define (partition->gpt-type partition)
       ;; Return the genimage GPT partition type code corresponding to PARTITION.
       ;; See https://github.com/pengutronix/genimage/blob/master/README.rst
-      (let ((flags (partition-flags partition)))
+      (let ((flags (partition-flags partition)) (file-system (partition-file-system partition)))
         (cond
           ((member 'esp flags) "U")
-          (else "L"))))
+          ((string-prefix? "ext" file-system) "L")
+          ((string=? file-system "vfat") "F")
+          (else
+            (raise (condition
+              (&message
+               (message "unsupported partition type"))))))))
 
     (define (partition-image partition)
       ;; Return as a file-like object, an image of the given PARTITION.  A
-- 
2.32.1 (Apple Git-133)

