system: image: Support MBR vfat partitions.

* gnu/system/image.scm (system-disk-image): Support them.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
This commit is contained in:
Pavel Shlyak 2022-05-22 16:52:45 +03:00 committed by Mathieu Othacehe
parent db3193f55b
commit 76139eb253
No known key found for this signature in database
GPG key ID: 8354763531769CA6

View file

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2020, 2021 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2020, 2021 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2022 Pavel Shlyak <p.shlyak@pantherx.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -305,10 +306,18 @@ (define (format->image-type format)
(define (partition->dos-type partition) (define (partition->dos-type partition)
;; Return the MBR partition type corresponding to the given PARTITION. ;; Return the MBR partition type corresponding to the given PARTITION.
;; See: https://en.wikipedia.org/wiki/Partition_type. ;; 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 (cond
((member 'esp flags) "0xEF") ((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) (define (partition->gpt-type partition)
;; Return the genimage GPT partition type code corresponding to PARTITION. ;; Return the genimage GPT partition type code corresponding to PARTITION.