Commit Graph

39 Commits

Author SHA1 Message Date
Mathieu Othacehe acf54bca22
vm: Adapt qemu command to ARM.
* gnu/build/vm.scm (load-in-linux-vm): New argument #:target-arm32.
Use it to adapt command for qemu-system-arm.  This implies to choose a
machine ("virt"), use the correct console port "ttyAMA0", disable KVM use
that is buggy on some ARM boards (Odroid XU4 for example) and use user mode
network stack instead of NIC. Gather all those options in a new variable
"arch-specific-flags".
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Pass
to load-in-linux-vm "#:target-arm32?" argument.
2017-12-15 11:44:29 +01:00
Mathieu Othacehe 7b307a21dd
vm: Use qemu drive device parameter.
* gnu/build/vm.scm (load-in-linux-vm): Use device parameter to define drive
  device.
2017-12-13 11:30:04 +01:00
Ludovic Courtès 15c2ddc124
vm: ISO9660 images include /etc and other standard files.
* gnu/build/vm.scm (make-iso9660-image): Call
'populate-root-file-system' instead of a series of 'mkdir-p' calls.  Add
/etc to the arguments of xorriso.
2017-11-29 16:44:53 +01:00
Danny Milosavljevic b43b9acf15
build: Do not store two copies of the ISO-9660 superblock anymore.
* gnu/build/vm.scm (make-iso9660-image): Do not store two copies of the
ISO-9660 superblock anymore.
2017-09-22 04:03:52 +02:00
Ludovic Courtès 47cef4ecad
file-systems: Introduce (gnu system uuid).
* gnu/build/file-systems.scm (sub-bytevector)
(latin1->string, %fat32-endianness, fat32-uuid->string)
(%iso9660-uuid-rx, string->iso9660-uuid)
(iso9660-uuid->string, %network-byte-order)
(dce-uuid->string, %uuid-rx, string->dce-uuid)
(string->ext2-uuid, string->ext3-uuid, string->ext4-uuid)
(vhashq, %uuid-parsers, %uuid-printers, string->uuid)
(uuid->string): Move to...
* gnu/system/uuid.scm: ... here.  New file.
* gnu/system/file-systems.scm (uuid): Move to the above file.
* gnu/system/vm.scm: Adjust accordingly.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add uuid.scm.
2017-09-11 22:24:46 +02:00
Ludovic Courtès bae28ccb69
vm: Allow partitions to be initialized with a given UUID.
* gnu/build/vm.scm (<partition>)[uuid]: New field.
(create-ext-file-system): Add #:uuid and honor it.
(create-fat-file-system): Add #:uuid.
(format-partition): Add #:uuid and honor it.
(initialize-partition): Honor the 'uuid' field of PARTITION.
2017-09-11 22:24:46 +02:00
Christopher Baines 575065bd1c
vm: Add comment about deduplication in make-iso9660-image.
* gnu/build/vm.scm (make-iso9660-image): Add comment about the use of
  #:deduplicate #f when calling register-closure.
2017-09-10 11:59:55 +01:00
Christopher Baines 309b8fe7e6
vm: Create /mnt in the generated ISO image in make-iso9660-image.
This is used in the installation process, as the mountpoint for the target
filesystem.

* gnu/build/vm.scm (make-iso9660-image): Create /mnt within the generated ISO
  image.
2017-09-06 08:43:44 +01:00
Christopher Baines 22bbdb5f79
vm: Add support for registering closures to make-iso9660-image.
This mimics the functionality in the root-partition-initializer used in
creating the QEMU image. This helps when trying to run guix system init from
the generated ISO image.

* gnu/build/vm.scm (make-iso9660-image): Add support for registering closures.
2017-09-06 08:43:38 +01:00
Ludovic Courtès 8d033e3e16
vm: 'iso9660-image' produces a single-file output.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Add
  #:single-file-output? and pass it to 'load-in-linux-vm'.
