Commit graph

83 commits

Author SHA1 Message Date
Zheng Junjie
e5078ff321
image: Raise error when use both grub-efi* bootloader and not gpt image.
* gnu/system/image.scm: Switch Inversion logic, it allow we use customize
bootloader with gpt image.

Change-Id: I801327f6e826a37588b8f0f5246ca820e742f721
2024-05-22 11:15:29 +08:00
Ludovic Courtès
9edbb2d7a4
services: Add ‘virtual-build-machine’ service.
* gnu/services/virtualization.scm (<virtual-build-machine>): New record type.
(%build-vm-ssh-port, %build-vm-secrets-port, %x86-64-intel-cpu-models):
New variables.
(qemu-cpu-model-for-date, virtual-build-machine-ssh-port)
(virtual-build-machine-secrets-port): New procedures.
(%minimal-vm-syslog-config, %virtual-build-machine-operating-system):
New variables.
(virtual-build-machine-default-image):
(virtual-build-machine-account-name)
(virtual-build-machine-accounts)
(build-vm-shepherd-services)
(initialize-build-vm-substitutes)
(build-vm-activation)
(virtual-build-machine-offloading-ssh-key)
(virtual-build-machine-activation)
(virtual-build-machine-secret-root)
(check-vm-availability)
(build-vm-guix-extension): New procedures.
(initialize-hurd-vm-substitutes): Remove.
(hurd-vm-activation): Rewrite in terms of ‘build-vm-activation’.
* gnu/system/vm.scm (linux-image-startup-command): New procedure.
(operating-system-for-image): Export.
* gnu/tests/virtualization.scm (run-command-over-ssh): New procedure,
extracted from…
(run-childhurd-test): … here.
[test]: Adjust accordingly.
(%build-vm-os): New variable.
(run-build-vm-test): New procedure.
(%test-build-vm): New variable.
* doc/guix.texi (Virtualization Services)[Virtual Build Machines]: New
section.
(Build Environment Setup): Add cross-reference.

Change-Id: I0a47652a583062314020325aedb654f11cb2499c
2024-02-10 23:21:07 +01:00
Tomas Volf
21989dd57d
image: Consider grub-efi-removable-bootloader to be EFI bootloader.
Without this change, trying to create a system image with efi-raw type while
using grub-efi-removable-bootloader fails with fairly confusing message:

    EFI bootloader required with GPT partitioning

* gnu/system/image.scm (system-disk-image): Consider
grub-efi-removable-bootloader to be EFI bootloader.

Change-Id: I5f5e1a94e825fd29d6880c5bafb330e16a5ac962
2024-01-17 11:17:59 +01:00
Oleg Pykhalov
519e1e3eb8
scripts: system: Build layered images.
* guix/scripts/system.scm (show-help, %docker-format-options, %options,
%default-options, show-docker-format-options,
show-docker-format-options/detailed, process-action): Handle '--max-layers'
option.
* gnu/system/image.scm (system-docker-image): Same.
* gnu/image.scm (<image>)[max-layers]: New record field.

Change-Id: I2726655aefd6688b976057fd5a38e9972ebfc292
2024-01-08 21:22:44 +03:00
Janneke Nieuwenhuizen
b0715d7cd2
gnu: Use ‘libc-utf8-locales-for-target’.
* guix/packages.scm (%standard-patch-inputs): Use
‘libc-utf8-locales-for-target’ instead of ‘glibc-utf8-locales’.
* guix/self.scm (%packages): Likewise.
* gnu/home/services/ssh.scm (file-join): Likewise
* gnu/installer.scm (build-compiled-file): Likewise.
* gnu/packages/chromium.scm (ungoogled-chromium/wayland): Likewise.
* gnu/packages/gnome.scm (libgweather4, tracker): Likewise.
* gnu/packages/javascript.scm (js-mathjax): Likewise.
* gnu/packages/package-management.scm (guix, flatpak): Likewise.
* gnu/packages/raspberry-pi.scm (raspi-arm64-chainloader): Likewise.
* gnu/packages/suckless.scm (svkbd): Likewise.
* gnu/services.scm (cleanup-gexp): Likewise.
* gnu/services/base.scm (guix-publish-shepherd-service): Likewise.
* gnu/services/guix.scm (guix-build-coordinator-shepherd-services)
(guix-build-coordinator-agent-shepherd-services): Likewise.
* gnu/services/guix.scm (guix-build-coordinator-queue-builds-shepherd-services):
(guix-data-service-shepherd-services)
(nar-herder-shepherd-services)
(bffe-shepherd-services): Likewise.
* gnu/services/web.scm (anonip-shepherd-service)
(mumi-shepherd-services): Likewise.
* gnu/system/image.scm (system-disk-image, system-iso9660-image)
(system-docker-image, system-tarball-image): Likewise.
* gnu/system/install.scm (%installation-services): Likewise.
* guix/profiles.scm (info-dir-file): Likewise.
(ca-certificate-bundle, profile-derivation): Likewise.
* guix/scripts/pack.scm (store-database, set-utf8-locale): Likewise.
* tests/pack.scm: Likewise.
* tests/profiles.scm ("profile-derivation, cross-compilation"):
Likewise.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Co-authored-by: Christopher Baines <mail@cbaines.net>
Change-Id: I24239f427bcc930c29d2ba5d00dc615960a6c374
2023-12-02 12:25:45 +01:00
Mathieu Othacehe
dfaeaae9c7
image: Product hybrid qcow2 images.
This is a follow-up of e5ed1712da. Restore the
behaviour before d57cab7641 and produce
hybrid, BIOS and UEFI capable qcow2 images.

