all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: 63766@debbugs.gnu.org
Cc: "Efraim Flashner" <efraim@flashner.co.il>
Subject: [bug#63766] [PATCH 2/4] gnu: image: Add support for unformatted partitions.
Date: Sun, 28 May 2023 12:44:19 +0300	[thread overview]
Message-ID: <b25689c92bc381c8019e239a540a7175f5efc2fe.1685266344.git.efraim@flashner.co.il> (raw)
In-Reply-To: <cover.1685266344.git.efraim@flashner.co.il>

* 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.
[partition-image]: Add coreutils to image-builder closure.
---
 gnu/build/image.scm  |  8 ++++++++
 gnu/system/image.scm | 10 +++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index 65a0373980..d47cb31aa0 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,11 @@ (define* (make-vfat-image partition target root fs-bits)
                           (string-append "::" file))))
               (scandir root))))
 
+(define* (make-unformatted-image partition target)
+  "Make an unformatted partition of a certain size."
+  (let ((size (partition-size partition)))
+    (invoke "truncate" "--size" (number->string size) target)))
+
 (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 +140,8 @@ (define* (make-partition-image partition-sexp target root)
       (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..3fe813f096 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 @@ (define* (system-disk-image 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
@@ -414,7 +418,11 @@ (define* (system-disk-image image
               (with-imported-modules*
                (let ((initializer (or #$(partition-initializer partition)
                                       initialize-root-partition))
-                     (inputs '#+(list e2fsprogs fakeroot dosfstools mtools))
+                     (inputs '#+(list e2fsprogs     ; ext2/3/4
+                                      fakeroot
+                                      dosfstools    ; vfat
+                                      mtools        ; vfat
+                                      coreutils))   ; truncate
                      (image-root "tmp-root"))
                  (sql-schema #$schema)
 
-- 
Efraim Flashner   <efraim@flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted





  parent reply	other threads:[~2023-05-28  9:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-28  9:41 [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Efraim Flashner
2023-05-28  9:44 ` [bug#63766] [PATCH 1/4] gnu: bootloader: Add u-boot-sifive-unmatched-bootloader Efraim Flashner
2023-05-28  9:44 ` Efraim Flashner [this message]
2023-06-09 20:42   ` [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Ludovic Courtès
2023-06-13  9:53     ` Efraim Flashner
2023-06-21 22:08       ` Ludovic Courtès
2023-05-28  9:44 ` [bug#63766] [PATCH 3/4] system: images: Add unmatched module Efraim Flashner
2023-06-09 20:46   ` [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Ludovic Courtès
2023-05-28  9:44 ` [bug#63766] [PATCH 4/4] gnu: glibc-2.33: Fix building for riscv64-linux Efraim Flashner
2023-06-09 20:49   ` [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Ludovic Courtès
2023-06-09 20:50 ` Ludovic Courtès
2023-06-14 11:59 ` bug#63766: " Efraim Flashner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b25689c92bc381c8019e239a540a7175f5efc2fe.1685266344.git.efraim@flashner.co.il \
    --to=efraim@flashner.co.il \
    --cc=63766@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.