unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / Atom feed
* RISCV porting effort
@ 2021-06-07  7:09 Efraim Flashner
  2021-06-07 15:37 ` Christopher Lemmer Webber
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Efraim Flashner @ 2021-06-07  7:09 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 2946 bytes --]

Last week my HiFive Umatched¹ board came and was quite the object of
interest at the local computer store as I picked up a case, PSU and
graphics card.

Couple of observations about the board first:
It boots very slowly. I think it takes about 5 minutes from power-on to
being able to sign in at TTY1.
It has an NVMe slot which I haven't populated yet.
Ubuntu has an image for the board² which booted up just fine and I'm
using, since I didn't want to spend too long getting Debian to run on
the board.
Upstream u-boot support was merged days ago³ so we should be able to add
support to our u-boot package soon-ish™.

Porting Guix comes with two parts: building the bootstrap-tarballs and
adding support for the new architecture in (gnu packages bootstrap).
Support for riscv was added to GCC with 7.1.0 so I had to bump the
bootstrap GCC to 7 (and adjust some inputs), and guile-2.0.14 didn't
known the endianness of riscv64 so instead of patching it I bumped the
bootstrap guile to 3.0. I uploaded my bootstrap-tarballs to my regular
spot after signing them and switched over to the riscv machine.

Building Guix from sources is much easier thanks to the work of Vagrant,
I was able to apt install most of the dependencies on riscv. The
packaged version of guile-zlib was too old in 21.04 so I built that from
source (0.1.0 is available in Debian experimental), and I also had to
build gnutls from source for the guile-3.0 bindings. I added the riscv
binaries to (gnu packages bootstrap) and temporarily switched the
raw-build function to look for 3.0 guile libraries instead of 2.0.

Where I'm at right now:
Downloading using the daemon (builtin:download) fails currently, it says
it doesn't have permissions to open-file to write downloaded files to
the store.
I haven't built anything using the bootstrap binaries to see if they
actually work yet.


(ins)efraim@unmatched:~$ neofetch --off
efraim@unmatched
----------------
OS: Ubuntu 21.04 riscv64
Host: SiFive HiFive Unmatched A00
Kernel: 5.11.0-1007-generic
Uptime: 3 days, 15 hours, 57 mins
Packages: 782 (dpkg)
Shell: bash 5.1.4
Terminal: /dev/pts/0
CPU: (4)
GPU: NVIDIA GeForce GT 730
Memory: 350MiB / 15995MiB

(ins)efraim@unmatched:~$ lscpu
Architecture:        riscv64
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  4
Core(s) per socket:  1
Socket(s):           1
L1d cache:           32 KiB
L1i cache:           32 KiB
L2 cache:            2 MiB


¹https://www.sifive.com/boards/hifive-unmatched
²http://cdimage.ubuntu.com/releases/21.04/release/
³https://source.denx.de/u-boot/u-boot/-/commit/d8729a114e1e98806cffb87d2dca895f99a0170a

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #1.2: riscv-make-bootstrap.diff --]
[-- Type: text/plain, Size: 4219 bytes --]

diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index bf76d5052f..ef6ea52d6e 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -94,13 +94,13 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
   (mlambdaq (glibc)
     "Return a variant of GCC that uses the bootstrap variant of GLIBC."
     (package
-      (inherit gcc-5)
+      (inherit gcc-7)
       (outputs '("out")) ;all in one so libgcc_s is easily found
       (inputs
        `( ;; Distinguish the name so we can refer to it below.
          ("bootstrap-libc" ,(glibc-for-bootstrap glibc))
          ("libc:static" ,(glibc-for-bootstrap glibc) "static")
-         ,@(package-inputs gcc-5))))))
+         ,@(package-inputs gcc-7))))))
 
 (define (package-with-relocatable-glibc p)
   "Return a variant of P that uses the libc as defined by
@@ -139,7 +139,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                              (cons (search-path-specification
                                     (variable "CROSS_CPLUS_INCLUDE_PATH")
                                     (files '("include")))
-                                   (package-search-paths gcc-5)))))
+                                   (package-search-paths gcc-7)))))
             ("cross-binutils" ,(cross-binutils target))
             ,@(%final-inputs)))
         `(("libc" ,(glibc-for-bootstrap glibc))
@@ -461,11 +461,11 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
 (define %gcc-static
   ;; A statically-linked GCC, with stripped-down functionality.
   (package-with-relocatable-glibc
-   (package (inherit gcc-5)
+   (package (inherit gcc-7)
      (name "gcc-static")
      (outputs '("out"))                           ; all in one
      (arguments
-      (substitute-keyword-arguments (package-arguments gcc-5)
+      (substitute-keyword-arguments (package-arguments gcc-7)
         ((#:modules modules %gnu-build-system-modules)
          `((srfi srfi-1)
            (srfi srfi-26)
@@ -515,8 +515,8 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                 #t))))))
      (inputs
       `(("zlib:static" ,zlib "static")
-        ("isl:static" ,isl-0.18 "static")
-        ,@(package-inputs gcc-5)))
+        ("isl:static" ,isl "static")
+        ,@(package-inputs gcc-7)))
      (native-inputs
       (if (%current-target-system)
           `(;; When doing a Canadian cross, we need GMP/MPFR/MPC both
@@ -529,12 +529,12 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
             ("gmp-native" ,gmp)
             ("mpfr-native" ,mpfr)
             ("mpc-native" ,mpc)
-            ,@(package-native-inputs gcc-5))
-          (package-native-inputs gcc-5))))))
+            ,@(package-native-inputs gcc-7))
+          (package-native-inputs gcc-7))))))
 
 (define %gcc-stripped
   ;; The subset of GCC files needed for bootstrap.
-  (package (inherit gcc-5)
+  (package (inherit gcc-7)
     (name "gcc-stripped")
     (build-system trivial-build-system)
     (source #f)
@@ -869,6 +869,10 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
   ;; A tarball with the statically-linked, relocatable Guile.
   (tarball-package %guile-static-stripped))
 
+(define %guile-3.0-bootstrap-tarball
+  ;; A tarball with the statically-linked, relocatable Guile.
+  (tarball-package %guile-3.0-static-stripped))
+
 (define %mescc-tools-bootstrap-tarball
   ;; A tarball with statically-linked MesCC binary seed.
   (tarball-package %mescc-tools-static-stripped))
@@ -905,7 +909,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
                                (find-files directory "\\.tar\\."))))
                    %build-inputs)
          #t)))
