Commit graph

22 commits

Author SHA1 Message Date
Mathieu Othacehe 7f75a7ec08
system: image: Remove "image-root" when building raw disk-images.
The "image-root" derivation output is used as a temporary directory that is
passed to mke2fs and mkdosfs later on. By merging the creation of this
directory and the production of partition images, we can get rid of the
derivation.

As mke2fs and mkdosfs are not able to override file permissions, call those
commands with fakeroot. This way, all the image files will be owned by root,
even if image generation is done in an unprivilegded context.

* gnu/system/image.scm (system-disk-image): Merge "image-root" and
"iso9660-image" derivations so that we spare an extra derivation. Also add
"fakeroot" and its runtime dependencies to the inputs.
* gnu/build/image.scm (make-ext-image, make-vfat-image): Make sure that mke2fs
and mkdosfs are respectively called by fakeroot.
2020-06-22 17:49:19 +02:00
Mathieu Othacehe 1cb9effc3e
system: image: Remove "image-root" derivation when building ISO.
The "image-root" derivation output is used as a temporary directory that is
passed to GNU Xorriso later on. By merging the creation of this directory and
the production of an ISO image, we can get rid of the derivation.

* gnu/system/image.scm (system-iso9660-image): Merge "image-root" and
"iso9660-image" derivations so that we spare an extra derivation.
2020-06-22 17:07:22 +02:00
Mathieu Othacehe c9f6e2e5bd
system: image: Make sure target is set.
* gnu/system/image.scm (system-image): Move "with-parameters" call so that it
encapsulates "operating-system-bootcfg".
2020-06-14 18:03:08 +02:00
Mathieu Othacehe 39b63d06e1
system: image: Remove left-over.
* gnu/system/image.scm: Remove a left-over since maybe-with-target procedure
was removed.
2020-06-14 17:57:30 +02:00
Mathieu Othacehe 4a04d49c2e
image: Remove 'maybe-with-target'.
* gnu/system/image.scm (maybe-with-target): Remove,
(system-image): adapt accordingly.
2020-06-13 16:58:57 +02:00
Mathieu Othacehe f292d4719d
image: Add 'target' support.
* gnu/image.scm (<image>)[target]: New field,
(image-target): new public method.
* gnu/system/image.scm (hurd-disk-image): Set "i586-pc-gnu" as image 'target'
field,
(maybe-with-target): new procedure,
(system-image): honor image 'target' field using the above procedure.
2020-06-13 15:20:52 +02:00
Jan (janneke) Nieuwenhuizen 7ca533c723
image: Make 'find-image' non-monadic.
* gnu/system/image.scm (find-image): Make non-monadic.  Add 'target'
parameter.
* gnu/tests/install.scm (run-install): Update caller,
passing (%current-target-system).
* guix/scripts/system.scm (perform-action): Likewise.
2020-06-13 15:03:55 +02:00
Mathieu Othacehe fd1e885236
system: image: Do not produce an HFS tree when building an ISO.
Use "mbr_only" mode to make sure that no HFS+ tree are generated.

* gnu/system/image.scm (system-image): Set MKRESCUE_SED_MODE to "mbr_only".
2020-06-12 17:21:18 +02:00
Jan (janneke) Nieuwenhuizen b37c544196
hurd-boot: Further cleanup of "rc".
* gnu/packages/hurd.scm (hurd-rc-script): Move implementation to ...
* gnu/build/hurd-boot.scm (boot-hurd-system): ...here, new file.
* gnu/build/linux-boot.scm (make-hurd-device-nodes): Move there likewise.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
2020-06-08 14:26:14 +02:00
Mathieu Othacehe c77b92859f
image: Add Hurd support.
* gnu/system/image.scm (hurd-disk-image): New exported variable,
(root-offset, root-label): new variables,
(esp-partition, root-partition): adapt accordingly,
(find-image): add Hurd support.
2020-06-08 13:51:18 +02:00
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