* gnu/system/image.scm (qcow2-image-type): Inherit from mbr-hybrid-disk-image.
2023-10-01 22:18:52 +02:00
Mathieu Othacehe
6bd17a0806
image: Do not allow BIOS bootloader and GPT.
When using grub-bootloader with a GPT image, GRUB will fail during
installation with a cryptic error message.

* gnu/system/image.scm (system-disk-image): Raise an error when trying to use
a non-EFI compatible bootloader with a GPT image partitioning.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2023-09-20 09:38:40 +02:00
Mathieu Othacehe
e5ed1712da
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>
2023-09-20 09:38:36 +02:00
Josselin Poiret
d57cab7641
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.
2023-08-25 14:24:21 +02:00
Sergey Trofimov
209204e23b
image: Prefer gpt partition table for efi images
* gnu/system/image.scm (efi-disk-image): Use gpt partition-table-type.
(efi32-disk-image): Use gpt partition-table-type.
(qcow2-image-type): Use mbr partition-table-type explicitly.
* gnu/tests/image.scm: Assert partition table type of efi-disk-image.

Signed-off-by: Josselin Poiret <dev@jpoiret.xyz>
2023-07-07 21:14:10 +02:00
Efraim Flashner
da81784d60
gnu: image: Build partitions with only necessary inputs.
* gnu/system/image.scm (system-disk-image)[partition-image]: Adjust the
inputs used by the image-builder to only use the packages necessary to
build that partition.
2023-06-19 16:31:32 +03:00
Efraim Flashner
cd55aa9801
gnu: image: Add support for unformatted partitions.
* gnu/build/image.scm (make-unformatted-image): New procedure.
(make-partition-image): Add support for unformatted partition.
* gnu/system/image.scm (system-disk-image)[partition->gpt-type]: Add
case for using unformatted partition uuid.
2023-06-14 14:52:21 +03:00
Maxim Cournoyer
60d4652c5d
image: Enhance compatibility of the root ext4 partition.
Generating a raw-with-offset image would previously not be bootable with
U-Boot.

* gnu/system/image.scm (root-partition) [file-system-options]: New field.
2022-12-26 22:47:02 -05:00
Ludovic Courtès
9ad14196ce
image: Clarify comment.
* gnu/system/image.scm: Adjust comment.
2022-12-06 15:11:44 +01:00
Thiago Jung Bauermann
a75deb8844
system: image: Define correct docker image arch when cross building
Cross-building a docker image with:

  $ guix system image --image-type=docker --target=aarch64-linux-gnu os.scm

results in an image where the architecture declared in its config.json is
the host architecture rather than the target one.  The binaries are
correctly cross-compiled, so the image can be loaded and used despite the
warning message shown by docker:

  $ docker load -i vcal7bvsqcijchifhqdvprpd1niqh8sk-docker-image.tar.gz
  Loaded image: guix:latest
  $ docker create guix:latest
  WARNING: The requested image's platform (linux/amd64) does not match the
  detected host platform (linux/arm64/v8) and no specific platform was
  requested
  40f06aa869ed690489c4a3824a7f7721bd4bf453b85f25ac7199266939fe2fba
  $ echo $?
  0

This is fixed by passing the correct triplet to the build-docker-image
function.