-    (inputs `(("guile-tarball" ,%guile-bootstrap-tarball)
+    (inputs `(("guile-tarball" ,%guile-3.0-bootstrap-tarball)
               ,@(match (or (%current-target-system) (%current-system))
                   ((or "i686-linux" "x86_64-linux")
                    `(("bootstrap-mescc-tools" ,%mescc-tools-bootstrap-tarball)

[-- Attachment #1.3: riscv-bootstrap.diff --]
[-- Type: text/plain, Size: 8208 bytes --]

diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index c598cedc0a..091ffb2d5a 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -133,18 +133,29 @@
      ("tar"
       ,(base32 "150c8948cz8r208g6qgn2dn4f4zs5kpgbpbg6bwag6yw42rapw2l"))
      ("xz"
-      ,(base32 "0v5738idy9pqzcbrjdpxi5c6qs5m78zrpsydmrpx5cfcfzbkxzjh")))))
+      ,(base32 "0v5738idy9pqzcbrjdpxi5c6qs5m78zrpsydmrpx5cfcfzbkxzjh")))
+    ("riscv64-linux"
+     ("bash"
+      ,(base32 "0almlf73k6hbm495kzf4bw1rzsg5qddn7z2rf5l3d1xcapac2hj3"))
+     ("mkdir"
+      ,(base32 "0rg1amdcqfkplcy1608jignl8jq0wqzfkp430mwik3f62959gya6"))
+     ("tar"
+      ,(base32 "17d3x27qhiwk7h6ns0xrvbrq0frxz89mjjh2cdwx2rraq5x6wffm"))
+     ("xz"
+      ,(base32 "0nxn75xf386vdq3igmgm8gnyk4h4x0cm8jv71vlb2jvwxh0cyw1q")))))
 
 (define %bootstrap-executable-base-urls
   ;; This is where the bootstrap executables come from.
   '("https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/bootstrap/"
     "https://alpha.gnu.org/gnu/guix/bootstrap/"
+    "http://flashner.co.il/guix/bootstrap/"
     "http://lilypond.org/janneke/guix/"))
 
 (define (bootstrap-executable-file-name system program)
   "Return the FILE-NAME part of url where PROGRAM can be found for SYSTEM."
   (match system
     ("powerpc64le-linux" (string-append system "/20210106/" program))
+    ("riscv64-linux" (string-append system "/20210606/bin/" program))
     ("i586-gnu" (string-append system "/20200326/" program))
     (_ (string-append system "/" program
                       "?id=44f07d1dc6806e97c4e9ee3e6be883cc59dc666e"))))
@@ -347,6 +358,8 @@ or false to signal an error."
                     "/20200326/guile-static-stripped-2.0.14-i586-pc-gnu.tar.xz")
                    ("powerpc64le-linux"
                     "/20210106/guile-static-stripped-2.0.14-powerpc64le-linux-gnu.tar.xz")
+                   ("riscv64-linux"
+                    "/20210606/guile-3.0.2.tar.xz")
                    (_
                     "/20131110/guile-2.0.9.tar.xz"))))
 
@@ -363,6 +376,8 @@ or false to signal an error."
      (base32 "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5"))
     ("powerpc64le-linux"
      (base32 "1rnyfz5q38jyvxddj617443bnnzql4vw0mxzqpj8wz48wx4bhbq0"))
+    ("riscv64-linux"
+     (base32 "12pqmhsbbp7hh9r1bjdl14l3a4q06plpz6dcks9dysb4czay8p9f"))
     ("aarch64-linux"
      (base32 "1giy2aprjmn5fp9c4s9r125fljw4wv6ixy5739i5bffw4jgr0f9r"))
     ("i586-gnu"
@@ -419,8 +434,8 @@ or false to signal an error."
                     (lambda (p)
                       (format p "\
 #!~a
-export GUILE_SYSTEM_PATH=~a/share/guile/2.0
-export GUILE_SYSTEM_COMPILED_PATH=~a/lib/guile/2.0/ccache
+export GUILE_SYSTEM_PATH=~a/share/guile/3.0
+export GUILE_SYSTEM_COMPILED_PATH=~a/lib/guile/3.0/ccache
 exec -a \"~a0\" ~a \"~a@\"\n"
                               bash out out dollar guile-real dollar)))
                   (chmod guile   #o555)
@@ -435,8 +450,8 @@ cd $out
 ~a -dc < $GUILE_TARBALL | ~a xv
 
 # Use the bootstrap guile to create its own wrapper to set the load path.
-GUILE_SYSTEM_PATH=$out/share/guile/2.0 \
-GUILE_SYSTEM_COMPILED_PATH=$out/lib/guile/2.0/ccache \
+GUILE_SYSTEM_PATH=$out/share/guile/3.0 \
+GUILE_SYSTEM_COMPILED_PATH=$out/lib/guile/3.0/ccache \
 $out/bin/guile -c ~s $out ~a
 
 # Sanity check.
@@ -498,6 +513,8 @@ $out/bin/guile --version~%"
                                              "/20170217/static-binaries.tar.xz")
                                             ("powerpc64le-linux"
                                              "/20210106/static-binaries-0-powerpc64le-linux-gnu.tar.xz")
+                                            ("riscv64-linux"
+                                             "/20210606/static-binaries.tar.xz")
                                             ("i586-gnu"
                                              "/20200326/static-binaries-0-i586-pc-gnu.tar.xz")
                                             (_
@@ -520,6 +537,9 @@ $out/bin/guile --version~%"
                               ("powerpc64le-linux"
                                (base32
                                 "0afs2j9z2d1hjq42myz4iwjh0aqgzf59inifw87x6b6p1z9wv92v"))
+                              ("riscv64-linux"
+                               (base32
+                                "0x0xjlpmyh6rkr51p00gp6pscgl6zjida1rsg8vk3rinyi6rrbkg"))
                               ("i586-gnu"
                                (base32
                                 "17kllqnf3fg79gzy9ansgi801c46yh9c23h4d923plvb0nfm1cfn"))
@@ -573,6 +593,8 @@ $out/bin/guile --version~%"
                                              "/20210106/binutils-static-stripped-2.34-powerpc64le-linux-gnu.tar.xz")
                                             ("i586-gnu"
                                              "/20200326/binutils-static-stripped-2.34-i586-pc-gnu.tar.xz")
+                                            ("riscv64-linux"
+                                             "/20210606/binutils-2.34.tar.xz")
                                             (_
                                              "/20131110/binutils-2.23.2.tar.xz")))
                                      %bootstrap-base-urls))
@@ -593,6 +615,9 @@ $out/bin/guile --version~%"
                               ("powerpc64le-linux"
                                (base32
                                 "1klxy945c61134mzhqzz2gbk8w0n8jq7arwkrvz78d22ff2q0cwz"))
+                              ("riscv64-linux"
+                               (base32
+                                "0n9qf4vbilfmh1lknhw000waakj4q6s50pnjazr5137skm976z5m"))
                               ("i586-gnu"
                                (base32
                                 "11kykv1kmqc5wln57rs4klaqa13hm952smkc57qcsyss21kfjprs"))
@@ -653,6 +678,8 @@ $out/bin/guile --version~%"
                                        "/20210106/glibc-stripped-2.31-powerpc64le-linux-gnu.tar.xz")
                                       ("i586-gnu"
                                        "/20200326/glibc-stripped-2.31-i586-pc-gnu.tar.xz")
+                                      ("riscv64-linux"
+                                       "/20210606/glibc-2.31.tar.xz")
                                       (_
                                        "/20131110/glibc-2.18.tar.xz")))
                                %bootstrap-base-urls))
@@ -673,6 +700,9 @@ $out/bin/guile --version~%"
                         ("powerpc64le-linux"
                          (base32
                           "1a1df6z8gkaq09md3jy94lixnh20599p58p0s856p10xwjaqr1iz"))
+                        ("riscv64-linux"
+                         (base32
+                          "0162c4yfnz4272c9z03l28dzn5km05r7h06m3s730yiv2disldla"))
                         ("i586-gnu"
                          (base32
                           "14ddm10lpbas8bankmn5bcrlqvz1v5dnn1qjzxb19r57vd2w5952"))
@@ -749,6 +779,8 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
                                         "/20210106/gcc-stripped-5.5.0-powerpc64le-linux-gnu.tar.xz")
                                        ("i586-gnu"
                                         "/20200326/gcc-stripped-5.5.0-i586-pc-gnu.tar.xz")
+                                       ("riscv64-linux"
+                                        "/20210606/gcc-7.5.0.tar.xz")
                                        (_
                                         "/20131110/gcc-4.8.2.tar.xz")))
                                 %bootstrap-base-urls))
@@ -769,6 +801,9 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
                          ("powerpc64le-linux"
                           (base32
                            "151kjsai25vz2s667bgzpisx8f281fpl3n9pxz2yrp9jlnadz3m1"))
+                         ("riscv64-linux"
+                          (base32
+                           "0w1gm1pz3nsfxi5s14sd4nlwcbwq7709lma6csgm8gm6l6x5m7pn"))
                          ("i586-gnu"
                           (base32
                            "1j2zc58wzil71a34h7c70sd68dmqvcscrw3rmn2whq79vd70zvv5"))

[-- Attachment #1.4: bootstrap-guix-without-packaging.md --]
[-- Type: text/plain, Size: 2082 bytes --]

We want to build guix from source but not create native packages for all the dependencies. Therefore we will use [GNU Stow](https://www.gnu.org/software/stow/) to install the files to `/usr/local/stow` and then symlink them to `/usr/local`.

http://cdimage.ubuntu.com/releases/21.04/release/
For this, on Ubuntu 21.04, we need to install some packages:

```shell
sudo apt update
sudo apt install git stow autoconf autopoint make g++ gettext pkg-config po4a texinfo help2man guile-3.0 guile-3.0-dev libtasn1-6-dev guile-git guile-json guile-sqlite3 guile-gcrypt guile-lzlib
```

We need to compile gnutls from source to build the guile3.0 bindings

(make took 38 minutes)
```shell
cd /usr/local/src
wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.16.tar.xz
wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.16.tar.xz.sig
gpg --verify gnutls-3.6.16.tar.xz.sig
tar xf ../gnutls-3.6.16.tar.xz
cd gnutls-3.6.16
./configure --with-included-libtasn1 \
        --with-included-unistring \
        --without-p11-kit \
        --disable-dependency-tracking \
        --with-guile-site-dir=/usr/local/share/guile/site/3.0 \
        --with-guile-site-ccache-dir=/usr/local/lib/guile/3.0/site-ccache \
        --with-guile-extension-dir=/usr/local/lib/guile/3.0/extensions
make
sudo make install prefix=/usr/local/stow/gnutls-3.6.16
cd /usr/local/stow
sudo stow gnutls-3.6.16
```

guile-zlib is actually too old, so we build it from source
(make took 43 seconds)
```shell
cd /usr/local/src
git clone https://notabug.org/guile-zlib/guile-zlib
cd guile-zlib
git checkout v0.1.0
autoreconf -vfi
GUILE_LOAD_PATH=/usr/local/share/guile/site/3.0:$GUILE_LOAD_PATH ./configure
make
sudo make install prefix=/usr/local/stow/guile-zlib-0.1.0
ct /usr/local/stow
sudo stow guile-zlib-0.1.0
```

Then we can get started with Guix itself
```shell
git clone https://git.savannah.gnu.org/git/guix.git
cd guix
./bootstrap
GUILE_LOAD_PATH=/usr/local/share/guile/site/3.0:$GUILE_LOAD_PATH ./configure --with-courage
GUILE_LOAD_PATH=/usr/local/share/guile/site/3.0:$GUILE_LOAD_PATH make
```

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RISCV porting effort
  2021-06-07  7:09 RISCV porting effort Efraim Flashner
@ 2021-06-07 15:37 ` Christopher Lemmer Webber
  2021-06-08 13:43 ` Ludovic Courtès
  2021-06-11 11:16 ` Efraim Flashner
  2 siblings, 0 replies; 9+ messages in thread
From: Christopher Lemmer Webber @ 2021-06-07 15:37 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: guix-devel

Exciting... thanks for this update!  Even if not "usable" quite yet,
it's thrilling to see progress on this. :)


Efraim Flashner writes:

> Last week my HiFive Umatched¹ board came and was quite the object of
> interest at the local computer store as I picked up a case, PSU and
> graphics card.
>
> Couple of observations about the board first:
> It boots very slowly. I think it takes about 5 minutes from power-on to
> being able to sign in at TTY1.
> It has an NVMe slot which I haven't populated yet.
> Ubuntu has an image for the board² which booted up just fine and I'm
> using, since I didn't want to spend too long getting Debian to run on
> the board.
> Upstream u-boot support was merged days ago³ so we should be able to add
> support to our u-boot package soon-ish™.
>
> Porting Guix comes with two parts: building the bootstrap-tarballs and
> adding support for the new architecture in (gnu packages bootstrap).
> Support for riscv was added to GCC with 7.1.0 so I had to bump the
> bootstrap GCC to 7 (and adjust some inputs), and guile-2.0.14 didn't
> known the endianness of riscv64 so instead of patching it I bumped the
> bootstrap guile to 3.0. I uploaded my bootstrap-tarballs to my regular
> spot after signing them and switched over to the riscv machine.
>
> Building Guix from sources is much easier thanks to the work of Vagrant,
> I was able to apt install most of the dependencies on riscv. The
> packaged version of guile-zlib was too old in 21.04 so I built that from
> source (0.1.0 is available in Debian experimental), and I also had to
> build gnutls from source for the guile-3.0 bindings. I added the riscv
> binaries to (gnu packages bootstrap) and temporarily switched the
> raw-build function to look for 3.0 guile libraries instead of 2.0.
>
> Where I'm at right now:
> Downloading using the daemon (builtin:download) fails currently, it says
> it doesn't have permissions to open-file to write downloaded files to
> the store.
> I haven't built anything using the bootstrap binaries to see if they
> actually work yet.
>
>
> (ins)efraim@unmatched:~$ neofetch --off
> efraim@unmatched
> ----------------
> OS: Ubuntu 21.04 riscv64
> Host: SiFive HiFive Unmatched A00
> Kernel: 5.11.0-1007-generic
> Uptime: 3 days, 15 hours, 57 mins
> Packages: 782 (dpkg)
> Shell: bash 5.1.4
> Terminal: /dev/pts/0
> CPU: (4)
> GPU: NVIDIA GeForce GT 730
> Memory: 350MiB / 15995MiB
>
> (ins)efraim@unmatched:~$ lscpu
> Architecture:        riscv64
> Byte Order:          Little Endian
> CPU(s):              4
> On-line CPU(s) list: 0-3
> Thread(s) per core:  4
> Core(s) per socket:  1
> Socket(s):           1
> L1d cache:           32 KiB
> L1i cache:           32 KiB
> L2 cache:            2 MiB
>
>
> ¹https://www.sifive.com/boards/hifive-unmatched
> ²http://cdimage.ubuntu.com/releases/21.04/release/
> ³https://source.denx.de/u-boot/u-boot/-/commit/d8729a114e1e98806cffb87d2dca895f99a0170a



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RISCV porting effort
  2021-06-07  7:09 RISCV porting effort Efraim Flashner
  2021-06-07 15:37 ` Christopher Lemmer Webber
@ 2021-06-08 13:43 ` Ludovic Courtès
  2021-06-08 22:28   ` Gabriel Wicki
  2021-06-10 13:20   ` Efraim Flashner
  2021-06-11 11:16 ` Efraim Flashner
  2 siblings, 2 replies; 9+ messages in thread
From: Ludovic Courtès @ 2021-06-08 13:43 UTC (permalink / raw)
  To: guix-devel

Hello!

Efraim Flashner <efraim@flashner.co.il> skribis:

> Porting Guix comes with two parts: building the bootstrap-tarballs and
> adding support for the new architecture in (gnu packages bootstrap).
> Support for riscv was added to GCC with 7.1.0 so I had to bump the
> bootstrap GCC to 7 (and adjust some inputs), and guile-2.0.14 didn't
> known the endianness of riscv64 so instead of patching it I bumped the
> bootstrap guile to 3.0. I uploaded my bootstrap-tarballs to my regular
> spot after signing them and switched over to the riscv machine.
>
> Building Guix from sources is much easier thanks to the work of Vagrant,
> I was able to apt install most of the dependencies on riscv. The
> packaged version of guile-zlib was too old in 21.04 so I built that from
> source (0.1.0 is available in Debian experimental), and I also had to
> build gnutls from source for the guile-3.0 bindings. I added the riscv
> binaries to (gnu packages bootstrap) and temporarily switched the
> raw-build function to look for 3.0 guile libraries instead of 2.0.
>
> Where I'm at right now:
> Downloading using the daemon (builtin:download) fails currently, it says
> it doesn't have permissions to open-file to write downloaded files to
> the store.
> I haven't built anything using the bootstrap binaries to see if they
> actually work yet.

Exciting news!  I saw discussions about this ‘guix perform-download’
issue on IRC.  Did you eventually find what the problem is?

If the HiFive works fine, let me remind you that we have budget to buy
hardware, so we could just as well order a couple of these right away
(maybe you’ll have Guix System running by the time we receive them ;-)).

What we need is someone to order the machine(s) and to host it
afterwards, with stable connectivity.  This must be agreed upon by the
Spending Committee (currently Tobias, Ricardo, and myself; email
guix-finance@gnu.org).  You’ll then be reimbursed by the FSF, our
current fiscal sponsor.

Any takers?  Or should we wait until you have more experience with
yours, Efraim?

Thanks,
Ludo’.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RISCV porting effort
  2021-06-08 13:43 ` Ludovic Courtès
@ 2021-06-08 22:28   ` Gabriel Wicki
  2021-06-10 13:22     ` Efraim Flashner
  2021-06-11 21:07     ` Ludovic Courtès
  2021-06-10 13:20   ` Efraim Flashner
  1 sibling, 2 replies; 9+ messages in thread
From: Gabriel Wicki @ 2021-06-08 22:28 UTC (permalink / raw)
  To: guix-devel

Hello everyone!

> Efraim Flashner <efraim@flashner.co.il> skribis:
> > Porting Guix comes with two parts: building the bootstrap-tarballs and
> > adding support for the new architecture in (gnu packages bootstrap).
> > Support for riscv was added to GCC with 7.1.0 so I had to bump the
> > bootstrap GCC to 7 (and adjust some inputs), and guile-2.0.14 didn't
> > known the endianness of riscv64 so instead of patching it I bumped the
> > bootstrap guile to 3.0. I uploaded my bootstrap-tarballs to my regular
> > spot after signing them and switched over to the riscv machine.

Do i understand correctly that the bootstrap-tarballs can be
cross-compiled and tested (to some extent) in a qemu-system-riscv? Or does
this *have* to fail (by Guix's design) due to it not being bootstrappable?


On Tue, Jun 08, 2021 at 03:43:44PM +0200, Ludovic Courtès wrote:
> If the HiFive works fine, let me remind you that we have budget to buy
> hardware, so we could just as well order a couple of these right away
> (maybe you’ll have Guix System running by the time we receive them ;-)).
> 
> What we need is someone to order the machine(s) and to host it
> afterwards, with stable connectivity.  This must be agreed upon by the
> Spending Committee (currently Tobias, Ricardo, and myself; email
> guix-finance@gnu.org).  You’ll then be reimbursed by the FSF, our
> current fiscal sponsor.
> 
> Any takers?  Or should we wait until you have more experience with
> yours, Efraim?
I could see myself doing that. I've been thinking about getting a HiFive
Unmatched for a while and getting the hardware makes working on it a bit
more exciting!

Do i understand correctly that this machine would then be used to
build Guix packages and serve them? I.e. a worker on ci.guix.gnu.org?


Have a nice week!
gabriel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RISCV porting effort
  2021-06-08 13:43 ` Ludovic Courtès
  2021-06-08 22:28   ` Gabriel Wicki
@ 2021-06-10 13:20   ` Efraim Flashner
  2021-06-11 22:07     ` Ludovic Courtès
  1 sibling, 1 reply; 9+ messages in thread
From: Efraim Flashner @ 2021-06-10 13:20 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3412 bytes --]

On Tue, Jun 08, 2021 at 03:43:44PM +0200, Ludovic Courtès wrote:
> Hello!
> 
> Efraim Flashner <efraim@flashner.co.il> skribis:
> 
> > Porting Guix comes with two parts: building the bootstrap-tarballs and
> > adding support for the new architecture in (gnu packages bootstrap).
> > Support for riscv was added to GCC with 7.1.0 so I had to bump the
> > bootstrap GCC to 7 (and adjust some inputs), and guile-2.0.14 didn't
> > known the endianness of riscv64 so instead of patching it I bumped the
> > bootstrap guile to 3.0. I uploaded my bootstrap-tarballs to my regular
> > spot after signing them and switched over to the riscv machine.
> >
> > Building Guix from sources is much easier thanks to the work of Vagrant,
> > I was able to apt install most of the dependencies on riscv. The
> > packaged version of guile-zlib was too old in 21.04 so I built that from
> > source (0.1.0 is available in Debian experimental), and I also had to
> > build gnutls from source for the guile-3.0 bindings. I added the riscv
> > binaries to (gnu packages bootstrap) and temporarily switched the
> > raw-build function to look for 3.0 guile libraries instead of 2.0.
> >
> > Where I'm at right now:
> > Downloading using the daemon (builtin:download) fails currently, it says
> > it doesn't have permissions to open-file to write downloaded files to
> > the store.
> > I haven't built anything using the bootstrap binaries to see if they
> > actually work yet.
> 
> Exciting news!  I saw discussions about this ‘guix perform-download’
> issue on IRC.  Did you eventually find what the problem is?

Right now it seems to be some sort of permissions error with writing to
the store. I haven't been able to figure out what's causing it yet.

> If the HiFive works fine, let me remind you that we have budget to buy
> hardware, so we could just as well order a couple of these right away
> (maybe you’ll have Guix System running by the time we receive them ;-)).

On one hand they seem similar to some of our aarch64 boards (but with
16GB of RAM), on the other hand it'd be a coup to announce serious
support for the platform so quickly.

> What we need is someone to order the machine(s) and to host it
> afterwards, with stable connectivity.  This must be agreed upon by the
> Spending Committee (currently Tobias, Ricardo, and myself; email
> guix-finance@gnu.org).  You’ll then be reimbursed by the FSF, our
> current fiscal sponsor.
> 
> Any takers?  Or should we wait until you have more experience with
> yours, Efraim?
> 
> Thanks,
> Ludo’.
> 

I had to pay import tax when I received mine, and I assume those in
Europe did too, so I'd recommend they be hosted in the US since IIRC
they're shipping from Texas. It might be nice to wait until we have it
working for sure, but the lead time is still expected to be 6 months
between ordering and shipping dates.

I suppose if something else comes along that's faster we could always
cancel an order and switch to that.

I have mine sitting in a mini-ITX case, using a libre-respecting NVIDIA
card. Definitely a more serious board than the aarch64 boards I've
bought in the past.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RISCV porting effort
  2021-06-08 22:28   ` Gabriel Wicki
@ 2021-06-10 13:22     ` Efraim Flashner
  2021-06-11 21:07     ` Ludovic Courtès
  1 sibling, 0 replies; 9+ messages in thread
From: Efraim Flashner @ 2021-06-10 13:22 UTC (permalink / raw)
  To: Gabriel Wicki; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2515 bytes --]

On Wed, Jun 09, 2021 at 12:28:22AM +0200, Gabriel Wicki wrote:
> Hello everyone!
> 
> > Efraim Flashner <efraim@flashner.co.il> skribis:
> > > Porting Guix comes with two parts: building the bootstrap-tarballs and
> > > adding support for the new architecture in (gnu packages bootstrap).
> > > Support for riscv was added to GCC with 7.1.0 so I had to bump the
> > > bootstrap GCC to 7 (and adjust some inputs), and guile-2.0.14 didn't
> > > known the endianness of riscv64 so instead of patching it I bumped the
> > > bootstrap guile to 3.0. I uploaded my bootstrap-tarballs to my regular
> > > spot after signing them and switched over to the riscv machine.
> 
> Do i understand correctly that the bootstrap-tarballs can be
> cross-compiled and tested (to some extent) in a qemu-system-riscv? Or does
> this *have* to fail (by Guix's design) due to it not being bootstrappable?
> 

They get cross compiled from another architecture, using the package
definitions in gnu/packages/make-bootstrap.scm. From what I've seen
online, it should be possible to boot Ubuntu's riscv64 image using qemu.
I haven't tried enabling riscv64 support in my binfmt service and
try building on my main machine.

> 
> On Tue, Jun 08, 2021 at 03:43:44PM +0200, Ludovic Courtès wrote:
> > If the HiFive works fine, let me remind you that we have budget to buy
> > hardware, so we could just as well order a couple of these right away
> > (maybe you’ll have Guix System running by the time we receive them ;-)).
> > 
> > What we need is someone to order the machine(s) and to host it
> > afterwards, with stable connectivity.  This must be agreed upon by the
> > Spending Committee (currently Tobias, Ricardo, and myself; email
> > guix-finance@gnu.org).  You’ll then be reimbursed by the FSF, our
> > current fiscal sponsor.
> > 
> > Any takers?  Or should we wait until you have more experience with
> > yours, Efraim?
> I could see myself doing that. I've been thinking about getting a HiFive
> Unmatched for a while and getting the hardware makes working on it a bit
> more exciting!
> 
> Do i understand correctly that this machine would then be used to
> build Guix packages and serve them? I.e. a worker on ci.guix.gnu.org?
> 
> 
> Have a nice week!
> gabriel
> 

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RISCV porting effort
  2021-06-07  7:09 RISCV porting effort Efraim Flashner
  2021-06-07 15:37 ` Christopher Lemmer Webber
  2021-06-08 13:43 ` Ludovic Courtès
@ 2021-06-11 11:16 ` Efraim Flashner
  2 siblings, 0 replies; 9+ messages in thread
From: Efraim Flashner @ 2021-06-11 11:16 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2052 bytes --]

On Mon, Jun 07, 2021 at 10:09:44AM +0300, Efraim Flashner wrote:
> Upstream u-boot support was merged days ago³ so we should be able to add
> support to our u-boot package soon-ish™.

I added u-boot-sifive-unmatched, although Vagrant pointed out that I may
be missing opensbi as an input. I haven't had a chance to test it yet.

> Where I'm at right now:
> Downloading using the daemon (builtin:download) fails currently, it says
> it doesn't have permissions to open-file to write downloaded files to
> the store.
> I haven't built anything using the bootstrap binaries to see if they
> actually work yet.

I've had some time to play with these parts. I tried the qemu-binfmt
emulation on my Guix System machine and I was able to start building out
the packages while emulating riscv64-linux, so that's a good sign.

As for writing to the store goes, I believe it's a permissions issue
somewhere. With some help on IRC I modified the downloading code and
wrote out some files using the builtin:download function to a file in my
home directory. I also used a minimal reproducer to write a file to the
store:

scheme@(guile-user)> (use-modules (guix gexp)(guix store)(guix monad-repl))
scheme@(guile-user)> ,enter-store-monad
store-monad@(guile-user) [1]> (text-file "foo" "Hello!\n")
$2 = "/gnu/store/r4bq7f7aikj0dlzjcl2cjgal5wvdhvk1-foo"

(ins)efraim@unmatched:~$ cat /gnu/store/r4bq7f7aikj0dlzjcl2cjgal5wvdhvk1-foo
Hello!

So that works. Could it be that I messed up creating the guixbuild
users? I copy/pasted from the manual, command history shows me I ran:
root@unmatched:/home/efraim# for i in $(seq -w 1 10);   do     useradd -g guixbuild -G guixbuild                       -d /var/empty -s $(which nologin)               -c "Guix build user $i" --system                guixbuilder$i;   done


-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RISCV porting effort
  2021-06-08 22:28   ` Gabriel Wicki
  2021-06-10 13:22     ` Efraim Flashner
@ 2021-06-11 21:07     ` Ludovic Courtès
  1 sibling, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2021-06-11 21:07 UTC (permalink / raw)
  To: Gabriel Wicki; +Cc: guix-devel

Hi!

Gabriel Wicki <gabriel@erlikon.ch> skribis:

> On Tue, Jun 08, 2021 at 03:43:44PM +0200, Ludovic Courtès wrote:
>> If the HiFive works fine, let me remind you that we have budget to buy
>> hardware, so we could just as well order a couple of these right away
>> (maybe you’ll have Guix System running by the time we receive them ;-)).
>> 
>> What we need is someone to order the machine(s) and to host it
>> afterwards, with stable connectivity.  This must be agreed upon by the
>> Spending Committee (currently Tobias, Ricardo, and myself; email
>> guix-finance@gnu.org).  You’ll then be reimbursed by the FSF, our
>> current fiscal sponsor.
>> 
>> Any takers?  Or should we wait until you have more experience with
>> yours, Efraim?
> I could see myself doing that. I've been thinking about getting a HiFive
> Unmatched for a while and getting the hardware makes working on it a bit
> more exciting!
>
> Do i understand correctly that this machine would then be used to
> build Guix packages and serve them? I.e. a worker on ci.guix.gnu.org?

Yes, that’s the idea.  It would belong to the project and its primary
use would be continuous builds.

Thanks,
Ludo’.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RISCV porting effort
  2021-06-10 13:20   ` Efraim Flashner
@ 2021-06-11 22:07     ` Ludovic Courtès
  0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2021-06-11 22:07 UTC (permalink / raw)
  To: guix-devel

Hello!

Efraim Flashner <efraim@flashner.co.il> skribis:

> On Tue, Jun 08, 2021 at 03:43:44PM +0200, Ludovic Courtès wrote:

[...]

>> If the HiFive works fine, let me remind you that we have budget to buy
>> hardware, so we could just as well order a couple of these right away
>> (maybe you’ll have Guix System running by the time we receive them ;-)).
>
> On one hand they seem similar to some of our aarch64 boards (but with
> 16GB of RAM), on the other hand it'd be a coup to announce serious
> support for the platform so quickly.

I’m not saying we should announce anything, but rather that we get ready
for when the port is functional (especially if there’s typically 6
months between ordering and shipping).

> I had to pay import tax when I received mine, and I assume those in
> Europe did too, so I'd recommend they be hosted in the US since IIRC
> they're shipping from Texas. It might be nice to wait until we have it
> working for sure, but the lead time is still expected to be 6 months
> between ordering and shipping dates.

OK.  I don’t doubt “working for sure” will eventually happen; I wouldn’t
be surprised if it takes less than 6 months even.  :-)

(I’m not talking about the reduced bootstrap seeds, just the gross
bootstrap as currently done on ARM.)

> I suppose if something else comes along that's faster we could always
> cancel an order and switch to that.
>
> I have mine sitting in a mini-ITX case, using a libre-respecting NVIDIA
> card. Definitely a more serious board than the aarch64 boards I've
> bought in the past.

Good!

Ludo’.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-06-11 22:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07  7:09 RISCV porting effort Efraim Flashner
2021-06-07 15:37 ` Christopher Lemmer Webber
2021-06-08 13:43 ` Ludovic Courtès
2021-06-08 22:28   ` Gabriel Wicki
2021-06-10 13:22     ` Efraim Flashner
2021-06-11 21:07     ` Ludovic Courtès
2021-06-10 13:20   ` Efraim Flashner
2021-06-11 22:07     ` Ludovic Courtès
2021-06-11 11:16 ` Efraim Flashner

unofficial mirror of guix-devel@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-devel/0 guix-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-devel guix-devel/ https://yhetil.org/guix-devel \
		guix-devel@gnu.org
	public-inbox-index guix-devel

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.devel
	nntp://news.gmane.io/gmane.comp.gnu.guix.devel


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git