[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/26: gnu: image: Add support for unformatted partitions.
From: |
guix-commits |
Subject: |
03/26: gnu: image: Add support for unformatted partitions. |
Date: |
Wed, 14 Jun 2023 07:58:52 -0400 (EDT) |
efraim pushed a commit to branch master
in repository guix.
commit cd55aa98011c42b8e97561f4eea024be751bcceb
Author: Efraim Flashner <efraim@flashner.co.il>
AuthorDate: Sun May 28 11:03:17 2023 +0300
gnu: image: Add support for unformatted partitions.
* gnu/build/image.scm (make-unformatted-image): New procedure.
(make-partition-image): Add support for unformatted partition.
* gnu/system/image.scm (system-disk-image)[partition->gpt-type]: Add
case for using unformatted partition uuid.
---
gnu/build/image.scm | 11 +++++++++++
gnu/system/image.scm | 4 ++++
2 files changed, 15 insertions(+)
diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index 65a0373980..49dc01c0d1 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2022 Pavel Shlyak <p.shlyak@pantherx.org>
;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -122,6 +123,14 @@ turn doesn't take any constant overhead into account,
force a 1-MiB minimum."
(string-append "::" file))))
(scandir root))))
+(define* (make-unformatted-image partition target)
+ "Make an unformatted partition of a certain size."
+ (let ((size (partition-size partition)))
+ ;; Create the file and then truncate it to the desired size.
+ (with-output-to-file target
+ (lambda _ (display "")))
+ (truncate-file target size)))
+
(define* (make-partition-image partition-sexp target root)
"Create and return the image of PARTITION-SEXP as TARGET. Use the given
ROOT directory to populate the image."
@@ -134,6 +143,8 @@ ROOT directory to populate the image."
(make-vfat-image partition target root 16))
((string=? type "fat32")
(make-vfat-image partition target root 32))
+ ((string=? type "unformatted")
+ (make-unformatted-image partition target))
(else
(raise (condition
(&message
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index afef79185f..958ba5cbb2 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2022 Pavel Shlyak <p.shlyak@pantherx.org>
;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;; Copyright © 2022 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -390,6 +391,9 @@ used in the image."
((or (string=? file-system "vfat")
(string=? file-system "fat16")
(string=? file-system "fat32")) "F")
+ ((and (string=? file-system "unformatted")
+ (partition-uuid partition))
+ (uuid->string (partition-uuid partition)))
(else
(raise (condition
(&message
- branch master updated (59e27b23ed -> 9edf093e58), guix-commits, 2023/06/14
- 03/26: gnu: image: Add support for unformatted partitions.,
guix-commits <=
- 02/26: gnu: bootloader: Add u-boot-sifive-unmatched-bootloader., guix-commits, 2023/06/14
- 06/26: gnu: Add python-pysynphot., guix-commits, 2023/06/14
- 04/26: system: images: Add unmatched module., guix-commits, 2023/06/14
- 09/26: gnu: Add python-stsci-image., guix-commits, 2023/06/14
- 05/26: gnu: glibc-2.33: Fix building for riscv64-linux., guix-commits, 2023/06/14
- 10/26: gnu: Add python-stsci-imagestats., guix-commits, 2023/06/14
- 12/26: gnu: Add python-tweakwcs., guix-commits, 2023/06/14
- 15/26: gnu: Add python-parsley., guix-commits, 2023/06/14
- 16/26: gnu: Add python-crds., guix-commits, 2023/06/14
- 22/26: gnu: Add python-stcal., guix-commits, 2023/06/14