guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: gnu: Add opensbi.


From: guix-commits
Subject: 02/02: gnu: Add opensbi.
Date: Fri, 31 Jan 2020 22:06:47 -0500 (EST)

vagrantc pushed a commit to branch master
in repository guix.

commit 454403f19ac00d0132bdc28093ce4bbbda5d07f9
Author: Vagrant Cascadian <address@hidden>
AuthorDate: Sat Feb 1 01:43:28 2020 +0000

    gnu: Add opensbi.
    
    * gnu/packages/firmware (make-opensbi): New function.
      (opensbi-qemu-virt): New variable.
---
 gnu/packages/firmware.scm | 55 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index e96a00b..a56c8f0 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -183,6 +183,61 @@ Broadcom/AirForce chipset BCM43xx with Wireless-Core 
Revision 5.  It is used
 by the b43-open driver of Linux-libre.")
     (license license:gpl2)))
 
+(define* (make-opensbi-package platform variant #:optional (arch "riscv64"))
+  (package
+    (name (string-append "opensbi-" platform "-" variant))
+    (version "0.5")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/riscv/opensbi.git";)
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0qc73xbiy79qqkwxmp4mg15q8n8k26njkyqb6n0jw5dyibd6hb85"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(,@(if (and (not (string-prefix? "riscv64" (%current-system)))
+                  (string-prefix? "riscv64" arch))
+           `(("cross-gcc" ,(cross-gcc "riscv64-linux-gnu" #:xgcc gcc-7))
+             ("cross-binutils" ,(cross-binutils "riscv64-linux-gnu")))
+           '())))
+    (arguments
+     `(#:tests? #f ; no check target
+       #:make-flags (list (string-append "PLATFORM=" ,platform "/" ,variant)
+                          ,@(if (and (not (string-prefix? "riscv64"
+                                                          (%current-system)))
+                                     (string-prefix? "riscv64" arch))
+                                `("CROSS_COMPILE=riscv64-linux-gnu-")
+                                '())
+                          "FW_PAYLOAD=n"
+                          "V=1")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (bin (find-files "." ".*fw_.*.elf$")))
+               (for-each
+                 (lambda (file)
+                   (install-file file out))
+                 bin))
+             #t)))))
+    (home-page "https://github.com/riscv/opensbi";)
+    (synopsis "RISC-V Open Source Supervisor Binary Interface")
+    (description "A reference implementation of the RISC-V SBI specifications
+for platform-specific firmwares executing in M-mode.")
+    (license (list license:bsd-2
+                   ;; lib/utils/libfdt/* is dual licensed under bsd-2 and 
gpl2+.
+                   license:gpl2+
+                   ;; platform/ariane-fpga/* is gpl2.
+                   license:gpl2))))
+
+(define-public opensbi-qemu-virt
+  (make-opensbi-package "qemu" "virt"))
+
 (define-public seabios
   (package
     (name "seabios")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]