From patchwork Wed Mar 22 12:53:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Trofimov X-Patchwork-Id: 48574 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 9925516F9E; Wed, 22 Mar 2023 12:54:19 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED 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 E790016F5A for ; Wed, 22 Mar 2023 12:54:16 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pexye-0005nb-6x; Wed, 22 Mar 2023 08:54:04 -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 1pexyc-0005nL-Ql for guix-patches@gnu.org; Wed, 22 Mar 2023 08:54: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 1pexyc-0005Yt-8F for guix-patches@gnu.org; Wed, 22 Mar 2023 08:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pexyc-0002yq-4S for guix-patches@gnu.org; Wed, 22 Mar 2023 08:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62223] [PATCH v2] image: Prefer gpt partition table for efi images References: <20230316173137.25074-1-sarg@sarg.org.ru> In-Reply-To: <20230316173137.25074-1-sarg@sarg.org.ru> Resent-From: Sergey Trofimov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 22 Mar 2023 12:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62223 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62223@debbugs.gnu.org Cc: Josselin Poiret , Sergey Trofimov Received: via spool by 62223-submit@debbugs.gnu.org id=B62223.167948961511420 (code B ref 62223); Wed, 22 Mar 2023 12:54:02 +0000 Received: (at 62223) by debbugs.gnu.org; 22 Mar 2023 12:53:35 +0000 Received: from localhost ([127.0.0.1]:33802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pexyB-0002y8-FJ for submit@debbugs.gnu.org; Wed, 22 Mar 2023 08:53:35 -0400 Received: from mail-ed1-f53.google.com ([209.85.208.53]:34731) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pexy9-0002xu-59 for 62223@debbugs.gnu.org; Wed, 22 Mar 2023 08:53:33 -0400 Received: by mail-ed1-f53.google.com with SMTP id b20so39563634edd.1 for <62223@debbugs.gnu.org>; Wed, 22 Mar 2023 05:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1679489607; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oi9kOQOPJjJ59xt8hinWk8GxnLwItG5vafMwsZ6DurY=; b=Lop8iRs1D4ThaJiIiq2XdwZsrb8jAccAGvr5Ps+FVM9uGTTRQlpvmAGCz86qQH8wlT qfjYVA8gpGEFBQptBVIHYjeesGoF1Dc/0QCIXNsIb304T/2VcLw7GmX1V28yT7j5Mrxx +NJTHrYH4YD8V5GatzMfGTaAX1X0bEZWyuTV4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679489607; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oi9kOQOPJjJ59xt8hinWk8GxnLwItG5vafMwsZ6DurY=; b=lGtsLZv+jGJEKSPhEM/tlBU6OShWPlsOZJfgTjbn3dF7pFEKY9eG4qidznak1Qyg7J M64XXvwlbCKPkNM3sw3yTcbzKI/FuUoSJYWUG3jhq4J2TxY+OTov37hjsA1BmS+Aulrm oOlFRoPOw6Uo/P93IcvvqxMzGFRUX5fiASs8zNgV6f7ioNLMlK3vu68cElsNvmCZnUZh D9gZWbMC8jYdeoTLJQr2Q9eTe6adH7ga3HluVqsYkpHWiPeGlPNWJI7cwpHS3mUA5RpU BuW6NGqrNI8xQ11wNCV7N+xgDc5GC/xgfqLhlp3mGH/0ltmlOtvvmnBmizBKmza9YBPo 9Bnw== X-Gm-Message-State: AO0yUKUZx3C/v6QA+MvspT/jtNoEaCfhcudW5jWgOEEuX5jk5PVSJ287 Wwd9ORxLJAhEfgmg4+D4OVCH6rXl00qllvG+FXlOtA== X-Google-Smtp-Source: AK7set91rvlpvJuYs9ScWntqAF2zi9WuGT2EppSGG9CBG5gHxre27EqOOy3/2SLDZsVT8u1Jk6DuiA== X-Received: by 2002:a17:906:32c4:b0:932:40f4:5c44 with SMTP id k4-20020a17090632c400b0093240f45c44mr6828632ejk.36.1679489607179; Wed, 22 Mar 2023 05:53:27 -0700 (PDT) Received: from localhost ([95.168.147.255]) by smtp.gmail.com with ESMTPSA id v2-20020a170906292200b009321cd80e15sm6803105ejd.73.2023.03.22.05.53.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 05:53:27 -0700 (PDT) From: Sergey Trofimov Date: Wed, 22 Mar 2023 13:53:28 +0100 Message-Id: <20230322125328.23578-1-sarg@sarg.org.ru> X-Mailer: git-send-email 2.39.2 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/system/image.scm (efi-disk-image): Use gpt partition-table-type. (efi32-disk-image): Use gpt partition-table-type. (qcow2-image-type): Use mbr partition-table-type explicitly. * gnu/tests/image.scm: Assert partition table type of efi-disk-image. --- gnu/system/image.scm | 3 +++ gnu/tests/image.scm | 23 ++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/gnu/system/image.scm b/gnu/system/image.scm index afef79185f..699feaf05d 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -147,11 +147,13 @@ (define root-partition (define efi-disk-image (image-without-os (format 'disk-image) + (partition-table-type 'gpt) (partitions (list esp-partition root-partition)))) (define efi32-disk-image (image-without-os (format 'disk-image) + (partition-table-type 'gpt) (partitions (list esp32-partition root-partition)))) (define iso9660-image @@ -214,6 +216,7 @@ (define qcow2-image-type (constructor (cut image-with-os (image (inherit efi-disk-image) + (partition-table-type 'mbr) (name 'image.qcow2) (format 'compressed-qcow2)) <>)))) diff --git a/gnu/tests/image.scm b/gnu/tests/image.scm index 99d34b7670..be6852cae0 100644 --- a/gnu/tests/image.scm +++ b/gnu/tests/image.scm @@ -20,7 +20,7 @@ (define-module (gnu tests image) #:use-module (gnu) #:use-module (gnu image) #:use-module (gnu tests) - #:autoload (gnu system image) (system-image root-offset) + #:autoload (gnu system image) (system-image root-offset image-with-os efi-disk-image) #:use-module (gnu system uuid) #:use-module (gnu system vm) #:use-module (gnu packages guile) @@ -153,6 +153,10 @@ (define i5 (flags '(boot)) (initializer dummy-initializer)))))) +;; A efi disk image with default partitions +(define i6 + (image-with-os efi-disk-image %simple-efi-os)) + (define (run-images-test) (define test (with-imported-modules '((srfi srfi-64) @@ -202,10 +206,10 @@ (define d2-device (disk-get-primary-partition-count (disk-new d2-device))) (test-equal "test" - (let* ((disk (disk-new d2-device)) - (partitions (disk-partitions disk)) - (boot-partition (find normal-partition? partitions))) - (partition-get-name boot-partition))) + (let* ((disk (disk-new d2-device)) + (partitions (disk-partitions disk)) + (boot-partition (find normal-partition? partitions))) + (partition-get-name boot-partition))) ;; Image i3. (define i3-image @@ -259,6 +263,15 @@ (define (sector->byte sector) (filter data-partition? (disk-partitions (disk-new d5-device))))) + ;; Image i6. + (define i6-image + #$(system-image i6)) + (define d6-device + (get-device i6-image)) + + (test-equal "gpt" + (disk-type-name (disk-probe d6-device))) + (test-end))))) (gexp->derivation "images-test" test))