[bug#54615,v3,2/2] gnu: Add riscv-pk.

Message ID 20220329104303.31212-2-arunisaac@systemreboot.net
State New
Headers
Series [bug#54615,v3,1/2] gnu: spike: Substitute path to dtc instead of wrapping executables. |

Commit Message

Arun Isaac March 29, 2022, 10:43 a.m. UTC
  * gnu/packages/virtualization.scm (riscv-pk): New variable.
---
 gnu/packages/virtualization.scm | 39 +++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
  

Comments

Efraim Flashner March 31, 2022, 12:30 p.m. UTC | #1
Thanks for the patches. Does it make sense to wrap spike with riscv-pk?
Right now I'm running it with:
guix shell spike riscv-pk -- sh -c 'spike $GUIX_ENVIRONMENT/bin/pk /gnu/store/hzd70l3dbgf66m4ibf34dzl7sif06f3k-hello-static-2.12/bin/hello'

I'm not sure how much spike is used without pk.
  
Arun Isaac April 1, 2022, 6:32 a.m. UTC | #2
> Thanks for the patches. Does it make sense to wrap spike with
> riscv-pk?
>
> I'm not sure how much spike is used without pk.

I see and feel your pain. :-P But, maybe it's best to not make that
assumption. I don't know enough about riscv-pk to say for sure.

The better solution may be for spike to look in $PATH when trying to run
a program. I have asked for this upstream:
https://github.com/riscv-software-src/riscv-isa-sim/issues/961

Thank you both for reviewing and merging these patches!
  

Patch

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 4c0f02154c..a058e59f6b 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -2365,3 +2365,42 @@  (define-public python-transient
      "@code{transient} is a wrapper for QEMU allowing the creation of virtual
 machines with shared folder, ssh, and disk creation support.")
     (license license:expat)))
+
+(define-public riscv-pk
+  (package
+    (name "riscv-pk")
+    (version "1.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/riscv-software-src/riscv-pk")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1cc0rz4q3a1zw8756b8yysw8lb5g4xbjajh5lvqbjix41hbdx6xz"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:out-of-source? #t
+           ;; riscv-pk can only be built for riscv64.
+           #:target "riscv64-linux-gnu"
+           #:make-flags #~(list (string-append "INSTALLDIR=" #$output))
+           ;; Add flags to keep symbols fromhost and tohost. These symbols are
+           ;; required for the correct functioning of pk.
+           #:strip-flags #~(list "--strip-unneeded"
+                                 "--keep-symbol=fromhost"
+                                 "--keep-symbol=tohost"
+                                 "--enable-deterministic-archives")))
+    (home-page "https://github.com/riscv-software-src/riscv-pk")
+    (synopsis "RISC-V Proxy Kernel")
+    (description "The RISC-V Proxy Kernel, @command{pk}, is a lightweight
+application execution environment that can host statically-linked RISC-V ELF
+binaries.  It is designed to support tethered RISC-V implementations with
+limited I/O capability and thus handles I/O-related system calls by proxying
+them to a host computer.
+
+This package also contains the Berkeley Boot Loader, @command{bbl}, which is a
+supervisor execution environment for tethered RISC-V systems.  It is designed
+to host the RISC-V Linux port.")
+    (license license:bsd-3)))