From patchwork Sun May 28 09:44:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 50376 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C181E27BBE9; Sun, 28 May 2023 10:44:17 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3A39E27BBE2 for ; Sun, 28 May 2023 10:44:16 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3CwX-0008Dx-CD; Sun, 28 May 2023 05:44:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3CwU-0008Da-GP for guix-patches@gnu.org; Sun, 28 May 2023 05:44:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q3CwU-0003JZ-8j for guix-patches@gnu.org; Sun, 28 May 2023 05:44:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q3CwU-0001bN-4v for guix-patches@gnu.org; Sun, 28 May 2023 05:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63766] [PATCH 2/4] gnu: image: Add support for unformatted partitions. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Sun, 28 May 2023 09:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63766 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63766@debbugs.gnu.org Cc: Efraim Flashner , ( , Christopher Baines , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Raghav Gururajan , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice , jgart X-Debbugs-Original-Xcc: ( , Christopher Baines , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Raghav Gururajan , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice , jgart Received: via spool by 63766-submit@debbugs.gnu.org id=B63766.16852670286105 (code B ref 63766); Sun, 28 May 2023 09:44:02 +0000 Received: (at 63766) by debbugs.gnu.org; 28 May 2023 09:43:48 +0000 Received: from localhost ([127.0.0.1]:53295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3CwG-0001aO-Ay for submit@debbugs.gnu.org; Sun, 28 May 2023 05:43:48 -0400 Received: from mail-wm1-f52.google.com ([209.85.128.52]:45308) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3CwA-0001Zg-9M for 63766@debbugs.gnu.org; Sun, 28 May 2023 05:43:43 -0400 Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-3f6cbdf16d2so14473805e9.2 for <63766@debbugs.gnu.org>; Sun, 28 May 2023 02:43:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685267016; x=1687859016; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=iQg9ql3ZIuaP1nOqFaG3LeLoMOfUqmLDaS+XeSF4iWI=; b=JDCcC+1A9qXR6h4ZaE8QL4cdjyg5U4R0FbDxKFTSdznHxVqZ1uBXYewZ7Ne7zEtj48 +rpzwgUhduqnr5jBoKDgXOLysIA8MCWlWw6l5A8B6yaOdtDIMYcOGW7eKnj5heD6fVGt IRKoYAeuha9Q6cFp88PHMsxk3+RinhNkgpxqTsshMaiR9IGv1JmNOUWPDNXjWm7jBaMS wvx+etRI7/y2ZSQ2qt5ULh9HBliXBySLEKWih8J50zaMfWLz8N+RC7VXRCt+VhQIGK46 lf/rnClne3ZCCjZa8Zl26Z0q5t5LuwUo0287yyw6rW9Z0HYQFfc26pKxwdhs+tHbnK4b AOSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685267016; x=1687859016; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=iQg9ql3ZIuaP1nOqFaG3LeLoMOfUqmLDaS+XeSF4iWI=; b=ATOIXrbndNf4ccMF1TKeWjMmsVIqwGTpAvRgcVfwAkb71HVAFCQGyLayH16yWwn++g qj52jy2GmFcbC1B3OWj6ymzOoxCQwUCTTg3IV64h7etQwzHEEyrls8vLGQAHyxiORg20 N4dw6zVyA+sPeFDYmES89Z17J/BWNY0vSzxVzW2Mf50SStItrz0ZMYW0luv7nv1AIfes 2UgSMuaBJR3hxnT58Uuq2/8VOBfhwggB7uNmqrg1mcOv4eoZszZmb3WJ7AcOK7ZcIOUe 0TWK5PHtFc4gocx/eQfgLRgkFhqkHAgNkQSUwAE6rlw+FMdXuWTy7Ol3l10b70O8pMWB 7hpg== X-Gm-Message-State: AC+VfDywFeaE5PTyLjuBTtzZxx6SYd4znmEOsahZpqFPKNm4ZE/wlQDB GOifWnxrEJOSVWRROt/bHuDDECPErIAfnw== X-Google-Smtp-Source: ACHHUZ5rxZkVmOmu3IPMBHsoMs+V5QVgNtrQfToRim6a5Zt1DoCr88EgwyXOAEE89AGzFvfxu/hlzA== X-Received: by 2002:a1c:7319:0:b0:3f7:5d:4a08 with SMTP id d25-20020a1c7319000000b003f7005d4a08mr1215262wmb.1.1685267016451; Sun, 28 May 2023 02:43:36 -0700 (PDT) Received: from localhost ([37.46.46.3]) by smtp.gmail.com with ESMTPSA id q21-20020a1ce915000000b003f421979398sm14196469wmc.26.2023.05.28.02.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 May 2023 02:43:36 -0700 (PDT) From: Efraim Flashner Date: Sun, 28 May 2023 12:44:19 +0300 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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 ;;; Copyright © 2022 Pavel Shlyak ;;; Copyright © 2022 Denis 'GNUtoo' Carikli +;;; Copyright © 2023 Efraim Flashner ;;; ;;; 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 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli ;;; Copyright © 2022 Alex Griffin +;;; Copyright © 2023 Efraim Flashner ;;; ;;; 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)