From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ez782-0005g2-UK for guix-patches@gnu.org; Thu, 22 Mar 2018 16:48:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ez77y-0002AW-IG for guix-patches@gnu.org; Thu, 22 Mar 2018 16:48:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:40272) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ez77y-0002AK-Cv for guix-patches@gnu.org; Thu, 22 Mar 2018 16:48:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ez77y-0005Sa-0C for guix-patches@gnu.org; Thu, 22 Mar 2018 16:48:02 -0400 Subject: [bug#30911] Add pine64 u-boot Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ez76m-0005EK-JB for guix-patches@gnu.org; Thu, 22 Mar 2018 16:46:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ez76i-0001HF-9m for guix-patches@gnu.org; Thu, 22 Mar 2018 16:46:48 -0400 Received: from flashner.co.il ([178.62.234.194]:34764) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ez76h-0001FS-RG for guix-patches@gnu.org; Thu, 22 Mar 2018 16:46:44 -0400 Received: from localhost (46-117-130-5.bb.netvision.net.il [46.117.130.5]) by flashner.co.il (Postfix) with ESMTPSA id 8FF24404D1 for ; Thu, 22 Mar 2018 20:46:38 +0000 (UTC) Date: Thu, 22 Mar 2018 22:46:37 +0200 From: Efraim Flashner Message-ID: <20180322204637.GG20703@macbook41> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fmvA4kSBHQVZhkR6" Content-Disposition: inline List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30911@debbugs.gnu.org --fmvA4kSBHQVZhkR6 Content-Type: multipart/mixed; boundary="0OWHXb1mYLuhj1Ox" Content-Disposition: inline --0OWHXb1mYLuhj1Ox Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable These patches add the Arm Trusted Firmware procedure for building ATF for various ARM boards, which is needed by some for u-boot. Allwinner's branch has not yet been upstreamed, so it needs to override the source with its own vendor branch. I've tested these 4 patches by booting my pine64 with this u-boot (after manually creating the u-boot-sunxi-with-spl.bin) --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --0OWHXb1mYLuhj1Ox Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0001-gnu-make-arm-trusted-firmware-New-procedure.patch" Content-Transfer-Encoding: quoted-printable =46rom 33b9ec24864205fe346b727b0b9c33d4349fb57e Mon Sep 17 00:00:00 2001 =46rom: Efraim Flashner Date: Wed, 31 Jan 2018 21:07:32 +0200 Subject: [PATCH 1/6] gnu: make-arm-trusted-firmware: New procedure. * gnu/packages/firmware.scm (make-arm-trusted-firmware): New procedure. --- gnu/packages/firmware.scm | 77 +++++++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index 714af3df7..5a36674d9 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -2,7 +2,7 @@ ;;; Copyright =C2=A9 2014, 2015, 2016 Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2016 Eric Bavier ;;; Copyright =C2=A9 2017 David Craven -;;; Copyright =C2=A9 2017 Efraim Flashner +;;; Copyright =C2=A9 2017, 2018 Efraim Flashner ;;; Copyright =C2=A9 2018 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. @@ -24,6 +24,7 @@ #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix utils) #:use-module (guix git-download) #:use-module (guix build-system gnu) #:use-module (gnu packages) @@ -33,6 +34,7 @@ #:use-module (gnu packages cmake) #:use-module (gnu packages cross-base) #:use-module (gnu packages flex) + #:use-module (gnu packages gcc) #:use-module (gnu packages linux) #:use-module (gnu packages perl) #:use-module (gnu packages python)) @@ -309,3 +311,76 @@ coreboot.") Virtual Machines. OVMF contains a sample UEFI firmware for QEMU and KVM.") (license (list license:expat license:bsd-2 license:bsd-3 license:bsd-4)))) + +(define* (make-arm-trusted-firmware platform #:optional (arch "aarch64")) + (package + (name (string-append "arm-trusted-firmware-" platform)) + (version "1.5") + (source + (origin + (method git-fetch) + (uri (git-reference + ;; There are only GitHub generated release snapshots. + (url "https://github.com/ARM-software/arm-trusted-firmware.= git") + (commit (string-append "v" version)))) + (file-name (string-append "arm-trusted-firmware-" version "-checko= ut")) + (sha256 + (base32 + "1gm0bn2llzfzz9bfsz11fhwxj5lxvyrq7bc13fjj033nljzxn7k8")))) + (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$"))) + (for-each + (lambda (file) + (install-file file out)) + bin)) + #t))) + #:make-flags (list (string-append "PLAT=3D" ,platform) + ,@(if (and (not (string-prefix? "aarch64" + (%current-system= ))) + (string-prefix? "aarch64" arch)) + `("CROSS_COMPILE=3Daarch64-linux-gnu-") + '()) + ,@(if (and (not (string-prefix? "armhf" + (%current-system= ))) + (string-prefix? "armhf" arch)) + `("CROSS_COMPILE=3Darm-linux-gnueabihf-") + '()) + "DEBUG=3D1") + #:tests? #f)) ; no tests + (native-inputs + `(,@(if (and (not (string-prefix? "aarch64" (%current-system))) + (string-prefix? "aarch64" arch)) + ;; gcc-7 since it is used for u-boot, which needs gcc-7. + `(("cross-gcc" ,(cross-gcc "aarch64-linux-gnu" #:xgcc gcc-7)) + ("cross-binutils" ,(cross-binutils "aarch64-linux-gnu"))) + '()) + ,@(if (and (not (string-prefix? "armhf" (%current-system))) + (string-prefix? "armhf" arch)) + ;; gcc-7 since it is used for u-boot, which needs gcc-7. + `(("cross-gcc" ,(cross-gcc "arm-linux-gnueabihf" #:xgcc gcc-7)) + ("cross-binutils" ,(cross-binutils "arm-linux-gnueabihf"))) + '()) + )) + (home-page "https://github.com/ARM-software/arm-trusted-firmware") + (synopsis "Implementation of \"secure world software\"") + (description + "ARM Trusted Firmware provides a reference implementation of secure w= orld +software for ARMv7A and ARMv8-A, including a Secure Monitor executing at +@dfn{Exception Level 3} (EL3). It implements various ARM interface standa= rds, +such as: +@enumerate +@item The Power State Coordination Interface (PSCI) +@item Trusted Board Boot Requirements (TBBR, ARM DEN0006C-1) +@item SMC Calling Convention +@item System Control and Management Interface +@item Software Delegated Exception Interface (SDEI) +@end enumerate\n") + (license (list license:bsd-3 + license:bsd-2)))) ; libfdt --=20 2.16.2 --0OWHXb1mYLuhj1Ox Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0002-gnu-arm-trusted-firmware-pine64-plus-New-variable.patch" Content-Transfer-Encoding: quoted-printable =46rom 0de976ba245ef9f5518175676699cfc7136e3acf Mon Sep 17 00:00:00 2001 =46rom: Efraim Flashner Date: Wed, 31 Jan 2018 21:08:12 +0200 Subject: [PATCH 2/6] gnu: arm-trusted-firmware-pine64-plus: New variable. * gnu/packages/firmware.scm (arm-trusted-firmware-pine64-plus): New variable. --- gnu/packages/firmware.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index 5a36674d9..50cd49c92 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -384,3 +384,23 @@ such as: @end enumerate\n") (license (list license:bsd-3 license:bsd-2)))) ; libfdt + +(define-public arm-trusted-firmware-pine64-plus + (let ((base (make-arm-trusted-firmware "sun50iw1p1")) + ;; Vendor's arm trusted firmware branch hasn't been upstreamed yet. + (commit "ae78724247a01560164d607ed66db111c74d8df0") + (revision "1")) + (package + (inherit base) + (name "arm-trusted-firmware-pine64-plus") + (version (string-append "1.2-" revision "." (string-take commit 7))) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/apritzel/arm-trusted-firmware.gi= t") + (commit commit))) + (file-name (string-append name "-" version "-checkout")) + (sha256 + (base32 + "0r4xnlq7v9khjfcg6gqp7nmrmnw4z1r8bipwdr07png1dcbb8214"))))))) --=20 2.16.2 --0OWHXb1mYLuhj1Ox Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0003-gnu-make-u-boot-package-Install-itb-and-dtb-files-al.patch" Content-Transfer-Encoding: quoted-printable =46rom b088a9e174480438c2b082a87c8b5120d166e1f0 Mon Sep 17 00:00:00 2001 =46rom: Efraim Flashner Date: Wed, 31 Jan 2018 21:09:54 +0200 Subject: [PATCH 3/6] gnu: make-u-boot-package: Install 'itb' and 'dtb' files also. * gnu/packages/bootloaders.scm (make-u-boot-package)[arguments]: Add 'itb' and 'dtb' files to the files installed during custom 'install phase. --- gnu/packages/bootloaders.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 582c71cc4..063e9c3e6 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -422,7 +422,7 @@ also initializes the boards (RAM etc).") (let* ((out (assoc-ref outputs "out")) (libexec (string-append out "/libexec")) (uboot-files (append - (find-files "." ".*\\.(bin|efi|img|spl= )$") + (find-files "." ".*\\.(bin|efi|img|spl= |itb|dtb)$") (find-files "." "^MLO$")))) (mkdir-p libexec) (install-file ".config" libexec) --=20 2.16.2 --0OWHXb1mYLuhj1Ox Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0004-gnu-Add-u-boot-pine64-plus.patch" Content-Transfer-Encoding: quoted-printable =46rom 370074a1d0afbc1ea004bff39f9f6fe6089db194 Mon Sep 17 00:00:00 2001 =46rom: Efraim Flashner Date: Wed, 31 Jan 2018 21:10:47 +0200 Subject: [PATCH 4/6] gnu: Add u-boot-pine64-plus. * gnu/packages/bootloaders.scm (u-boot-pine64-plus): New variable. --- gnu/packages/bootloaders.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 063e9c3e6..2ea78c9ba 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -35,6 +35,7 @@ #:use-module (gnu packages cdrom) #:use-module (gnu packages cross-base) #:use-module (gnu packages disk) + #:use-module (gnu packages firmware) #:use-module (gnu packages flex) #:use-module (gnu packages fontutils) #:use-module (gnu packages gcc) @@ -445,6 +446,27 @@ also initializes the boards (RAM etc).") (define-public u-boot-odroid-c2 (make-u-boot-package "odroid-c2" "aarch64-linux-gnu")) =20 +(define-public u-boot-pine64-plus + (let ((base (make-u-boot-package "pine64_plus" "aarch64-linux-gnu"))) + (package + (inherit base) + (arguments + (substitute-keyword-arguments (package-arguments base) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'unpack 'set-environment + (lambda* (#:key inputs #:allow-other-keys) + (let ((bl31 (string-append (assoc-ref inputs "firmware") + "/bl31.bin"))) + (setenv "BL31" bl31) + ;; This is necessary while we're using the bundled dtc. + (setenv "PATH" (string-append (getenv "PATH") ":" + "scripts/dtc"))) + #t)))))) + (native-inputs + `(("firmware" ,arm-trusted-firmware-pine64-plus) + ,@(package-native-inputs base)))))) + (define-public u-boot-banana-pi-m2-ultra (make-u-boot-package "Bananapi_M2_Ultra" "arm-linux-gnueabihf")) =20 --=20 2.16.2 --0OWHXb1mYLuhj1Ox-- --fmvA4kSBHQVZhkR6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAlq0FikACgkQQarn3Mo9 g1Ga9BAAwOspaYW30pECvQ4+4MpjkPsFWcaN3lY45PpMGbWjX8ZaEIb2gFuA60VV t2Zx9DYuzJETMQoh6+QSbgXEPRMCJ1X3LOrliDOdkxTq5QkXGH88/Khvgf3b6b90 HTfybvQxzP0DHx6pFbEPQznsPSCuIhOzG94fFiC1OOs2wmvf/leDZoF+FD+eEEA1 CP3H4P1WpFmnqJDB9RVM4ImjbNqfikFX9qgkjPYijEAK2SnyD/ZfHbQ41iy2Lxxr XMsdVP2B0axJqh3HFxnL9KmyWCtqD4A70OIbw8VMxMC5AhhWsV/XTvnD3BGRNOE6 BnNCpmThxmckkc5iumT9C1xSHZmFYnDfMTT/z6yJm4kvCwGGKsvmSv3cuP1+O6VF HUkLlZ0IID+WfCTgZvRYqxGlGEJq9isIujZDpkjiR2gG+CeIEJ+zYABJr70w0DyS awgQz42kXKf7k/L1gdXDHXLaeizyPR4UVqvHOue3hCrzz8AHzTC9sP1Q0GCG4svI Gqsix44i6gBMsMcDCX7IbTXemRL7v4bWKKh5jUtmWYEZ3/zOXjuyE55aiLPplWWo eanuxnLZXk64kbkXqzNt/6n6iIOiVmQSwjDoxEjzmmXviZPhOpR3YYihAsudyQ/6 +MG24kFRaQg+QtSwN2GV01JQYShncHjpfLxUbnlUrWIzTID72k4= =16I7 -----END PGP SIGNATURE----- --fmvA4kSBHQVZhkR6--