From 82782d8cecec974c03ec95824f62455f0a795815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 1 Apr 2020 15:03:10 +0200 Subject: vm: 'qemu-image' accepts a list of extra populate directives. * gnu/build/vm.scm (root-partition-initializer): Add #:extra-directives parameter and pass it to 'populate-root-file-system'. * gnu/system/vm.scm (qemu-image): Add #:extra-directives parameter and pass it to 'root-partition-initializer'. --- gnu/system/vm.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gnu/system/vm.scm') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 04d84b5220..8baed372cb 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -368,6 +368,7 @@ INPUTS is a list of inputs (as for packages)." (disk-image-size 'guess) (disk-image-format "qcow2") (file-system-type "ext4") + (extra-directives '()) file-system-label file-system-uuid os @@ -392,7 +393,10 @@ all of INPUTS into the image being built. When REGISTER-CLOSURES? is true, register INPUTS in the store database of the image so that Guix can be used in the image. By default, REGISTER-CLOSURES? is set to true only if a service of type GUIX-SERVICE-TYPE is present in the services definition of the operating -system." +system. + +EXTRA-DIRECTIVES is an optional list of directives to populate the root file +system that is passed to 'populate-root-file-system'." (define schema (and register-closures? (local-file (search-path %load-path @@ -441,6 +445,7 @@ system." (((names . _) ...) names))) (initialize (root-partition-initializer + #:extra-directives '#$extra-directives #:closures graphs #:copy-closures? #$copy-inputs? #:register-closures? #$register-closures? -- cgit v1.2.3 From 4d1ff68d731fdc47ca1220863fee07a685a26616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 1 Apr 2020 15:08:11 +0200 Subject: vm: 'qemu-image' can pass options to the 'mkfs' command. * gnu/build/vm.scm ()[file-system-options]: New field. (create-ext-file-system, create-fat-file-system) (format-partition): Add #:options and honor it. (initialize-partition): Pass #:options to 'format-partition'. * gnu/system/vm.scm (qemu-image): Add #:file-system-options and use it for the root partition. --- gnu/system/vm.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gnu/system/vm.scm') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 8baed372cb..65e96d42ee 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -368,6 +368,7 @@ INPUTS is a list of inputs (as for packages)." (disk-image-size 'guess) (disk-image-format "qcow2") (file-system-type "ext4") + (file-system-options '()) (extra-directives '()) file-system-label file-system-uuid @@ -382,7 +383,8 @@ INPUTS is a list of inputs (as for packages)." 'qcow2' or 'raw'), with a root partition of type FILE-SYSTEM-TYPE. Optionally, FILE-SYSTEM-LABEL can be specified as the volume name for the root partition; likewise FILE-SYSTEM-UUID, if true, specifies the UUID of the root -partition (a UUID object). +partition (a UUID object). FILE-SYSTEM-OPTIONS is an optional list of +command-line options passed to 'mkfs.ext4' (or similar). The returned image is a full disk image that runs OS-DERIVATION, with a GRUB installation that uses GRUB-CONFIGURATION as its configuration @@ -472,6 +474,7 @@ system that is passed to 'populate-root-file-system'." (uuid #$(and=> file-system-uuid uuid-bytevector)) (file-system #$file-system-type) + (file-system-options '#$file-system-options) (flags '(boot)) (initializer initialize))) ;; Append a small EFI System Partition for use with UEFI -- cgit v1.2.3 From cd45d656f1e8746fadacfbffd5740d22228c4c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 7 Apr 2020 10:21:48 +0200 Subject: vm: Make the device node procedure a parameter. * gnu/build/vm.scm (root-partition-initializer): Add #:make-device-nodes parameter and use it. * gnu/system/vm.scm (qemu-image): Add #:device-node parameter. Pass #:make-device-nodes to 'root-partition-initializer'. --- gnu/system/vm.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gnu/system/vm.scm') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 65e96d42ee..e8c2f6e162 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -369,6 +369,7 @@ INPUTS is a list of inputs (as for packages)." (disk-image-format "qcow2") (file-system-type "ext4") (file-system-options '()) + (device-nodes 'linux) (extra-directives '()) file-system-label file-system-uuid @@ -397,6 +398,9 @@ the image. By default, REGISTER-CLOSURES? is set to true only if a service of type GUIX-SERVICE-TYPE is present in the services definition of the operating system. +When DEVICE-NODES is 'linux, create Linux-device block and character devices +under /dev. When it is 'hurd, do Hurdish things. + EXTRA-DIRECTIVES is an optional list of directives to populate the root file system that is passed to 'populate-root-file-system'." (define schema @@ -416,6 +420,9 @@ system that is passed to 'populate-root-file-system'." #~(begin (use-modules (gnu build bootloader) (gnu build vm) + ((gnu build linux-boot) + #:select (make-essential-device-nodes + make-hurd-device-nodes)) (guix store database) (guix build utils) (srfi srfi-26) @@ -453,6 +460,11 @@ system that is passed to 'populate-root-file-system'." #:register-closures? #$register-closures? #:system-directory #$os + #:make-device-nodes + #$(match device-nodes + ('linux #~make-essential-device-nodes) + ('hurd #~make-hurd-device-nodes)) + ;; Disable deduplication to speed things up, ;; and because it doesn't help much for a ;; single system generation. -- cgit v1.2.3