From patchwork Tue Jan 9 23:14:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Pierre De Jesus DIAZ X-Patchwork-Id: 58715 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B5BDC27BBE2; Tue, 9 Jan 2024 23:16:26 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 072DA27BBEB for ; Tue, 9 Jan 2024 23:16:25 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNLKA-0001u9-3y; Tue, 09 Jan 2024 18:15:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rNLK8-0001tO-M1 for guix-patches@gnu.org; Tue, 09 Jan 2024 18:15:56 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNLK8-0001eh-Di for guix-patches@gnu.org; Tue, 09 Jan 2024 18:15:56 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rNLKF-0000Kz-8m; Tue, 09 Jan 2024 18:16:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68355] [PATCH 4/8] gnu: make-crust-package: Memoize. Resent-From: Jean-Pierre De Jesus DIAZ Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, vagrant@debian.org, guix-patches@gnu.org Resent-Date: Tue, 09 Jan 2024 23:16:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68355 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68355@debbugs.gnu.org Cc: Jean-Pierre De Jesus DIAZ , Efraim Flashner , Vagrant Cascadian X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Efraim Flashner , Vagrant Cascadian Received: via spool by submit@debbugs.gnu.org id=B.170484215232601 (code B ref -1); Tue, 09 Jan 2024 23:16:03 +0000 Received: (at submit) by debbugs.gnu.org; 9 Jan 2024 23:15:52 +0000 Received: from localhost ([127.0.0.1]:41275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNLK2-0008SF-MW for submit@debbugs.gnu.org; Tue, 09 Jan 2024 18:15:51 -0500 Received: from lists.gnu.org ([2001:470:142::17]:51058) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNLK0-0008FU-8q for submit@debbugs.gnu.org; Tue, 09 Jan 2024 18:15:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rNLJm-0001qF-Db for guix-patches@gnu.org; Tue, 09 Jan 2024 18:15:34 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNLJi-0001Ox-I4 for guix-patches@gnu.org; Tue, 09 Jan 2024 18:15:34 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40e5508ecb9so4784925e9.3 for ; Tue, 09 Jan 2024 15:15:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundationdevices.com; s=google; t=1704842129; x=1705446929; darn=gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oWOWZy7g5CVBPcwIqtvr8bdGu5K1fvb0F3n7Exh3MUs=; b=ee88E5O/qWteO+qeH6Y/CvnWxuloA7RASu5iFGBMJm8cQiK3ZjJ1m0xHAUSWSouWta kS6DQdO8iIOUDf5JFpAWPBVhKzmBEjY4Zh4R/u8DUrfeQMtVkg2Tpp4ziihEn51Aoxq7 KP8XMWRy3F9QIY/d7h5Uqes7TTeAJsoUXqsNKJOWtnFiDBgfqk/G8RPdZOZ3ilqxrc+O eGcHvyPfT8eT8OxrK1mopvrhAxdGTtzq2Ixzjoog6mynxSkyHDq1YIqEA7NLUMG+7njq 4vTwdhAgf0Qm8cMdJtEwGiK1JDPhOr91PRah6nrKx7GOJBS164fenhpAyckdEJlVOdiZ klrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704842129; x=1705446929; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oWOWZy7g5CVBPcwIqtvr8bdGu5K1fvb0F3n7Exh3MUs=; b=I/v4ly2O3A/dTfBIWIKT9M+x8Lezv7dXDvrd39W8HJYZS1BYvs2Y6TBnekzXP6beyq XzcpZymBKruy8DDdVu/r79vDazHC9xbYH+G42LTDRAc2GIs6CZ8DhARNvgJSMVwaOuet grim5QWrzuUnM6mR1EfJ3b5arWumwtnTlLHLBqiz3WiTT7bnJQGCsCHcS+mMfZHYmTDy 82F+UZXEyisninBBLPqwpEGdMh2NuLQDjGs3/c0prR3IXXtJIjmOHYaNZRvWjkDBH/ys ypSN2qBF0eEha6Q07fdvsz5eQfy1xKJExlVU2Nthbr2FfhNq3uTpgCpbvT5e30IflZcN 7a9g== X-Gm-Message-State: AOJu0YxCbfdHrP9VMonjG1GHkPYuZcNnwSV+s3tK/DIWyGColL6walCf M/LDOs/U8Xv3GcocwM8OjJgWBAnm7OyXMmXmMjKDe3T8aipC/A== X-Google-Smtp-Source: AGHT+IEhoEGh3bknBopeCfqi1Vc99/e+K/p4lTkJD+bM0MnbcSlQ39cUTAoHf/p6G6HIcEguWbH/BQ== X-Received: by 2002:a05:600c:358b:b0:40e:50e7:db2c with SMTP id p11-20020a05600c358b00b0040e50e7db2cmr26626wmq.177.1704842128577; Tue, 09 Jan 2024 15:15:28 -0800 (PST) Received: from jeandudey.home ([89.131.29.87]) by smtp.gmail.com with ESMTPSA id p16-20020a05600c469000b0040e39cbf2a4sm56833wmo.42.2024.01.09.15.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 15:15:28 -0800 (PST) Date: Wed, 10 Jan 2024 00:14:38 +0100 Message-ID: <03b0bc119e7bf279aef49b05078faa08a2534945.1704841447.git.jean@foundationdevices.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=jean@foundationdevices.com; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jean-Pierre De Jesus DIAZ X-ACL-Warn: , Jean-Pierre De Jesus DIAZ via Guix-patches X-Patchwork-Original-From: Jean-Pierre De Jesus DIAZ via Guix-patches via From: Jean-Pierre De Jesus DIAZ Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/firmware.scm (make-crust-package): Use mlambda. Change-Id: I2d916b96bc650f3731a69505e086cf8f8f470809 --- gnu/packages/firmware.scm | 153 +++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 76 deletions(-) diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index e691bf33da..5567bcfe45 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -1190,81 +1190,82 @@ (define-public arm-trusted-firmware-imx8mq ;; Adding debug symbols causes the size to exceed limits. #~(delete "DEBUG=1" #$flags))))))) -(define (make-crust-package platform) - (package - (name (string-append "crust-" - (string-replace-substring platform "_" "-"))) - (version "0.5") - (source - (origin - (method git-fetch) - (uri (git-reference - ;; There are only GitHub generated release snapshots. - (url "https://github.com/crust-firmware/crust") - (commit (string-append "v" version)))) - (file-name (git-file-name "crust" version)) - (sha256 - (base32 - "0xgbbhifg3miwd3yp6jq9kp7nqgz5gzy00w95vba45j8jk5vjvvz")))) - (build-system gnu-build-system) - (arguments - (list - #:tests? #f ;no test suite - #:make-flags - (let ((triplet-without-vendor - (and (%current-target-system) - ;; TODO: Is there a use case for allowing this? - (not (target-avr?)) - (match (string-split (nix-system->gnu-triplet - (%current-target-system)) #\-) - ((arch vendor os ..1) - (string-join `(,arch ,@os) "-")))))) - #~(list "CROSS_COMPILE=or1k-elf-" - "V=1" - #$@(if triplet-without-vendor - ;; We are cross-compiling the tools, intended to be - ;; executable for the target system. - (list (string-append "HOSTAR=" triplet-without-vendor - "-ar") - (string-append "HOSTCC=" triplet-without-vendor - "-gcc")) - ;; Not cross-compiling. - (list "HOSTAR=ar" - "HOSTCC=gcc")) - "LEX=flex")) - #:phases - #~(modify-phases %standard-phases - (add-after 'unpack 'do-not-build-tests - (lambda _ - ;; Attempting to build the tools test binary on a non-aarch64 - ;; architecture fails with: "No cache cleaning implementation - ;; available for this architecture". Avoid building it (see: - ;; https://github.com/crust-firmware/crust/issues/182). - (substitute* "tools/Makefile" - (("tools-y \\+= test") "")))) - (delete 'configure) - (add-before 'build 'defconfig - (lambda* (#:key make-flags #:allow-other-keys) - (let ((config-name (string-append #$platform "_defconfig"))) - (apply invoke "make" (cons config-name make-flags))))) - (replace 'install - (lambda _ - (for-each (lambda (file) - (install-file file (string-append #$output - "/libexec"))) - (find-files "." "(scp\\.bin|\\.config)$")) - (install-file "build/tools/load" - (string-append #$output "/bin"))))))) - ;; The firmware is cross-compiled using a "bare bones" compiler (no libc). - ;; Use our own tool chain for that. - (native-inputs - (list bison - (cross-gcc "or1k-elf") - (cross-binutils "or1k-elf") - flex)) - (home-page "https://github.com/crust-firmware/crust") - (synopsis "System control processor firmware for Allwinner sunxi boards") - (description "Crust improves battery life and thermal performance by +(define make-crust-package + (mlambda (platform) + (package + (name (string-append "crust-" + (string-replace-substring platform "_" "-"))) + (version "0.5") + (source + (origin + (method git-fetch) + (uri (git-reference + ;; There are only GitHub generated release snapshots. + (url "https://github.com/crust-firmware/crust") + (commit (string-append "v" version)))) + (file-name (git-file-name "crust" version)) + (sha256 + (base32 + "0xgbbhifg3miwd3yp6jq9kp7nqgz5gzy00w95vba45j8jk5vjvvz")))) + (build-system gnu-build-system) + (arguments + (list + #:tests? #f ;no test suite + #:make-flags + (let ((triplet-without-vendor + (and (%current-target-system) + ;; TODO: Is there a use case for allowing this? + (not (target-avr?)) + (match (string-split (nix-system->gnu-triplet + (%current-target-system)) #\-) + ((arch vendor os ..1) + (string-join `(,arch ,@os) "-")))))) + #~(list "CROSS_COMPILE=or1k-elf-" + "V=1" + #$@(if triplet-without-vendor + ;; We are cross-compiling the tools, intended to be + ;; executable for the target system. + (list (string-append "HOSTAR=" triplet-without-vendor + "-ar") + (string-append "HOSTCC=" triplet-without-vendor + "-gcc")) + ;; Not cross-compiling. + (list "HOSTAR=ar" + "HOSTCC=gcc")) + "LEX=flex")) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'do-not-build-tests + (lambda _ + ;; Attempting to build the tools test binary on a non-aarch64 + ;; architecture fails with: "No cache cleaning implementation + ;; available for this architecture". Avoid building it (see: + ;; https://github.com/crust-firmware/crust/issues/182). + (substitute* "tools/Makefile" + (("tools-y \\+= test") "")))) + (delete 'configure) + (add-before 'build 'defconfig + (lambda* (#:key make-flags #:allow-other-keys) + (let ((config-name (string-append #$platform "_defconfig"))) + (apply invoke "make" (cons config-name make-flags))))) + (replace 'install + (lambda _ + (for-each (lambda (file) + (install-file file (string-append #$output + "/libexec"))) + (find-files "." "(scp\\.bin|\\.config)$")) + (install-file "build/tools/load" + (string-append #$output "/bin"))))))) + ;; The firmware is cross-compiled using a "bare bones" compiler (no libc). + ;; Use our own tool chain for that. + (native-inputs + (list bison + (cross-gcc "or1k-elf") + (cross-binutils "or1k-elf") + flex)) + (home-page "https://github.com/crust-firmware/crust") + (synopsis "System control processor firmware for Allwinner sunxi boards") + (description "Crust improves battery life and thermal performance by implementing a deep sleep state. During deep sleep, the CPU cores, the DRAM controller, and most onboard peripherals are powered down, reducing power consumption by 80% or more compared to an idle device. On boards without a @@ -1274,7 +1275,7 @@ (define (make-crust-package platform) Crust is designed to run on a specific SCP implementation, Allwinner's AR100.") ;; Most files are dual-licensed "BSD-3 OR GPL2", a few are GPL2 only. - (license (list license:bsd-3 license:gpl2)))) + (license (list license:bsd-3 license:gpl2))))) (define-public crust-pinebook (make-crust-package "pinebook"))