* gnu/system/image.scm (system-docker-image) Add ‘image-target’ variable.
[builder]: Pass ‘#:system’ argument to ‘build-docker-image’.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-11-04 08:46:11 +01:00
Mathieu Othacehe
2784fcf14d
system: images: Add a TODO comment.
* gnu/system/image.scm (system-tarball-image): Add it.
2022-09-25 09:27:35 +02:00
Alex Griffin
233cf9f036
system: image: Add wsl2 support.
* gnu/image.scm (<image>)[format]: Add wsl2 support.
* gnu/system/image.scm (wsl2-image, wsl2-image-type): New variables.
(image->root-file-system): Add wsl2 image support.
(system-image): Ditto.
2022-09-24 14:49:09 +02:00
Alex Griffin
8757c3f293
system: image: Add tarball support.
* gnu/image.scm (<image>)[fields]: Add tarball to the supported formats.
* gnu/system/image.scm (tarball-image, tarball-image-type): New variables.
(system-tarball-image): New procedure.
(image->root-file-system): Add tarball image support.
(system-image): Ditto.
* doc/guix.texi ("System Images"): Document it.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-09-24 14:49:09 +02:00
Mathieu Othacehe
c009c286a2
image: Make the operating-system field mandatory.
Make the operating-system field mandatory as creating an image without it
makes no sense. Introduce a new macro, image-without-os for the specific cases
where the image is only created to be inherited from afterwards.

* gnu/image.scm (<image>)[operating-system]: Make it mandatory.
* gnu/system/image.scm (image-without-os): New macro.
(efi-disk-image, efi32-disk-image, iso9660-image, docker-image,
raw-with-offset-disk-image): Use it.
* gnu/system/images/hurd.scm (hurd-disk-image): Ditto.
2022-09-24 14:20:36 +02:00
Mathieu Othacehe
08b8f85e08
system: image: Update my copyright.
* gnu/system/image.scm: Update it.
2022-09-07 14:24:52 +02:00
Mathieu Othacehe
310212e23e
system: image: Remove an unused variable.
* gnu/system/image.scm (sytem-image): Remove it.
2022-09-07 14:24:52 +02:00
Ludovic Courtès
05a759ab36
image: Raise an error when an image lacks a bootable partition.
* gnu/system/image.scm (find-root-partition): Raise an error when 'find'
returns #f.
2022-07-01 12:10:28 +02:00
Ludovic Courtès
ed19bc87e4
image: Avoid use of the deprecated 'gpt' option of genimage.
* gnu/system/image.scm (system-disk-image)[genimage-type-options]: Use
'partition-table-type' instead of the deprecated 'gpt' option.
2022-07-01 12:10:28 +02:00
Ludovic Courtès
9f530ef38a
image: Add default value for partition initializer.
Previously, the default value would lead to a wrong-type-to-apply crash.

* gnu/system/image.scm (system-disk-image)[image-builder]: When
'partition-initializer' returns #f, fall back to
INITIALIZE-ROOT-PARTITION.
* gnu/tests/base.scm (run-root-unmount-test)[test-image]: Remove
'initializer' field of partition.
* gnu/image.scm (<partition>)[initializer]: Add comment.
2022-07-01 12:10:28 +02:00
Ludovic Courtès
e871c3a857
image: 'system-image' throws when given an incorrect image format.
Previously 'system-image' would return *unspecified* in that case,
leading to a wrong-type-arg error crash down the road.

* gnu/system/image.scm (system-image): Add 'else' clause.
2022-07-01 12:10:28 +02:00
Denis 'GNUtoo' Carikli
62c86c8391
image: Add support for 32bit UEFI.
* gnu/bootloader/grub.scm (grub-efi32-bootloader): New variable.
(install-grub-efi32): New variable.
* gnu/build/bootloader.scm (install-efi): Add a 'targets' keyword
argument.
(install-efi-loader): Likewise.
* gnu/build/image.scm (initialize-efi32-partition): New procedure.
* gnu/packages/bootloaders.scm (grub-efi32): New variable.
* gnu/system/image.scm (esp32-partition): New variable
(efi32-disk-image): New variable.
(efi32-raw-image-type): New variable.
(system-disk-image)[partition-image]: Set '#:grub-efi32' when
calling the partition initializer.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-06-24 10:21:06 +02:00
Pavel Shlyak
8b680b00d4
image: Add fat32 support.
* gnu/build/image.scm (make-vfat-image): Pass fs-bits as an argument and force
1kb logical sector size only if "ESP" flag is set.
(make-partition-image): Add "fat32" partition type, support explicit "fat16"
type with vfat alias.
* gnu/system/image.scm (partition->dos-type partition): Return file system IDs
for "fat16" and "fat32" partitions.
(partition->gpt-type partition): Ditto.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-05-31 14:51:13 +02:00
Josselin Poiret
dab819d5c4
Move (gnu platform) and (gnu platforms ...) to guix/.
* gnu/platform.scm:
* gnu/platforms/arm.scm:
* gnu/platforms/hurd.scm:
* gnu/platforms/mips.scm:
* gnu/platforms/powerpc.scm:
* gnu/platforms/riscv.scm:
* gnu/platforms/s390.scm:
* gnu/platforms/x86.scm: Move to guix/.

