Commit graph

12 commits

Author SHA1 Message Date
Mathieu Othacehe e3f0155c41
image: Do not use VM to create disk-images.
Now that installing Grub on raw disk-images is supported, we do not need to
rely on (gnu system vm) module.

* gnu/system/image.scm (make-system-image): Rename to ...
(system-image): ... this, and remove the compatibility wrapper.
(find-image): Turn to a monadic procedure. This will become useful when
introducing Hurd support, to be able to detect the target system.
* gnu/ci.scm (qemu-jobs): Use lower-object now that system-image returns a
file-like object.
* gnu/tests/install.scm (run-install): Ditto.
* guix/scripts/system.scm (system-derivation-for-action): Add a 'base-image'
argument,
(perform-action): adapt accordingly.
2020-05-29 09:12:11 +02:00
Mathieu Othacehe b7b45372e7
image: Add a post-MBR gap to the default image.
The generic 'efi-disk-image' needs to be bootable on systems without EFI. To
do that, GRUB is installed in the post-MBR gap. Make sure that the first
partition starts with an offset, to make this gap large enough for GRUB.

* gnu/system/image.scm (root-offset, root-label): New variables,
(esp-partition): use 'root-offset' as the partition offset,
(root-partition): use 'root-label' as the partition label.
2020-05-29 09:10:27 +02:00
Mathieu Othacehe 749381051d
system: image: Fix image-with-os.
* gnu/system/image.scm (image-with-os): Do not reorder partitions, as we want
them to be created according to definition order.
2020-05-29 08:43:36 +02:00
Mathieu Othacehe 05f37c16a3
image: Use grub-efi to install the EFI bootloader.
* gnu/build/image.scm (initialize-efi-partition): Rename bootloader-package
argument to grub-efi.
* gnu/system/image.scm (system-disk-image): Adapt accordingly to pass
grub-efi package.
2020-05-29 08:43:20 +02:00
Mathieu Othacehe 7d4ecda63c
system: image: Correct genimage configuration file indentation.
* gnu/system/image.scm (system-disk-image): Fix genimage configuration file
indentation.
2020-05-29 08:40:03 +02:00
Mathieu Othacehe 9c1adb2400
image: Add bootloader installation support.
* gnu/build/image.scm (initialize-root-partition): Add bootloader-package and
bootloader-installer arguments. Run the bootloader-installer if defined.
* gnu/system/image.scm (system-disk-image): Adapt the partition initializer
call accordingly.
2020-05-29 08:40:03 +02:00
Mathieu Othacehe 7feefb3b82
bootloader: Add 'disk-image-installer'.
* gnu/bootloader.scm (<bootloader>)[disk-image-installer]: New field,
(bootloader-disk-image-installer): export it.
* gnu/bootloader/grub.scm (install-grub-disk-image): New procedure ...
(grub-bootloader): ... used as "disk-image-installer" here.
(grub-efi-bootloader): set "disk-image-installer" to #f.
* gnu/system/image.scm (root-partition?, find-root-partition): Move to
"Helpers" section.
(root-partition-index): New procedure.
(system-disk-image): Honor disk-image-installer, and
use it to install the bootloader directly on the disk-image, if supported.
2020-05-29 08:37:13 +02:00
Mathieu Othacehe bd3716f6fe
image: Add partition file-system options support.
* gnu/image.scm (<partition>)[file-system-options]: New field,
(partition-file-system-options): new exported procedure.
* gnu/system/image.scm (partition->gexp): Adapt accordingly.
* gnu/build/image.scm (sexp->partition): Also adapt accordingly,
(make-ext-image): and pass file-system options to mke2fs.
2020-05-26 17:16:42 +02:00
Mathieu Othacehe 1dd7b87f10
image: Set offset default to zero.
* gnu/image.scm (<partition>)[offset]: Set to zero by default.
* gnu/system/image.scm (system-disk-image): Adapt accordingly.
2020-05-26 13:06:37 +02:00
Mathieu Othacehe 1dbd0005a1
system: image: Fix disk-image cross-compilation.
* gnu/system/image.scm (system-disk-image): Use the native version of the
helper packages (e2fsprogs, dosfstools, mtools, genimage, coreutils and
findutils).
2020-05-26 10:00:08 +02:00
Mathieu Othacehe 1b4fa7851b
image: Add partition offset support.
* gnu/image.scm (partition-offset): New procedure,
(<partition>)[offset]: new field.
* gnu/system/image.scm (system-disk-image): Apply the partition offset.
2020-05-26 09:57:06 +02:00
Mathieu Othacehe f19cf27c2b
image: Add a new API.
Raw disk-images and ISO9660 images are created in a Qemu virtual machine. This
is quite fragile, very slow, and almost unusable without KVM.

For all these reasons, add support for host image generation. This implies the
use new image generation mechanisms.

- Raw disk images: images of partitions are created using tools such as mke2fs
  and mkdosfs depending on the partition file-system type. The partition
  images are then assembled into a final image using genimage.

- ISO9660 images: the ISO root directory is populated within the store. GNU
  xorriso is then called on that directory, in the exact same way as this is
  done in (gnu build vm) module.

Those mechanisms are built upon the new (gnu image) module.

* gnu/image.scm: New file.
* gnu/system/image.scm: New file.
* gnu/build/image: New file.
* gnu/local.mk: Add them.
* gnu/system/vm.scm (system-disk-image): Rename to system-disk-image-in-vm.
* gnu/ci.scm (qemu-jobs): Adapt to new API.
* gnu/tests/install.scm (run-install): Ditto.
* guix/scripts/system.scm (system-derivation-for-action): Ditto.
2020-05-05 16:13:53 +02:00