From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 22:26:23 2023 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 To: 60224@debbugs.gnu.org Subject: [PATCH v5 12/13] gnu: make-arm-trusted-firmware: Simplify build. 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-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60224 Cc: rekado@elephly.net, Maxim Cournoyer , vagrant@reproducible-builds.org 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.0 (-) 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