From patchwork Wed Jan 11 20:44:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 46058 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 87CF327BBEB; Wed, 11 Jan 2023 20:47:17 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,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 8645027BBE9 for ; Wed, 11 Jan 2023 20:47:15 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFi00-000381-Cc; Wed, 11 Jan 2023 15:47:04 -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 1pFhz1-00027v-Lv for guix-patches@gnu.org; Wed, 11 Jan 2023 15:46:10 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFhz1-00080m-DL for guix-patches@gnu.org; Wed, 11 Jan 2023 15:46:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pFhz1-0007M5-9L for guix-patches@gnu.org; Wed, 11 Jan 2023 15:46:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60224] [PATCH v4 11/12] gnu: make-arm-trusted-firmware: Simplify build. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 11 Jan 2023 20:46:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60224 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60224@debbugs.gnu.org Cc: rekado@elephly.net, Maxim Cournoyer , vagrant@reproducible-builds.org Received: via spool by 60224-submit@debbugs.gnu.org id=B60224.167346991528163 (code B ref 60224); Wed, 11 Jan 2023 20:46:03 +0000 Received: (at 60224) by debbugs.gnu.org; 11 Jan 2023 20:45:15 +0000 Received: from localhost ([127.0.0.1]:44029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFhyE-0007K5-EU for submit@debbugs.gnu.org; Wed, 11 Jan 2023 15:45:14 -0500 Received: from mail-qv1-f47.google.com ([209.85.219.47]:33787) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFhy8-0007Ha-B7 for 60224@debbugs.gnu.org; Wed, 11 Jan 2023 15:45:09 -0500 Received: by mail-qv1-f47.google.com with SMTP id j9so11444350qvt.0 for <60224@debbugs.gnu.org>; Wed, 11 Jan 2023 12:45:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=k5nBLOUhzviiIPpYmUhe206apJDhFnL5+uwoBfKcBPo=; b=m8fIxRj3I6RyyAiI8MX75sbuHnvPQXyNBIhghWVW0L8tNte9+M4lEsSin+o613iMPo ZYnjDJ/vYpV/3KiqoCDXzAROXAOE/IThJP5mOhnFrQTvZisTVN++NKcm2o8mVLlxlM3S RZkhQLMLFIvUEIlIBCRIRD6UeNv9G0z0zQ+tHGNPk5/GPo532yHy4bPnntNewMa5ZTcB ShEeBNcMLP+zy22cpUhxv4FARo0aiPpqVHxm2x4pVJE7YMskigf1UcFbFgQRh14rUn6/ jvaPcukOuHfuixfta3KmPrQGFZ5MXDhic+Qw+Q/4fOKTnRJICE58Uy9aDO+XvVfj/et2 cTPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=k5nBLOUhzviiIPpYmUhe206apJDhFnL5+uwoBfKcBPo=; b=WHhv5oQAKStjnqL66TZpE73ziSxFfXaJ/50iK8wWL4wGwtxLTx7xTVQjlHbLttWI7V V6CMeAmK00XFplPX1pe5rkhPAtWAjh8dn1zirlBh8retdyQLNkFxZDsDv/QLb4cAKwcU MRRlD8Hl9Z0OHUJQo96SlZpVtEzOULYujhDlV0Y9L8FJtP0f1y075mW/4HaRtSQPBZqi LoDTeYspuVG/DJggetccZ0wYJaCkagaOgyg4u4No30G1qIzyi0J2suBmHjk+O8Fp7SCd S/Cyer0UyaI0vanu/owRwmkacHSNmv/mREk0fbI5ScNnTxGKjt7bE1W4IHYd00hISUhi 71pw== X-Gm-Message-State: AFqh2kqgFkmvLfTYn7RCYQfO/RpPnfV6K2t8A1bkrYz7ZTfV4HKKNvHR HCLi/p74pyT1LXKNePrKDUGXFJREboJ1P9Mu X-Google-Smtp-Source: AMrXdXufYn4Lvq+DJLDMXDNFMeDSHqT/nf/BDzEQqD2RjmlZ1BniLwnnDeqGPJuIemuIl1fQW8HcxQ== X-Received: by 2002:a0c:e7c1:0:b0:531:9fb7:979 with SMTP id c1-20020a0ce7c1000000b005319fb70979mr5191269qvo.27.1673469902594; Wed, 11 Jan 2023 12:45:02 -0800 (PST) Received: from localhost.localdomain (dsl-159-79.b2b2c.ca. [66.158.159.79]) by smtp.gmail.com with ESMTPSA id y15-20020a05620a0e0f00b006f7ee901674sm9581862qkm.2.2023.01.11.12.45.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 12:45:02 -0800 (PST) From: Maxim Cournoyer Date: Wed, 11 Jan 2023 15:44:32 -0500 Message-Id: <20230111204433.15305-11-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230111204433.15305-1-maxim.cournoyer@gmail.com> References: <20230111204433.15305-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 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: , 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 Reuse knowledge from recent U-Boot modifications to streamline the package definition. * gnu/packages/firmware.scm (make-arm-trusted-firmware): Change optional argument ARCH to keyword TRIPLET. Default to aarch64-linux-gnu. [arguments]: Use gexps. Add a #:target argument. Streamline how the CROSS_COMPILE make flag is computed. [native-inputs]: Delete field. --- Changes in v4: - New commit gnu/packages/firmware.scm | 116 +++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 64 deletions(-) diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index f08d59752a..bd20ee81d9 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -8,7 +8,7 @@ ;;; Copyright © 2019 Mathieu Othacehe ;;; Copyright © 2020, 2021, 2022 Marius Bakke ;;; Copyright © 2021 Petr Hodina -;;; Copyright © 2022 Maxim Cournoyer +;;; Copyright © 2022, 2023 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -944,70 +944,58 @@ (define-public ovmf-arm (string-append fmw "/ovmf_arm.bin"))))))))) (supported-systems %supported-systems))) -(define* (make-arm-trusted-firmware platform #:optional (arch "aarch64")) - (package - (name (string-append "arm-trusted-firmware-" platform)) - (version "2.8") - (source - (origin - (method git-fetch) - (uri (git-reference +(define* (make-arm-trusted-firmware platform + #:key (triplet "aarch64-linux-gnu")) + (let ((native-build? (lambda () + ;; Note: %current-system is a *triplet*, unlike its + ;; name would suggest. + (or (not triplet) ;disable cross-compilation + (string=? (%current-system) + (gnu-triplet->nix-system triplet)))))) + (package + (name (string-append "arm-trusted-firmware-" platform)) + (version "2.8") + (source + (origin + (method git-fetch) + (uri (git-reference ;; There are only GitHub generated release snapshots. (url "https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/") (commit (string-append "v" version)))) - (file-name (git-file-name "arm-trusted-firmware" version)) - (sha256 - (base32 - "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3")) - (snippet - #~(begin - (use-modules (guix build utils)) - ;; Remove binary blobs which do not contain source or proper license. - (for-each (lambda (file) - (delete-file file)) - (find-files "." "\\.bin$")))))) - (build-system gnu-build-system) - (arguments - `(#:phases - (modify-phases %standard-phases - (delete 'configure) ; no configure script - (replace 'install - (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out")) - (bin (find-files "." "\\.(bin|elf)$"))) - (for-each - (lambda (file) - (install-file file out)) - bin))))) - #:make-flags (list (string-append "PLAT=" ,platform) - ,@(if (and (not (string-prefix? "aarch64" - (%current-system))) - (string-prefix? "aarch64" arch)) - `("CROSS_COMPILE=aarch64-linux-gnu-") - '()) - ,@(if (and (not (string-prefix? "armhf" - (%current-system))) - (string-prefix? "armhf" arch)) - `("CROSS_COMPILE=arm-linux-gnueabihf-") - '()) - "DEBUG=1") - #:tests? #f)) ; no tests - (native-inputs - (let ((system (%current-system))) - (cond - ((and (not (string-prefix? "aarch64" system)) - (string-prefix? "aarch64" arch)) - (list (cross-gcc "aarch64-linux-gnu") - (cross-binutils "aarch64-linux-gnu"))) - ((and (not (string-prefix? "armhf" system)) - (string-prefix? "armhf" arch)) - (list (cross-gcc "arm-linux-gnueabihf") - (cross-binutils "arm-linux-gnueabihf"))) - (else '())))) - (home-page "https://www.trustedfirmware.org/") - (synopsis "Implementation of \"secure world software\"") - (description - "ARM Trusted Firmware provides a reference implementation of secure world + (file-name (git-file-name "arm-trusted-firmware" version)) + (sha256 + (base32 + "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3")) + (snippet + #~(begin + (use-modules (guix build utils)) + ;; Remove binary blobs which do not contain source or proper + ;; license. + (for-each (lambda (file) + (delete-file file)) + (find-files "." "\\.bin$")))))) + (build-system gnu-build-system) + (arguments + (list + #:target (and (not (native-build?)) triplet) + #:phases + #~(modify-phases %standard-phases + (delete 'configure) ;no configure script + (replace 'install + (lambda _ + (for-each (lambda (file) + (install-file file #$output)) + (find-files "." "\\.(bin|elf)$"))))) + #:make-flags #~(list (string-append "PLAT=" #$platform) + #$@(if (not (native-build?)) + (list (string-append "CROSS_COMPILE=" triplet "-")) + '()) + "DEBUG=1") + #:tests? #f)) ;no test suite + (home-page "https://www.trustedfirmware.org/") + (synopsis "Implementation of \"secure world software\"") + (description + "ARM Trusted Firmware provides a reference implementation of secure world software for ARMv7A and ARMv8-A, including a Secure Monitor executing at @dfn{Exception Level 3} (EL3). It implements various ARM interface standards, such as: @@ -1018,8 +1006,8 @@ (define* (make-arm-trusted-firmware platform #:optional (arch "aarch64")) @item System Control and Management Interface @item Software Delegated Exception Interface (SDEI) @end enumerate\n") - (license (list license:bsd-3 - license:bsd-2)))) ; libfdt + (license (list license:bsd-3 + license:bsd-2))))) ; libfdt (define-public arm-trusted-firmware-sun50i-a64 (let ((base (make-arm-trusted-firmware "sun50i_a64")))