(iso9660-image): Pass #:single-file-output? to
'expression->derivation-in-linux-vm'.
* gnu/build/vm.scm (load-in-linux-vm): Add #:single-file-output? and
honor it.
2017-07-18 21:41:35 +02:00
Tobias Geerinckx-Rice 21ffcd65c5
vm: Increase disk size overhead estimate.
* gnu/build/vm.scm (estimated-partition-size): Add 25% to the graph size.
2017-07-18 17:14:38 +02:00
Tobias Geerinckx-Rice 0862b95433
build, vm: Use a less common label.
* gnu/build/vm.scm (initialize-hard-disk): Use "GuixSD_image" as label.
* gnu/system/install.scm (installation-os): Likewise.
* gnu/system/vm.scm (system-disk-image): Likewise.
2017-07-17 20:20:24 +02:00
Danny Milosavljevic 911a53a53f
build: Make ISO-9660 image bootable from USB flash drive.
* gnu/build/vm.scm (make-iso9660-image): Make image bootable from USB flash
drive.
2017-07-12 16:15:30 +02:00
Danny Milosavljevic 651de2bdb5
build, vm: Use "GuixSD" or "GUIXSD" as volume label.
* gnu/build/vm.scm (initialize-hard-disk): Use "GuixSD" as label.
* gnu/system/install.scm (installation-os): Use "GuixSD" as label.
* gnu/system/vm.scm (system-disk-image): Use "GuixSD" or "GUIXSD" as volume
label.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2017-07-10 15:35:43 +02:00
Danny Milosavljevic 08c1f2d21c
build: Add (gnu build file-systems) import.
* gnu/build/vm.scm: Add (gnu build file-systems) import.
2017-07-03 16:33:46 +02:00
Danny Milosavljevic 4f80be730e
build: Clarify error message when make-iso9660-image fails.
* gnu/build/vm.scm (make-iso9660-image): Clarify error message.
2017-07-03 15:13:09 +02:00
Danny Milosavljevic 1feb3076cb
build: Allow specifying volume-uuid with make-iso9660-image.
* gnu/build/file-systems.scm (iso9660-uuid->string): Export.
* gnu/build/vm.scm (make-iso9660-image): Add volume-uuid.
2017-07-03 15:07:25 +02:00
Danny Milosavljevic be1033a334
build: Add iso9660 system image generator.
* build-aux/hydra/gnu-system.scm (qemu-jobs): Add 'iso9660-image .
* gnu/build/vm.scm (make-iso9660-image): New variable.  Export it.
* gnu/system/vm.scm (iso9660-image): New variable.  Use make-iso9660-image.
(system-disk-image): Use iso9660-image.
2017-07-03 10:07:59 +02:00
Ludovic Courtès a2278922fe
vm: Use 'fold2' from (guix combinators).
* gnu/build/vm.scm: Use (guix combinators).
(fold2): Remove.
2017-06-30 00:16:51 +02:00
Ludovic Courtès a8ac4f081a
vm: Estimate the disk size by default.
* gnu/build/vm.scm (estimated-partition-size): New procedure.
* gnu/system/vm.scm (expression->derivation-in-linux-vm):
Change #:disk-image-size default to 'guess.
[builder]: When DISK-IMAGE-SIZE is 'guess, use
'estimated-partition-size' and compute and estimate of the image size.
(qemu-image): Likewise.
* guix/build/store-copy.scm (file-size, closure-size): New procedures.
* guix/scripts/system.scm (%default-options): Change 'image-size' to
'guess.
* doc/guix.texi (Building the Installation Image): Remove '--image-size'
flag from example.
(Invoking guix system): Document the image size estimate.
2017-06-30 00:16:50 +02:00
Ludovic Courtès a2cf57e79e
vm: Display the disk and partition sizes.
* gnu/build/vm.scm (load-in-linux-vm): Add 'format' call when
MAKE-DISK-IMAGE? is true.
(initialize-partition-table): Show the size of the partitions being
created.
2017-06-30 00:16:50 +02:00
Ludovic Courtès 6efb98ed3c
vm: Fix 'load-in-linux-vm' docstring.
* gnu/build/vm.scm (load-in-linux-vm): Change default value of
  #:disk-image-size.  Update docstring to note that DISK-IMAGE-SIZE is
  in bytes.
