From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 8PQjFYDL5F6sHwAA0tVLHw (envelope-from ) for ; Sat, 13 Jun 2020 12:50:08 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 88EZEYDL5F57WwAAbx9fmQ (envelope-from ) for ; Sat, 13 Jun 2020 12:50:08 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 74AC69403E9 for ; Sat, 13 Jun 2020 12:50:07 +0000 (UTC) Received: from localhost ([::1]:37832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jk5bp-0007K0-7c for larch@yhetil.org; Sat, 13 Jun 2020 08:50:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jk5bm-0007Jq-8g for guix-patches@gnu.org; Sat, 13 Jun 2020 08:50:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57724) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jk5bl-00028m-VZ for guix-patches@gnu.org; Sat, 13 Jun 2020 08:50:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jk5bl-0008Tt-Tm for guix-patches@gnu.org; Sat, 13 Jun 2020 08:50:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41785] [PATCH v3 2/2] services: Add 'hurd-vm service-type'. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 13 Jun 2020 12:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41785 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "Jan \(janneke\) Nieuwenhuizen" Cc: 41785@debbugs.gnu.org, Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 41785-submit@debbugs.gnu.org id=B41785.159205257432562 (code B ref 41785); Sat, 13 Jun 2020 12:50:01 +0000 Received: (at 41785) by debbugs.gnu.org; 13 Jun 2020 12:49:34 +0000 Received: from localhost ([127.0.0.1]:41037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk5bJ-0008T8-Vz for submit@debbugs.gnu.org; Sat, 13 Jun 2020 08:49:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33124) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk5bH-0008Su-O0 for 41785@debbugs.gnu.org; Sat, 13 Jun 2020 08:49:32 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56353) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jk5bC-00026A-Dj; Sat, 13 Jun 2020 08:49:26 -0400 Received: from [2a01:e0a:fa:a50:b56f:8293:ef76:2983] (port=49194 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jk5bB-0000iU-Oe; Sat, 13 Jun 2020 08:49:26 -0400 From: Mathieu Othacehe References: <20200612214214.14112-1-janneke@gnu.org> <20200612214214.14112-2-janneke@gnu.org> Date: Sat, 13 Jun 2020 14:49:23 +0200 In-Reply-To: <20200612214214.14112-2-janneke@gnu.org> (Jan Nieuwenhuizen's message of "Fri, 12 Jun 2020 23:42:14 +0200") Message-ID: <87imfvjfl8.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: aDjnPnzmVWKq --=-=-= Content-Type: text/plain Hey! > +(define (hurd-vm-disk-image config) > + "Return a disk-image for the Hurd according to CONFIG." > + (let ((os (hurd-vm-configuration-os config)) > + (disk-size (hurd-vm-configuration-disk-size config)) > + (target (and (not (%current-target-system)) "i586-pc-gnu")) > + (base-image (find-image "ext2" (%current-target-system)))) > + (with-parameters ((%current-target-system target)) > + (system-image > + (image (inherit base-image) > + (size disk-size) > + (operating-system os)))))) With the attached patch, you could write: --8<---------------cut here---------------start------------->8--- (define (hurd-vm-disk-image config) "Return a disk-image for the Hurd according to CONFIG." (let ((os (hurd-vm-configuration-os config)) (disk-size (hurd-vm-configuration-disk-size config))) (system-image (image (inherit hurd-disk-image) (size disk-size) (operating-system os))))) --8<---------------cut here---------------end--------------->8--- WDYT? Mathieu --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-image-Add-target-support.patch >From dbcfd86a74903cb0fe77843518625436d749ed09 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sat, 13 Jun 2020 14:01:18 +0200 Subject: [PATCH] image: Add 'target' support. * gnu/image.scm ()[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. --- gnu/image.scm | 3 ++ gnu/system/image.scm | 66 +++++++++++++++++++++++++++----------------- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/gnu/image.scm b/gnu/image.scm index 0a92d168e9..19b466527b 100644 --- a/gnu/image.scm +++ b/gnu/image.scm @@ -33,6 +33,7 @@ image image-name image-format + image-target image-size image-operating-system image-partitions @@ -67,6 +68,8 @@ image make-image image? (format image-format) ;symbol + (target image-target + (default #f)) (size image-size ;size in bytes as integer (default 'guess)) (operating-system image-operating-system ; diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 6c4573509d..7b45fdfea7 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -103,6 +103,7 @@ (define hurd-disk-image (image (format 'disk-image) + (target "i586-pc-gnu") (partitions (list (partition (size 'guess) @@ -518,6 +519,14 @@ it can be used for bootloading." (type root-file-system-type)) file-systems-to-keep))))) +(define-syntax-rule (maybe-with-target image exp ...) + (let ((target (image-target image))) + (if target + (with-parameters ((%current-target-system target)) + exp ...) + (begin + exp ...)))) + (define* (system-image image) "Return the derivation of IMAGE. It can be a raw disk-image or an ISO9660 image, depending on IMAGE format." @@ -529,32 +538,33 @@ image, depending on IMAGE format." (bootcfg (operating-system-bootcfg os)) (bootloader (bootloader-configuration-bootloader (operating-system-bootloader os)))) - (case (image-format image) - ((disk-image) - (system-disk-image image* - #:bootcfg bootcfg - #:bootloader bootloader - #:register-closures? register-closures? - #:inputs `(("system" ,os) - ("bootcfg" ,bootcfg)))) - ((iso9660) - (system-iso9660-image - image* - #:bootcfg bootcfg - #:bootloader bootloader - #:register-closures? register-closures? - #:inputs `(("system" ,os) - ("bootcfg" ,bootcfg)) - ;; Make sure to use a mode that does no imply - ;; HFS+ tree creation that may fail with: - ;; - ;; "libisofs: FAILURE : Too much files to mangle, - ;; cannot guarantee unique file names" - ;; - ;; This happens if some limits are exceeded, see: - ;; https://lists.gnu.org/archive/html/grub-devel/2020-06/msg00048.html - #:grub-mkrescue-environment - '(("MKRESCUE_SED_MODE" . "mbr_only"))))))) + (maybe-with-target image + (case (image-format image) + ((disk-image) + (system-disk-image image* + #:bootcfg bootcfg + #:bootloader bootloader + #:register-closures? register-closures? + #:inputs `(("system" ,os) + ("bootcfg" ,bootcfg)))) + ((iso9660) + (system-iso9660-image + image* + #:bootcfg bootcfg + #:bootloader bootloader + #:register-closures? register-closures? + #:inputs `(("system" ,os) + ("bootcfg" ,bootcfg)) + ;; Make sure to use a mode that does no imply + ;; HFS+ tree creation that may fail with: + ;; + ;; "libisofs: FAILURE : Too much files to mangle, + ;; cannot guarantee unique file names" + ;; + ;; This happens if some limits are exceeded, see: + ;; https://lists.gnu.org/archive/html/grub-devel/2020-06/msg00048.html + #:grub-mkrescue-environment + '(("MKRESCUE_SED_MODE" . "mbr_only")))))))) (define (find-image file-system-type) "Find and return an image that could match the given FILE-SYSTEM-TYPE. This @@ -572,4 +582,8 @@ record." (else efi-disk-image)))))))) +;;; Local Variables: +;;; eval: (put 'maybe-with-target 'scheme-indent-function 1) +;;; End: + ;;; image.scm ends here -- 2.24.0 --=-=-=--