me
/
guix
Archived
1
0
Fork 0

image: Introduce the mbr-hybrid-raw image type.

Until 209204e23b and
d57cab7641, the default image type used by "guix
system image" was an MBR image with an ESP partition.

Having both an MBR image and an ESP partition is handy because the image will
boot on most x86 based systems using legacy BIOS and/or UEFI.

We now have a distinction between MBR images and EFI images. Introduce a new
MBR hybrid image type and default to it to restore the default behaviour.

This also fixes the images section of (gnu ci) that was trying to install a
BIOS bootloader on an EFI, GPT image and failing to do so.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Mathieu Othacehe 2023-09-09 17:57:25 +02:00
parent 00a1ee15cd
commit e5ed1712da
No known key found for this signature in database
GPG Key ID: 8354763531769CA6
4 changed files with 43 additions and 9 deletions

View File

@ -40982,8 +40982,8 @@ QEMU monitor and the VM.
@cindex image, creating disk images
The @code{image} command can produce various image types. The image
type can be selected using the @option{--image-type} option. It
defaults to @code{mbr-raw}. When its value is @code{iso9660}, the
@option{--label} option can be used to specify a volume ID with
defaults to @code{mbr-hybrid-raw}. When its value is @code{iso9660},
the @option{--label} option can be used to specify a volume ID with
@code{image}. By default, the root file system of a disk image is
mounted non-volatile; the @option{--volatile} option can be provided to
make it volatile instead. When using @code{image}, the bootloader
@ -41001,8 +41001,8 @@ qemu-system-x86_64 -enable-kvm -hda /tmp/my-image.qcow2 -m 1000 \
-bios $(guix build ovmf)/share/firmware/ovmf_x64.bin
@end example
When using the @code{mbr-raw} image type, a raw disk image is produced;
it can be copied as is to a USB stick, for instance. Assuming
When using the @code{mbr-hybrid-raw} image type, a raw disk image is
produced; it can be copied as is to a USB stick, for instance. Assuming
@code{/dev/sdc} is the device corresponding to a USB stick, one can copy
the image to it using the following command:
@ -41139,7 +41139,7 @@ of the image.
For the @code{image} action, create an image with given @var{type}.
When this option is omitted, @command{guix system} uses the
@code{mbr-raw} image type.
@code{mbr-hybrid-raw} image type.
@cindex ISO-9660 format
@cindex CD image format
@ -45347,7 +45347,7 @@ then directly boot from it, without any kind of installation procedure.
The @command{guix system image} command is able to turn an operating
system definition into a bootable image. This command supports
different image types, such as @code{mbr-raw}, @code{iso9660} and
different image types, such as @code{mbr-hybrid-raw}, @code{iso9660} and
@code{docker}. Any modern @code{x86_64} machine will probably be able
to boot from an @code{iso9660} image. However, there are a few machines
out there that require specific image types. Those machines, in general
@ -45611,8 +45611,24 @@ from them to simplify the @code{image} definition. The @code{(gnu
system image)} module provides the following @code{image} definition
variables.
@defvar mbr-disk-image
An MBR disk-image composed of a single ROOT partition. The ROOT
partition starts at a 1@tie{}MiB offset so that the bootloader can
install itself in the post-MBR gap.
@end defvar
@defvar mbr-hybrid-disk-image
An MBR disk-image composed of two partitions: a 64 bits ESP partition
and a ROOT boot partition. The ESP partition starts at a 1@tie{}MiB
offset so that a BIOS compatible bootloader can install itself in the
post-MBR gap. The image can be used by @code{x86_64} and @code{i686}
machines supporting only legacy BIOS booting. The ESP partition ensures
that it can also be used by newer machines relying on UEFI booting,
hence the @emph{hybrid} denomination.
@end defvar
@defvar efi-disk-image
A MBR disk-image composed of two partitions: a 64 bits ESP partition and
A GPT disk-image composed of two partitions: a 64 bits ESP partition and
a ROOT boot partition. This image can be used on most @code{x86_64} and
@code{i686} machines, supporting BIOS or UEFI booting.
@end defvar
@ -45703,6 +45719,10 @@ system image)} and the @code{(gnu system images @dots{})} modules.
Build an image based on the @code{mbr-disk-image} image.
@end defvar
@defvar mbr-hybrid-raw-image-type
Build an image based on the @code{mbr-hybrid-disk-image} image.
@end defvar
@defvar efi-raw-image-type
Build an image based on the @code{efi-disk-image} image.
@end defvar

View File

@ -268,7 +268,7 @@ otherwise use the IMAGE name."
(if (member system %guix-system-supported-systems)
`(,(image->job store
(image
(inherit efi-disk-image)
(inherit mbr-hybrid-disk-image)
(operating-system installation-os))
#:name "usb-image"
#:system system)

View File

@ -77,6 +77,7 @@
root-partition
mbr-disk-image
mbr-hybrid-disk-image
efi-disk-image
iso9660-image
docker-image
@ -86,6 +87,7 @@
image-with-os
mbr-raw-image-type
mbr-hybrid-raw-image-type
efi-raw-image-type
efi32-raw-image-type
qcow2-image-type
@ -156,6 +158,13 @@ parent image record."
(inherit root-partition)
(offset root-offset))))))
(define mbr-hybrid-disk-image
(image-without-os
(format 'disk-image)
(partition-table-type 'mbr)
(partitions
(list esp-partition root-partition))))
(define efi-disk-image
(image-without-os
(format 'disk-image)
@ -217,6 +226,11 @@ set to the given OS."
(name 'mbr-raw)
(constructor (cut image-with-os mbr-disk-image <>))))
(define mbr-hybrid-raw-image-type
(image-type
(name 'mbr-hybrid-raw)
(constructor (cut image-with-os mbr-hybrid-disk-image <>))))
(define efi-raw-image-type
(image-type
(name 'efi-raw)

View File

@ -1169,7 +1169,7 @@ Some ACTIONS support additional ARGS.\n"))
(debug . 0)
(verbosity . #f) ;default
(validate-reconfigure . ,ensure-forward-reconfigure)
(image-type . mbr-raw)
(image-type . mbr-hybrid-raw)
(image-size . guess)
(install-bootloader? . #t)
(label . #f)