From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 UNoLAVXExGOnOgEAbAwnHQ (envelope-from ) for ; Mon, 16 Jan 2023 04:28:21 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id AL4EAVXExGM1MwAA9RJhRA (envelope-from ) for ; Mon, 16 Jan 2023 04:28:21 +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 B5B8C1ABF2 for ; Mon, 16 Jan 2023 04:28:20 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHG9M-0000Hf-6j; Sun, 15 Jan 2023 22:27:08 -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 1pHG9L-0000Gt-4m for guix-patches@gnu.org; Sun, 15 Jan 2023 22:27:07 -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 1pHG9K-0005pw-Tt for guix-patches@gnu.org; Sun, 15 Jan 2023 22:27:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHG9K-0007tz-Q7 for guix-patches@gnu.org; Sun, 15 Jan 2023 22:27:06 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60224] [PATCH v5 12/13] gnu: make-arm-trusted-firmware: Simplify build. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 16 Jan 2023 03:27:06 +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.167383958330223 (code B ref 60224); Mon, 16 Jan 2023 03:27:06 +0000 Received: (at 60224) by debbugs.gnu.org; 16 Jan 2023 03:26:23 +0000 Received: from localhost ([127.0.0.1]:60076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHG8d-0007rI-2n for submit@debbugs.gnu.org; Sun, 15 Jan 2023 22:26:23 -0500 Received: from mail-qv1-f42.google.com ([209.85.219.42]:46818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHG8T-0007pc-34 for 60224@debbugs.gnu.org; Sun, 15 Jan 2023 22:26:13 -0500 Received: by mail-qv1-f42.google.com with SMTP id p96so6779751qvp.13 for <60224@debbugs.gnu.org>; Sun, 15 Jan 2023 19:26:13 -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=KnVnQzOCLcdDgRhzVY9QmrfHk/ZdBqjvbOlC3jMiHEE=; b=VskrAZVAZMnDYe0H7HU5t9SDDEni0BR5jRFmpDrdnAPijMYq1BlVvoxa2X2/HCcRZh hVNYh5+CY5B0f8SdK+YlSjsN2f5l6anLZN5bdJtiAWH/g/Hn4nnTQrIgvF/ocC9sV3K1 fvbiLMxPopqB7m70yVTUoQgeihCR4z6JZyzIYeEyBQsX9kKYAI8RPIrh+GUjLSk1jldi 1YjIk0gyes/hgwc2aOI/WC9wH0igqY7FLelW/FoE86UsEj1W/Fuine+IdUs1LV3uhba1 /MIDEM1Fyd1u6b4VNwtNy98kVUzQqr5FGWBKzDkUGqMBGyv1I7GaJwEz6Wc5e3v8aE/F 22qA== 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=KnVnQzOCLcdDgRhzVY9QmrfHk/ZdBqjvbOlC3jMiHEE=; b=lTcc9gxPG066pWZ9Jfv9fV/EjdfH+cEQu15vpOzbQNucIapQ+X1CJpX35uUMxO53St Zfqv8qEGk0JBbbqfZji7c8vpIgLaJjIqtCGxUIlA/0kCAIiz7jmSKYb5pGIi+ejjDvCo GPZkV5+nZ6T5M9yH0FVYb0Jasv1T5LASVHY5K1oG8iyWm7fsYL2UvjEMqb8ZRqhQZGV6 srfsQG/B8p4QaMbbaeHDEy5QvngNG1Ca3fC/5ZOwZn1x3CU2FQo1tqRPJxa5nTLFRTow Y2Vy+jk73UnuIr3t+m2VUUqXePrv4aYXj5PbZeCcuwmEv4BQXOix/cqEiwBXD/uzapa3 OPtQ== X-Gm-Message-State: AFqh2ko6stpFe/8UQZl3UF40g6uJcuCFsi0UqrFZLKBsGMX1n97IAhoS v3muZ2Jcwqsmfu3iXqRbsMRuHFqlAX6tpLB7 X-Google-Smtp-Source: AMrXdXv0YHORfVdjZN8MPWF4mjZyLihtH1108fGzOWbs7+nvuSZ7ZdJRae8o3/wVExbGWuTaVaAliw== X-Received: by 2002:ad4:4a0d:0:b0:4c7:595c:9940 with SMTP id m13-20020ad44a0d000000b004c7595c9940mr110672699qvz.51.1673839567446; Sun, 15 Jan 2023 19:26:07 -0800 (PST) Received: from localhost.localdomain (dsl-10-130-209.b2b2c.ca. [72.10.130.209]) by smtp.gmail.com with ESMTPSA id bi1-20020a05620a318100b006fb0e638f12sm17474636qkb.4.2023.01.15.19.26.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 19:26:07 -0800 (PST) From: Maxim Cournoyer Date: Sun, 15 Jan 2023 22:25:43 -0500 Message-Id: <20230116032544.1378-12-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230116032544.1378-1-maxim.cournoyer@gmail.com> References: <20230116032544.1378-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=1673839700; a=rsa-sha256; cv=none; b=aK6c98UgbLESzw7Y8Q42bNsvn+QMLv6Mnm5JXi3Xc/d+6cM4xmzPgEOAKseiRF4nOUKuJ7 YptlbJK5qTNHAKhlG1K3qig8x+cwM2EoiNqZzIbSOJJcqHr0RNRe6u1YoGP7MlW/SAZPyq 81w1QmyaNkOrupgd0YgfHuo2tvD1InR9/MiUpic0xy5zC+dtm9wEqqxX6DygEzhL/AJ4a3 kqGhU8sX1ZVbiWQIFt0sdPci2ifa9Fre85SFbLmSky71/qhj2h4LAAPEY3al0lBbM0Y0zN f8QTmM8oBV/4MernDGSpsDK7/ulZD+tx3dMJR6d2tt9vcs3+hxvXzhz/DuF2dQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=VskrAZVA; 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=1673839700; 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=KnVnQzOCLcdDgRhzVY9QmrfHk/ZdBqjvbOlC3jMiHEE=; b=BGLSmk0E2yOZ5nE0rQqr6pQXC/lJLbuQrVMu5VH4vcknOQF8jSu7XE14bOuRBesGX+ZQUx 3/kXWZUsylBiZZrecF65q8dCvW5W7d1X/EJybS1EYeLEw9usd8wgp/pMehNWW8r+BpcJiC B64JMp+/qLtftyxHf4KMXLLKkFnoOcOMOkFPTXaeemEFTy/kSn9GzYkdmSfbmRDOYIvaW5 VWHfmoiX/FpR8A4vJ2L8xnyJx+xa6IMSp8XmLbuROOUMX9ktv/CjkFOtT9wHJxMDirk6nS EwUAL4w39uO3siBsduMBsrgWu7d0+GJ97nldquxGZBldS55W8Gd7yz/PAzPqqA== X-Migadu-Spam-Score: -0.52 X-Spam-Score: -0.52 X-Migadu-Queue-Id: B5B8C1ABF2 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=VskrAZVA; 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: 7Ptr7idz2p8P 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. --- (no changes since v4) 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 b6ee4c0565..029e84d5c2 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