2017-06-30 00:16:50 +02:00
Marius Bakke ecf5d53769
vm: Add UEFI loader to disk images.
* gnu/build/vm.scm (install-efi): New procedure.
(initialize-hard-disk): Generate EFI blob when ESP is present.
* gnu/system/vm.scm (qemu-image): Append 40MiB EFI System Partition.
2017-05-19 12:59:25 +02:00
Marius Bakke 4d415f0c3c
vm: Support creating FAT partitions.
* gnu/build/vm.scm (create-ext-file-system, create-fat-file-system): New procedures.
(format-partition): Use them. Error for unknown file systems.
* gnu/system/vm.scm (qemu-image): Include DOSFSTOOLS.
* gnu/system/linux-initrd.scm (base-initrd): Always add nls_is8859-1.ko.
2017-05-19 12:59:25 +02:00
Marius Bakke 01cc84dade
vm: Support arbitrary partition flags.
* gnu/build/vm.scm (<partition>): Change BOOTABLE? to FLAGS.
(initialize-partition-table): Pass each flag to parted.
(initialize-hard-disk): Locate boot partition.
* gnu/system/vm.scm (qemu-image): Adjust partition flags.
2017-05-19 12:59:25 +02:00
Mathieu Othacehe 9121ce553d
bootloader: Adapt vm to new bootloader API.
* gnu/build/install.scm (install-boot-config): New procedure.
  (install-grub): Move to (gnu bootloader grub).
* gnu/build/vm.scm (register-bootcfg-root): Rename register-grub.cfg-root and
  adjust accordingly.
  (initialize-hard-disk): Takes a bootloader-package, bootcfg, bootcfg-location and
  bootloader-installer procedure. Adjust accordingly.
* gnu/system/vm.scm (qemu-image): Adjust to initialize-hard-disk.
  (system-disk-image, system-qemu-image, system-qemu-image/shared-store):
  Adjust to qemu-image.
2017-05-16 14:41:01 +02:00
Mathieu Othacehe 07f812c404
vm: Reword grub.cfg to bootcfg.
* gnu/build/vm.scm (register-grub.cfg-root): Reword grub.cfg to bootcfg,
(initialize-hard-disk): ditto,
* gnu/system/vm.scm (system-disk-image): ditto,
(system-qemu-image): ditto,
(system-qemu-image/shared-store): ditto.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
2017-04-15 14:42:15 +02:00
Mathieu Othacehe abf0880a67
vm: Add missing module.
* gnu/build/vm.scm (define-module): Use module (guix build syscalls).

It fixes the following warnings during guix build :

gnu/build/vm.scm:233:3: warning: possibly unbound variable `mount'
gnu/build/vm.scm:238:3: warning: possibly unbound variable `umount'
gnu/build/vm.scm:268:8: warning: possibly unbound variable `mount'
gnu/build/vm.scm:276:8: warning: possibly unbound variable `umount'
gnu/build/vm.scm:315:4: warning: possibly unbound variable `mount'
gnu/build/vm.scm:323:4: warning: possibly unbound variable `umount'

This was not possible until the previous commit because we had to be sure
that Guile core implementation of 'mount' and 'umount' was used in
initrd context.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2017-04-07 23:30:39 +02:00
Ludovic Courtès d2bcf35e18
vm: Avoid needless file copy in 'load-in-linux-vm'.
Reported by Chris Webber.

* gnu/build/vm.scm (load-in-linux-vm)[image-file]: Remove.  Directly
refer to OUTPUT instead.
2016-11-28 22:58:18 +01:00
Ludovic Courtès b1dd6ac55d
vm: 'qemu-command' honors its argument.
* gnu/build/vm.scm (qemu-command): Refer to SYSTEM rather than
%HOST-TYPE in the body.
2016-06-20 23:50:46 +02:00
Christopher Allan Webber 944d2b17b5 vm: Only pass "-enable-kvm" to qemu if /dev/kvm is present.
Fixes <http://bugs.gnu.org/22633>.

* gnu/build/vm.scm (load-in-linux-vm): Only pass "-enable-kvm" flag to qemu
  if "/dev/kvm" is present.
* gnu/system/vm.scm (common-kvm-options): Same as above.
2016-02-22 13:28:58 -08:00
Ludovic Courtès 72b891e50e vm: Make the list of partitions to build a parameter.
* gnu/build/vm.scm (<partition>): New record type.
  (fold2): New procedure.
  (initialize-partition-table): Remove #:bootable? and
  'partition-size' parameters.  Add 'partitions' parameter.  Invoke 'parted'
  with '--script'.
  (initialize-root-partition): Remove.
  (initialize-partition, root-partition-initializer): New procedures.
  (initialize-hard-disk): Remove #:system-directory, #:disk-image-size,
  #:file-system-type, #:file-system-label, #:closures, #:copy-closures?,
  #:bootable?, and #:register-closures? parameters.  Add #:partitions.
  Rewrite to use 'initialize-partition' for each item of PARTITIONS.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Add (guix records)
  to #:modules default value.
  (qemu-image): Adjust accordingly.
