From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 22 08:53:35 2023 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 To: 62223@debbugs.gnu.org Subject: [PATCH v2] image: Prefer gpt partition table for efi images 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 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62223 Cc: Josselin Poiret , Sergey Trofimov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * 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)) -- 2.39.2