From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id iLHdOFMgv2OcGAEAbAwnHQ (envelope-from ) for ; Wed, 11 Jan 2023 21:47:16 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id YAgjOFMgv2MqbgEAG6o9tA (envelope-from ) for ; Wed, 11 Jan 2023 21:47:15 +0100 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 9907F22FE4 for ; Wed, 11 Jan 2023 21:47:15 +0100 (CET) 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1673470035; a=rsa-sha256; cv=none; b=Xh1iG1gdhDqW7pxW1quMVNGBwn+rReboRSepabiCWvVJ4PRjT+NE91rlqZ6+To+ZNTtPar s8KCJOujity75wUZWjwIoW/+sS9EEHOJuKhsQwSKYfD6r3sF7wt64pj5SCBj0JVNBhRc/F R1cEra+YnjpkZBL5AcNg+IBJUPNSQmhVQHOv1B7jwmAUjWAxFgC+HwBovkh5g5YffgZQNu OMc2cOMTsl7Zf0NcjS5H+N4yInHm11AkbuknLDJYn3BaIR0kBfUTXT6+xArio3g2eVDjbk 3qwYJDJJVTgZJlOlj6x6LX6NBWVU2+vAHJ4V9bhdNfq4m7/kj7x2CFz0mtZ6dQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=m8fIxRj3; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1673470035; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=k5nBLOUhzviiIPpYmUhe206apJDhFnL5+uwoBfKcBPo=; b=Qe/hufqyJ3PYXFl7suxLdhxhlPQUqlgYLdrwuHEAlRF+PB3BkUupsogthg59gAYQPj9S/L UVdMwakPkU6MxhMxU6VxkdLJmRegBWyBEmqVj74/whNg7Urs7FCd4yMvb+kGvOeww6hEcc mG/wTQyYFvvqk8iW8LgzqaNAvcwWgPibm+LTMkqKSmA0+gZfKvwrW3Rzmpn+AWaQjq8+E6 EbR2u2YNhwG1sOZ9e5ggh2Z7aIVwGzjgS5cKxwxX3F0tD765B7CEAY2ERs5RuK6RtBs/tI okPKq6D18GwrZKJ4+NPfv728YRuWM0C+5F6ovt6aU4FOcCo4FvJ8m1PqueUGig== X-Migadu-Spam-Score: -0.50 X-Spam-Score: -0.50 X-Migadu-Queue-Id: 9907F22FE4 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=m8fIxRj3; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) X-TUID: T1XyBwLlbd2j 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"))) -- 2.38.1