2015-07-26 00:57:44 +02:00
Ludovic Courtès ec2406efc7 vm: Use the 'umount' procedure instead of util-linux's 'umount' command.
* gnu/build/vm.scm (initialize-root-partition, initialize-hard-disk): Use the
  'umount' procedure instead of invoking the 'umount' command.
* gnu/system/vm.scm (qemu-image): Remove UTIL-LINUX from INPUTS.
2015-07-24 01:19:57 +02:00
Ludovic Courtès 6412e58a68 system: Don't make /boot/grub/grub.cfg a symlink to the store.
This would not work when /boot is a separate partition, as reported by
Nikita Karetnikov <nikita@karetnikov.org> in <http://bugs.gnu.org/19220>.
This fixes a regression introduced in 39d1f82.

* gnu/build/install.scm (install-grub): Copy GRUB.CFG instead of
  symlinking it, as was the case before 39d1f82.
* gnu/build/vm.scm (register-grub.cfg-root): Add 'grub.cfg' parameter.
  Make it a permanent GC root instead of an indirect GC root.
  (initialize-hard-disk): Adjust accordingly.
* guix/scripts/system.scm (install-grub*): Replace use of
  'add-indirect-root' by the addition of a permanent GC root in
  %GC-ROOTS-DIRECTORY.
2014-12-09 11:06:50 +01:00
Ludovic Courtès 39d1f82b52 system: Make /boot/grub/grub.cfg an indirect GC root.
Fixes <http://bugs.gnu.org/19160>.

* guix/scripts/system.scm (install-grub*): Make /boot/grub/grub.cfg an
  indirect GC root.
* gnu/build/install.scm (install-grub): Make TARGET a symlink.
* gnu/build/vm.scm (register-grub.cfg-root): New procedure.
  (initialize-hard-disk): Use it.
2014-12-04 23:53:16 +01:00
Ludovic Courtès bff39668b9 vm: Set the boot flag on the root partition.
Reported by nebuli on #guix.

* gnu/build/vm.scm (initialize-partition-table): Add #:bootable?
  parameter and honor it.
  (initialize-hard-disk): Likewise.
2014-11-13 13:42:44 +01:00
Ludovic Courtès 6fd1a79674 vm: Move store copy handling to (guix build store-copy).
* gnu/build/vm.scm (read-reference-graph, populate-store): Move to...
* guix/build/store-copy.scm: ... here.  New file.
* Makefile.am (MODULES): Add it.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Adjust default
  #:modules values accordingly.
* tests/gexp.scm ("gexp->derivation, store copy"): New test.
2014-09-04 23:24:54 +02:00
Ludovic Courtès 8a9e21d1f7 Rename (gnu build linux-initrd) to (gnu build linux-boot).
* gnu/build/linux-initrd.scm: Rename to...
* gnu/build/linux-boot.scm: ... this.
* gnu-system.am (GNU_SYSTEM_MODULES): Adjust accordingly.
* gnu/build/activation.scm, gnu/build/vm.scm, gnu/services/base.scm,
  gnu/services/dmd.scm, gnu/system.scm, gnu/system/linux-initrd.scm,
  gnu/system/vm.scm: Adjust accordingly.
2014-09-03 15:43:07 +02:00
Ludovic Courtès 548f7a8fa2 Move operating system helpers from (guix build …) to (gnu build …).
* guix/build/activation.scm, guix/build/install.scm,
  guix/build/linux-initrd.scm, guix/build/vm.scm: Move to...
* gnu/build: ... here.
* Makefile.am (MODULES): Remove the above guix/build/ files.
* gnu-system.am (GNU_SYSTEM_MODULES): Add the above gnu/build/ files
  here.
* gnu/services/base.scm, gnu/services/dmd.scm, gnu/system.scm,
  gnu/system/linux-initrd.scm, gnu/system/vm.scm,
  guix/scripts/system.scm: Adjust to the new module names.
2014-09-03 15:43:07 +02:00