* Makefile.am:
* doc/guix.texi (Porting to a New Platform):
* etc/release-manifest.scm:
* gnu/ci.scm:
* gnu/image.scm:
* gnu/local.mk:
* gnu/packages/bioinformatics.scm:
* gnu/packages/bootstrap.scm:
* gnu/packages/cross-base.scm:
* gnu/packages/instrumentation.scm:
* gnu/packages/linux.scm:
* gnu/system/image.scm:
* gnu/system/images/hurd.scm:
* gnu/system/images/novena.scm:
* gnu/system/images/pine64.scm:
* gnu/system/images/pinebook-pro.scm:
* gnu/system/images/rock64.scm:
* guix/scripts/build.scm:
* guix/scripts/system.scm:
* guix/self.scm: Update (gnu platform...) to (guix platform...).

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-05-25 09:27:25 +02:00
Pavel Shlyak
bb662d71e6
image: Add bootable flag support.
* gnu/build/image.scm (sexp->partition): Add flags support.
* gnu/system/image.scm (partition->gexp): Ditto.
(system-disk-image): Set the genimage bootable flag if it is part of the
partition flags.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-05-23 09:17:12 +02:00
Pavel Shlyak
6e99c020b8
system: image: Support GPT vfat partitions.
* gnu/system/image.scm (system-disk-image): Support them.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-05-23 09:17:12 +02:00
Pavel Shlyak
76139eb253
system: image: Support MBR vfat partitions.
* gnu/system/image.scm (system-disk-image): Support them.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-05-23 09:17:12 +02:00
Mathieu Othacehe
db3193f55b
system: image: Tweak error message.
* gnu/system/image.scm (system-disk-image): Tweak it.
2022-05-23 09:17:08 +02:00
Mathieu Othacehe
17e3b7d28f
system: image: Fix indentation.
* gnu/system/image.scm: Fix it.
2022-05-23 09:16:09 +02:00
Mathieu Othacehe
59912117d4
system: image: Add docker support.
* gnu/system/image.scm (docker-image, docker-image-type): New variables.
(system-docker-image): New procedure.
(image->root-file-system): Add docker image support.
(system-image): Ditto.
2021-12-23 10:54:00 +01:00
Ryan Sundberg
096a2bf8c5
image: Support generating GPT images via partition-table-type.
* gnu/image.scm (<image>)[partition-table-type]: New field.
* gnu/system/image.scm: Implement partition-table-type logic for
genimage.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-11-12 12:06:58 +00:00
Mathieu Othacehe
d5073fd113
gnu: Add platform support.
* gnu/platform.scm: New file.
* gnu/platforms/arm.scm: Ditto.
* gnu/platforms/hurd.scm: Ditto.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add them.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-10-11 12:05:39 +00:00
Mathieu Othacehe
2f497d94e7
image: Rename "raw" image-type to "efi-raw".
* gnu/system/image.scm (raw-image-type): Rename to "efi-raw-image-type".
* guix/scripts/system.scm (%default-options): Adapt accordingly.
* doc/guix.texi: Ditto.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-01-17 11:04:25 +01:00
Mathieu Othacehe
b6473e506e
system: image: Fix root offset on rockchip platforms.
Fixes: <https://issues.guix.gnu.org/45584>.

* gnu/system/image.scm (arm32-disk-image, arm64-disk-image): Turn into
procedures, taking the root partition offset as argument.
* gnu/system/images/novena.scm (novena-image-type): Adapt accordingly.
* gnu/system/images/pine64.scm (pine64-image-type): Ditto.
* gnu/system/images/pinebook-pro.scm (pinebook-pro-image-type): Use a 9MiB
offset for the root partition.
2021-01-10 16:07:44 +01:00
Mathieu Othacehe
83de7ee662
image: Fix ISO image production.
This is a follow-up of 41f27bf870.

