From debbugs-submit-bounces@debbugs.gnu.org Sun May 03 19:44:00 2020 Received: (at submit) by debbugs.gnu.org; 3 May 2020 23:44:00 +0000 Received: from localhost ([127.0.0.1]:58474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVOH9-0001ZO-Op for submit@debbugs.gnu.org; Sun, 03 May 2020 19:44:00 -0400 Received: from lists.gnu.org ([209.51.188.17]:41724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVMB6-0002Ng-63 for submit@debbugs.gnu.org; Sun, 03 May 2020 17:29:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVMB5-00039l-VT for guix-patches@gnu.org; Sun, 03 May 2020 17:29:35 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:49933) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVMB3-0002I7-Sa for guix-patches@gnu.org; Sun, 03 May 2020 17:29:35 -0400 Received: from vsmx002.vodafonemail.xion.oxcs.net (unknown [192.168.75.192]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTP id 4D06F604A07 for ; Sun, 3 May 2020 21:29:26 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [88.70.113.211]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 06E94604864 for ; Sun, 3 May 2020 21:29:23 +0000 (UTC) From: Stefan Kuhr Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: [PATCH] gnu: grub: Support for chain loading. Message-Id: <9BE5CCFC-5363-48E3-B25C-8676FFFAAE6C@arcor.de> Date: Sun, 3 May 2020 23:29:23 +0200 To: guix-patches@gnu.org Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-VADE-SCORE: 0 X-VADE-REASON: gggruggvucftvghtrhhoucdtuddrgeduhedrjedvgdduieduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuvegfuffvqffogfftpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhtgfguffkfffvggfosehtqhhmtdhhtddvnecuhfhrohhmpefuthgvfhgrnhcumfhuhhhruceoufhtvghfrghnpgfmuhhhrhesrghrtghorhdruggvqeenucggtffrrghtthgvrhhnpedvtedtuefhveduueelkeektdelfeevjeeuueekjedttdeuiefhteegfeeflefghfenucffohhmrghinhepghhnuhdrohhrghenucfkphepkeekrdejtddruddufedrvdduudenucfuphgrmhffohhmrghinhepmhihqdhrohhuthgvrhdruggvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehmrggtsghoohhkqdhprhhordhkuhhhqdifihgvshgvrdhmhidqrhhouhhtvghrrdguvgdpihhnvghtpeekkedrjedtrdduudefrddvuddupdhmrghilhhfrhhomhepufhtvghfrghnpgfmuhhhrhesrghrtghorhdruggvpdhrtghpthhtohepghhuihigqdhprghttghhvghssehgnhhurdhorhhg Received-SPF: pass client-ip=153.92.174.39; envelope-from=Stefan_Kuhr@arcor.de; helo=mx009.vodafonemail.xion.oxcs.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/03 17:29:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 03 May 2020 19:43:58 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * gnu/bootloaders/grub.scm (grub-efi-net-bootloader-chain): New efi = bootloader for chaining with other bootloaders. * guix/packages.scm (package-collection): New function to build a union = of packages with a collection of certain files. This allows to chain grub-efi mainly for single-board-computers with = e.g. U-Boot, device-tree files, plain configuration files, etc. like this: (operating-system (bootloader (grub-efi-net-bootloader-chain (list u-boot firmware) '("libexec/u-boot.bin" "firmware/") (list (plain-file "config.txt" "kernel=3Du-boot.bin")) #:target "/boot-tftp" #:efi-subdir "efi/boot") (target "/boot-tftp")) ...) --- gnu/bootloader/grub.scm | 36 +++++++++++++ guix/packages.scm | 114 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 9ca4f016f6..67736724a7 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -22,6 +22,7 @@ ;;; along with GNU Guix. If not, see . =20 (define-module (gnu bootloader grub) + #:use-module (guix packages) #:use-module (guix records) #:use-module ((guix utils) #:select (%current-system = %current-target-system)) #:use-module (guix gexp) @@ -54,6 +55,7 @@ grub-bootloader grub-efi-bootloader grub-efi-net-bootloader + grub-efi-net-bootloader-chain grub-mkrescue-bootloader =20 grub-configuration)) @@ -525,6 +527,40 @@ TARGET for the system whose root is mounted at = MOUNT-POINT." (installer (install-grub-efi-net efi-subdir)) (configuration-file (string-append target "/" efi-subdir = "/grub.cfg"))))) =20 +(define* (grub-efi-net-bootloader-chain bootloader-packages + bootloader-package-contents + #:optional (files '()) + #:key + (target #f) + (efi-subdir #f)) + "Defines a (grub-efi-net-bootloader) with ADDITIONAL-BOOTLOADER-FILES = from +ADDITIONAL-BOOTLOADER-PACKAGES and ADDITIONAL-FILES, all collected as a +(package-collection), whose files inside the \"collection\" folder get +copied into TARGET along with the the bootloader installation in = EFI-SUBDIR." + (let* ((base-bootloader (grub-efi-net-bootloader #:target target + #:efi-subdir = efi-subdir)) + (base-installer (bootloader-installer base-bootloader)) + (packages (package-collection + (cons (bootloader-package base-bootloader) + bootloader-packages) + bootloader-package-contents + files))) + (bootloader + (inherit base-bootloader) + (package packages) + (installer + #~(lambda (bootloader target mount-point) + (#$base-installer bootloader target mount-point) + (copy-recursively + (string-append bootloader "/collection") + (string-join (delete "" + (string-split + (string-append mount-point "/" target) + #\/)) + "/" + 'prefix) + #:follow-symlinks? #t)))))) + (define* grub-mkrescue-bootloader (bootloader (inherit grub-efi-bootloader) diff --git a/guix/packages.scm b/guix/packages.scm index 2fa4fd05d7..987c3b80ac 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -32,6 +32,7 @@ #:use-module (guix derivations) #:use-module (guix memoization) #:use-module (guix build-system) + #:use-module (guix build-system trivial) #:use-module (guix search-paths) #:use-module (guix sets) #:use-module (ice-9 match) @@ -114,6 +115,7 @@ package-with-patches package-with-extra-patches package/inherit + package-collection =20 transitive-input-references =20 @@ -944,6 +946,118 @@ OVERRIDES." overrides ... (replacement (and=3D> (package-replacement p) loop))))) =20 +(define* (package-collection packages package-contents #:optional = (files '())) + "Defines a package union from PACKAGES and additional FILES. Its = output +\":out\" has a \"collection\" directory with links to selected = PACKAGE-CONTENTS +and FILES. The output \":collection\" of the package links to that = directory." + (let ((package-names (map (lambda (package) + (package-name package)) + packages)) + (link-machine '(lambda (file directory targetname) + (symlink file + (string-append directory + "/" + (targetname file)))))) + (package + (name (string-join (append '("package-collection") package-names) = "-")) + ;; We copy the version of the first package. + (version (package-version (first packages))) + ;; FILES are expected to be a list of gexps like 'plain-file'. As = gexps + ;; can't (yet) be used in the arguments of a package we convert = FILES into + ;; the source of this package. + (source (computed-file + "computed-files" + (with-imported-modules + '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (define (targetname file) + ;; A plain-file inside the store has a name like + ;; = gnu/store/9x6y7j75qy9z6iv21byrbyj4yy8hb490-config.txt. + ;; We take its basename and drop the hash from it. + ;; Therefore it expects the first '-' at index 32. + ;; Otherwise the basename of file is returned + (let ((name (basename file))) + (if (and (> (string-length name) 33) + (=3D (string-index name #\- 0 33) 32)) + (substring name 33) + (name)))) + (mkdir-p #$output) + (for-each (lambda (file) + (#$link-machine file #$output = targetname)) + '#$files))))) + (build-system trivial-build-system) + (arguments + `(#:modules + ((guix build union) + (guix build utils)) + #:builder + (begin + (use-modules (guix build union) + (guix build utils) + (ice-9 ftw) + (ice-9 match) + (srfi srfi-1)) + ;; Make a union of all packages as :out. + (match %build-inputs + (((names . directories) ...) + (union-build %output directories))) + (let* ((directory-content + ;; Creates a list of absolute path names inside DIR. + (lambda (dir) + (map (lambda (name) + (string-append dir name)) + (scandir dir (lambda (name) + (not (member name '("." = "..")))))))) + (select-names + ;; Select names ending with (filter) or without "/" = (remove) + (lambda (select names) + (select (lambda (name) + (string=3D? (string-take-right name 1) = "/")) + names))) + (content + ;; The selected package content as a list of absolute = paths. + (map (lambda (name) + (string-append %output "/" name)) + ',package-contents)) + (directory-names + (append (select-names filter content) + (list (string-append + (assoc-ref %build-inputs "source") + "/")))) + (names-from-directories + (fold (lambda (directory previous) + (append (directory-content directory) = previous)) + '() + directory-names)) + (names-from-content (select-names remove content)) + (names (append names-from-directories = names-from-content)) + (collection-directory (string-append %output = "/collection")) + (collection (assoc-ref %outputs "collection"))) + ;; Collect links to package-contents and file. + (mkdir-p collection-directory) + (for-each (lambda (name) + (,link-machine name collection-directory = basename)) + names) + (symlink collection-directory collection))))) + (inputs (fold-right + (lambda (package previous) + (cons (list (package-name package) package) previous)) + '() + packages)) + (outputs '("out" "collection")) + (synopsis "Package union with a collection of package contents and = files") + (description + (string-append "A package collection is useful when bootloaders = need to " + "be chained and the bootloader-installer needs to = install " + "selected parts of them. This collection = includes: " + (string-join package-names ", ") ".")) + (license + (append (map (lambda (package) + (package-license package)) + packages))) + (home-page "")))) + ^L ;;; ;;; Package derivations. --=20 2.26.0 From debbugs-submit-bounces@debbugs.gnu.org Sun May 03 19:47:23 2020 Received: (at 41068) by debbugs.gnu.org; 3 May 2020 23:47:24 +0000 Received: from localhost ([127.0.0.1]:58482 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVOKR-0001fx-OR for submit@debbugs.gnu.org; Sun, 03 May 2020 19:47:23 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:16313) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVOKQ-0001ff-70 for 41068@debbugs.gnu.org; Sun, 03 May 2020 19:47:22 -0400 Received: from vsmx002.vodafonemail.xion.oxcs.net (unknown [192.168.75.192]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTP id 026C760457C for <41068@debbugs.gnu.org>; Sun, 3 May 2020 23:47:16 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [88.70.113.211]) by mta-6-out.mta.xion.oxcs.net (Postfix) with ESMTPA id D8872604576 for <41068@debbugs.gnu.org>; Sun, 3 May 2020 23:47:13 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: bug#41068: Acknowledgement ([PATCH] gnu: grub: Support for chain loading.) From: Stefan In-Reply-To: Date: Mon, 4 May 2020 01:47:13 +0200 Content-Transfer-Encoding: 7bit Message-Id: <87C2F025-BB37-46D7-9F2C-DC22059FEE14@vodafonemail.de> References: <9BE5CCFC-5363-48E3-B25C-8676FFFAAE6C@arcor.de> To: 41068@debbugs.gnu.org X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-VADE-SCORE: 0 X-VADE-REASON: gggruggvucftvghtrhhoucdtuddrgeduhedrjeefgddvgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucevfgfuvffqoffgtfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddtnecunecujfgurheptggguffhjgffgffkfhfvofesthejmhdthhdtvdenucfhrhhomhepufhtvghfrghnuceoshhtvghfrghnqdhguhhigiesvhhouggrfhhonhgvmhgrihhlrdguvgeqnecuggftrfgrthhtvghrnhepfeffledvuddtteeivedutddtkeduleeivefgveeihfeifedtuddvheelieefgedtnecukfhppeekkedrjedtrdduudefrddvuddunecuufhprghmffhomhgrihhnpehmhidqrhhouhhtvghrrdguvgenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhgrtggsohhokhdqphhrohdrkhhuhhdqfihivghsvgdrmhihqdhrohhuthgvrhdruggvpdhinhgvthepkeekrdejtddruddufedrvdduuddpmhgrihhlfhhrohhmpehsthgvfhgrnhdqghhuihigsehvohgurghfohhnvghmrghilhdruggvpdhrtghpthhtohepgedutdeikeesuggvsggsuhhgshdrghhnuhdrohhrgh X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41068 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Please delete the previous message/this ticket. From debbugs-submit-bounces@debbugs.gnu.org Sun May 03 19:57:58 2020 Received: (at control) by debbugs.gnu.org; 3 May 2020 23:57:58 +0000 Received: from localhost ([127.0.0.1]:58491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVOUf-0001vH-Sy for submit@debbugs.gnu.org; Sun, 03 May 2020 19:57:58 -0400 Received: from tobias.gr ([80.241.217.52]:35406) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVOUb-0001v7-P4 for control@debbugs.gnu.org; Sun, 03 May 2020 19:57:56 -0400 Received: by tobias.gr (OpenSMTPD) with ESMTP id da547144 for ; Sun, 3 May 2020 23:57:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=tobias.gr; h=from:to :date:message-id:mime-version:content-type; s=2018; i= me@tobias.gr; bh=MgsJ6JskDL6+LObcYxHUEJdKea4CzNyiHu24/8CJ2n4=; b= TetM8TKmM0qja7A0Geubw/gaI/ACMvwN/X66Hf9yDsXiqQwKvFtl+HDDq/unO7FM CPa5pM2EIhTirRTE1k16LLb8Aysv42SQ7amjGBcz4X/ZBRUvgTvSeBweXFHHhKWA 9oSfquo5Kzu12yAxTGBp6cn6zyJTiW97P7plFwVnV1fYfJcWiXublGlVzhq2pVZM aEiBLlu6ZTCSUMPG3REGhUgs6g+U6IWXF/t0OW3h6rdBMhwoxIiF+WFDekXzN9ap DCJXRzeHe55RwEC4ho5HEmMJdvu10QZcRZZ7gqAOBxLtxGdGjj/BsCiILTnIDNiN hmHs5uQtzJwsTjDfyu8Kxg== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id f23c1144 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Sun, 3 May 2020 23:57:51 +0000 (UTC) From: Tobias Geerinckx-Rice To: GNU bug tracker automated control server Date: Mon, 04 May 2020 01:58:04 +0200 Message-ID: <874kswr2pf.fsf@nckx> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Spam-Score: -0.3 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) merge 41066 41068 From unknown Tue Jun 17 22:16:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: Did not alter fixed versions and reopened. Date: Tue, 17 Nov 2020 15:37:02 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # Did not alter fixed versions and reopened. thanks # This fakemail brought to you by your local debbugs # administrator From unknown Tue Jun 17 22:16:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 25 Apr 2021 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator