image: Add mbr-raw-image-type and use by default.

* gnu/system/image.scm (mbr-disk-image, mbr-raw-image-type): New variables.
(qcow2-image-type): Inherit mbr-disk-image.
* guix/scripts/system.scm (%default-options): Use mbr-raw-image-type by
default.
* gnu/tests/install.scm (run-install): Use mbr-raw in the tests.
* doc/guix-cookbook.texi (Guix System Image API): Update the list of image
types.
* doc/guix.texi (Invoking guix system, System Images, image-type Reference):
Add mbr-raw and switch documented default to it.
This commit is contained in:
Josselin Poiret 2023-07-27 18:28:18 +02:00
parent 519c3b7803
commit d57cab7641
No known key found for this signature in database
GPG Key ID: 505E40B916171A8A
5 changed files with 40 additions and 15 deletions

View File

@ -2019,17 +2019,23 @@ One can run:
mathieu@@cervin:~$ guix system --list-image-types
The available image types are:
- unmatched-raw
- rock64-raw
- pinebook-pro-raw
- pine64-raw
- novena-raw
- hurd-raw
- hurd-qcow2
- qcow2
- uncompressed-iso9660
- efi-raw
- arm64-raw
- arm32-raw
- iso9660
- uncompressed-iso9660
- tarball
- efi-raw
- mbr-raw
- docker
- wsl2
- raw-with-offset
- efi32-raw
@end example
and by writing an @code{operating-system} file based on

View File

@ -40884,7 +40884,7 @@ 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{efi-raw}. When its value is @code{iso9660}, the
defaults to @code{mbr-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
@ -40903,7 +40903,7 @@ 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{efi-raw} image type, a raw disk image is produced;
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
@code{/dev/sdc} is the device corresponding to a USB stick, one can copy
the image to it using the following command:
@ -41041,7 +41041,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{efi-raw} image type.
@code{mbr-raw} image type.
@cindex ISO-9660 format
@cindex CD image format
@ -45193,7 +45193,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{efi-raw}, @code{iso9660} and
different image types, such as @code{mbr-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
@ -45545,6 +45545,10 @@ record.
There are several @code{image-type} records provided by the @code{(gnu
system image)} and the @code{(gnu system images @dots{})} modules.
@defvar mbr-raw-image-type
Build an image based on the @code{mbr-disk-image} image.
@end defvar
@defvar efi-raw-image-type
Build an image based on the @code{efi-disk-image} image.
@end defvar
@ -45554,7 +45558,7 @@ Build an image based on the @code{efi32-disk-image} image.
@end defvar
@defvar qcow2-image-type
Build an image based on the @code{efi-disk-image} image but with the
Build an image based on the @code{mbr-disk-image} image but with the
@code{compressed-qcow2} image format.
@end defvar
@ -45625,7 +45629,7 @@ wsl -d Guix
So, if we get back to the @code{guix system image} command taking an
@code{operating-system} declaration as argument. By default, the
@code{efi-raw-image-type} is used to turn the provided
@code{mbr-raw-image-type} is used to turn the provided
@code{operating-system} into an actual bootable image.
To use a different @code{image-type}, the @code{--image-type} option can

View File

@ -76,6 +76,7 @@
esp32-partition
root-partition
mbr-disk-image
efi-disk-image
iso9660-image
docker-image
@ -84,6 +85,7 @@
raw-with-offset-disk-image
image-with-os
mbr-raw-image-type
efi-raw-image-type
efi32-raw-image-type
qcow2-image-type
@ -145,6 +147,15 @@ parent image record."
(flags '(boot))
(initializer (gexp initialize-root-partition))))
(define mbr-disk-image
(image-without-os
(format 'disk-image)
(partition-table-type 'mbr)
(partitions
(list (partition
(inherit root-partition)
(offset root-offset))))))
(define efi-disk-image
(image-without-os
(format 'disk-image)
@ -201,6 +212,11 @@ set to the given OS."
(inherit base-image)
(operating-system os)))
(define mbr-raw-image-type
(image-type
(name 'mbr-raw)
(constructor (cut image-with-os mbr-disk-image <>))))
(define efi-raw-image-type
(image-type
(name 'efi-raw)
@ -216,8 +232,7 @@ set to the given OS."
(name 'qcow2)
(constructor (cut image-with-os
(image
(inherit efi-disk-image)
(partition-table-type 'mbr)
(inherit mbr-disk-image)
(name 'image.qcow2)
(format 'compressed-qcow2))
<>))))

View File

@ -229,7 +229,7 @@ reboot\n")
(gnu installer tests)
(guix combinators))))
(uefi-support? #f)
(installation-image-type 'efi-raw)
(installation-image-type 'mbr-raw)
(install-size 'guess)
(target-size (* 2200 MiB))
(number-of-disks 1))
@ -291,7 +291,7 @@ such as for RAID systems."
'("-bios" #$uefi-firmware)
'())
#$@(cond
((eq? 'efi-raw installation-image-type)
((eq? 'mbr-raw installation-image-type)
#~("-drive"
,(string-append "file=" #$image
",if=virtio,readonly")))

View File

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