* gnu/system/image.scm (operating-system-for-image): Force "volatile-root?" to
true when producing ISO images.
2020-12-04 14:06:49 +01:00
Maxim Cournoyer
1ec366cdfd
image: Remove conflicting user-provided EFI file system.
When the image type is "raw" or derived from it (such as "qcow2"), an ESP
partition and file system is already added by the image generator.  If a
conflicting user-provided EFI file system is provided, it causes the boot to
fail, as happens for the lightweight-desktop.tmpl and desktop.tmpl templates
under gnu/system/examples.

* gnu/system/image.scm (operating-system-for-image): Remove file systems whose
mount point is "/boot/efi".
2020-11-17 15:20:02 -05:00
Ludovic Courtès
f9926c071f
image: Offload "disk-image" derivations.
This is a followup to 99efa804bd.

* gnu/system/image.scm (system-disk-image): Pass #:local-build? #f to
'computed-file'.
2020-11-08 14:28:32 +01:00
Ludovic Courtès
99efa804bd
image: Allow offloading of "partition.img" and "image.iso" builds.
This builds are extremely I/O-intensive so they'd rather not run on the
head node of the build farm.

* gnu/system/image.scm (system-disk-image, system-iso9660-image): Pass
  #:local-build? #f.
2020-11-03 23:47:14 +01:00
Mathieu Othacehe
c045801117
system: image: Introduce arm32-raw image type.
* gnu/system/image.scm (arm32-disk-image, arm32-image-type): New variables.
(arm64-disk-image): Inherit from arm32-disk-image.
(arm64-image-type): Change name to 'arm64-raw.
2020-11-02 17:17:52 +01:00
Ludovic Courtès
281869e6f8
image: Use 'raise' from (srfi srfi-34).
* gnu/system/image.scm: Use (srfi srfi-34) for 'raise'.
(lookup-image-type-by-name): Remove extra newline in 'formatted-message'
string.
2020-10-14 15:22:55 +02:00
Mathieu Othacehe
599954c137
images: Add pine64 support.
* gnu/system/images/pine64.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* gnu/system/image.scm (arm64-disk-image, arm64-image-type): New variables.
2020-10-05 11:16:47 +02:00
Mathieu Othacehe
b97b423e3f
bootloader: Fix u-boot installation.
This is a follow-up of f19cf27c2b. The
bootloader installation must be done on the final disk-image, hence using
"disk-image-installer" instead of "installer" callback.

* gnu/bootloader/u-boot.scm: Turn all installer callbacks into
disk-image-installer callbacks.
* gnu/build/bootloader.scm (write-file-on-device): Open the output file with
'no-truncate and 'no-create options.
* gnu/system/image.scm (with-imported-modules*): Add (gnu build bootloader)
module.
2020-10-05 11:10:35 +02:00
Mathieu Othacehe
23ad7e92b1
system: image: Add qcow2 image type.
* gnu/system/image.scm (qcow2-image-type): New variable.
2020-10-02 14:54:26 +02:00
Mathieu Othacehe
10b135cef5
system: image: Add image-type support.
* gnu/system/image.scm (image-with-os): New macro. Rename the old
"image-with-os" procedure to ...
(image-with-os*): ... this new procedure,
(system-image): adapt according,
(raw-image-type, iso-image-type, uncompressed-iso-image-type
%image-types): new variables,
(lookup-image-type-by-name): new procedure.
(find-image): remove it.
* gnu/system/images/hurd.scm (hurd-image-type): New variable,
use it to define ...
(hurd-disk-image): ... this variable, using "os->image" procedure.
* gnu/tests/install.scm (run-install): Rename
installation-disk-image-file-system-type parameter to installation-image-type,
use os->config instead of find-image to compute the image passed to system-image,
(%test-iso-image-installer) adapt accordingly,
(guided-installation-test): ditto.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2020-09-30 10:47:59 +02:00
Mathieu Othacehe
f441e3e8b5
image: Add support for compressed-qcow2 format.
* gnu/build/image.scm (convert-disk-image): New procedure.
(genimage): Remove target argument.
* gnu/system/image.scm (system-disk-image): Add support for 'compressed-qcow2
image format. Call "convert-disk-image" to apply image conversions on the
final image. Add "qemu-minimal" to the build inputs.
(system-image): Also add support for 'compressed-qcow2.
2020-09-29 11:42:52 +02:00
Mathieu Othacehe
0996fcc657
system: image: Rename ISO9660 files.
* gnu/system/image.scm (system-iso9660-image): Change the default file output
name to "image.iso".
2020-09-19 14:24:59 +02:00