summary refs log tree commit diff
path: root/gnu/build
diff options
context:
space:
mode:
authorLiliana Marie Prikler <liliana.prikler@gmail.com>2023-07-13 17:21:32 +0200
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2023-07-13 17:21:32 +0200
commit15406013fe63f2ab238eec2d7a8adbc586806ac8 (patch)
tree8377d7c70a925f7c5ea4c04473c4eb547610b64b /gnu/build
parenta3ac317ab4a90f66ac65055fa26dee58ed2367b8 (diff)
parentdd4c1992103a65b8fbdc80fe07a9fe9be822769a (diff)
downloadguix-emacs-team.tar.gz
Merge branch 'master' into emacs-team emacs-team
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/image.scm11
1 files changed, 11 insertions, 0 deletions
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