GNU bug report logs -
#62223
[PATCH] image: Prefer gpt partition table for efi disk images
Previous Next
Reported by: Sergey Trofimov <sarg <at> sarg.org.ru>
Date: Thu, 16 Mar 2023 17:39:01 UTC
Severity: normal
Tags: patch
Done: Josselin Poiret <dev <at> jpoiret.xyz>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Fri, 07 Jul 2023 21:50:34 +0200
with message-id <87bkgn7b79.fsf <at> jpoiret.xyz>
and subject line Re: [PATCH v2] image: Prefer gpt partition table for efi images
has caused the debbugs.gnu.org bug report #62223,
regarding [PATCH] image: Prefer gpt partition table for efi disk images
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
62223: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62223
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Hi guix, I got curious, what the easiest way to migrate existing guix os to a
new machine could be, and I've came to a conclusion that `guix system image`
fits this scenario perfectly. So I've tried to run `guix system image
--image-type=efi-raw --persistent --save-provenance system.scm`, but the
resulting image contained MBR style partition table. Although MBR support is a
must for an UEFI implementor, a better choice would be to use GPT style table.
* gnu/system/image.scm (efi-disk-image): Use gpt partition-table-type.
(efi32-disk-image): Use gpt partition-table-type.
* gnu/tests/image.scm: Assert partition table type of efi-disk-image.
---
gnu/system/image.scm | 2 ++
gnu/tests/image.scm | 23 ++++++++++++++++++-----
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index afef79185f..5356ecd616 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
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
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/plain, inline)]
Hi Sergey,
Sergey Trofimov <sarg <at> sarg.org.ru> writes:
> * 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.
Pushed as 209204e23b39af09e0ea92540b6fa00a60e6a0ae, thanks!
Best,
--
Josselin Poiret
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 1 year and 317 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.