From 20157dae27d3ed2c754a5c15aa001f6c268366c3 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Mon, 1 Dec 2025 08:02:24 +0100 Subject: [PATCH] image: Add qcow2-gpt image type. qcow2 is a mbr-hybrid image. But on aarch64, we have to use grub-efi bootloader. For that bootloader, gpt should be used and Guix errors if it isn't (due to failed check in Guix code). So it's impossible to generate qcow2 type aarch64 image without using customized bootloader. One would have to define their own image instead of using the ones pre-defined. * gnu/system/system.scm (qcow2-gpt-image-type): New variable. * doc/guix.texi: Document qcow2-gpt and its use. Change-Id: I93f0880c7ca2d3f934067c12dd1143ad20828333 Signed-off-by: Rutherther --- doc/guix.texi | 17 +++++++++++++++-- gnu/system/image.scm | 11 +++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index fc25b653f323a8e0be7ff82e1cd835eddb02cba3..55d3af16426db86d09153c49d2755df4b0f95828 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -47841,7 +47841,9 @@ machine. The @code{grub-bootloader} bootloader is always used independently of what is declared in the @code{operating-system} file passed as argument. This is to make it easier to work with QEMU, which uses the SeaBIOS BIOS by default, expecting a bootloader to be installed -in the Master Boot Record (MBR). +in the Master Boot Record (MBR). In case the virtual machine is +going to be AArch64, you might want to take a look at @code{qcow2-gpt} +image type that installs bootloader only in EFI. @cindex docker-image, creating docker images When using the @code{docker} image type, a Docker image is produced. @@ -54765,7 +54767,18 @@ Build an image based on the @code{efi32-disk-image} image. @defvar qcow2-image-type Build an image based on the @code{mbr-disk-image} image but with the -@code{compressed-qcow2} image format. +@code{compressed-qcow2} image format. The resulting image will have +an MBR embedded bootloader as well as an EFI bootloader. This image +is not suitable for architectures that do not support `grub-pc`, +such as AArch64. See @code{qcow2-gpt-image-type} for an alternative. +@end defvar + +@defvar qcow2-gpt-image-type +Build an image based on the @code{efi-disk-image} image but with the +@code{compressed-qcow2} image format. The resulting image will have +only EFI bootloader, unlike @code{qcow2-image-type}. This image +is suitable for architectures that do not support `grub-pc`, such +as AArch64. @end defvar @defvar iso-image-type diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 9e9b7cbba47dd35e72618a7e60b3fafc94dfd676..de975360ae96a1477e643ab3a1f4386f3b850fd2 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -98,6 +98,7 @@ efi-raw-image-type efi32-raw-image-type qcow2-image-type + qcow2-gpt-image-type iso-image-type uncompressed-iso-image-type docker-image-type @@ -265,6 +266,16 @@ set to the given OS." (format 'compressed-qcow2)) <>)))) +(define qcow2-gpt-image-type + (image-type + (name 'qcow2-gpt) + (constructor (cut image-with-os + (image + (inherit efi-disk-image) + (name 'image.qcow2) + (format 'compressed-qcow2)) + <>)))) + (define iso-image-type (image-type (name 'iso9660)