all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / Atom feed
* RISCV porting effort
@ 2021-06-07  7:09 Efraim Flashner
  2021-06-07 15:37 ` Christopher Lemmer Webber
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ 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] 15+ 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
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 15+ 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] 15+ 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 ` RISCV porting effort Efraim Flashner
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 15+ 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] 15+ 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; 15+ 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] 15+ 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
  2021-06-18 13:05     ` RISCV porting effort (now in stock @mouser) Gabriel Wicki
  1 sibling, 2 replies; 15+ 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] 15+ 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; 15+ 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] 15+ 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
  2021-06-13 17:24 ` Vagrant Cascadian
  2021-06-13 21:21 ` Christopher Baines
  4 siblings, 0 replies; 15+ 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] 15+ 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; 15+ 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] 15+ messages in thread

* Re: RISCV porting effort
  2021-06-10 13:20   ` Efraim Flashner
@ 2021-06-11 22:07     ` Ludovic Courtès
  2021-06-18 13:05     ` RISCV porting effort (now in stock @mouser) Gabriel Wicki
  1 sibling, 0 replies; 15+ 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] 15+ messages in thread

* Re: RISCV porting effort
  2021-06-07  7:09 RISCV porting effort Efraim Flashner
                   ` (2 preceding siblings ...)
  2021-06-11 11:16 ` RISCV porting effort Efraim Flashner
@ 2021-06-13 17:24 ` Vagrant Cascadian
  2021-06-14  7:27   ` Efraim Flashner
  2021-06-13 21:21 ` Christopher Baines
  4 siblings, 1 reply; 15+ messages in thread
From: Vagrant Cascadian @ 2021-06-13 17:24 UTC (permalink / raw)
  To: Efraim Flashner, guix-devel

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

On 2021-06-07, Efraim Flashner wrote:
> Last week my HiFive Umatched¹ board came
...
> 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.

I, on the other hand, went straight for Debian, of course! I stole the
vendor kernel and u-boot and built a Debian rootfs... and after a few
tries got it running.


> Upstream u-boot support was merged days ago³ so we should be able to add
> support to our u-boot package soon-ish™.

I haven't gotten u-boot working on Debian yet; builds fine, but has some
problem setting up reserved memory in the device-tree when booting. I
should try updating the guix u-boot-sifive-unmatched package and see if
that works any differently (different toolchain versions sometimes has
an effect).

There may be patches not yet upstreamed from:

  https://github.com/sifive/meta-sifive/tree/2021.05/recipes-bsp/u-boot/files/unmatched

Those are applied against u-boot 2021.01 ... and I haven't found any
that are likely related to the issue with reserved memory in the device-tree.


> 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.

I've managed to get so far as applying the patches from wip-riscv to the
guix 1.3.0 package in Debian and built it! It even runs, for the most
part!

That said, it was absurdly slow ... ~5 hours to build guix (not
including tests, which I disabled!) even though it was built entirely
within a tmpfs filesystem (what else would you do with 16GB of
ram?). Makes me worry how fast guix pull will perform...

I tried both with guile 3.0 (which required rebuilding guile-gnutls
against guile-3.0) and guile 2.2 (though I missed some of the patches,
so it didn't work too well).

I did get so far as trying to build hello, but fails building
diffutils-boot0:

  guix build hello
  ...
  config.status: error: in
  `/tmp/guix-build-diffutils-boot0-3.7.drv-0/diffutils-3.7':
  config.status: error: Something went wrong bootstrapping makefile
  fragments
      for automatic dependency tracking.  Try re-running configure with
  the
      '--disable-dependency-tracking' option to at least be able to
  build
      the package (albeit without support for automatic dependency
  tracking).
  See `config.log' for more details
  command
  "/gnu/store/0bxdn94rl7fvqksgf60vffsjn6h8fky8-bootstrap-binaries-0/bin/bash"
  "./configure" "CONFIG_SHELL=/gnu/st
  ore/0bxdn94rl7fvqksgf60vffsjn6h8fky8-bootstrap-binaries-0/bin/bash"
  "SHELL=/gnu/store/0bxdn94rl7fvqksgf60vffsjn6h8fky8-bootstrap-binaries-0/bin/bash"
  "--prefix=/gnu/store/5x2c8fgmw6hw5njish7n5ll28wink9fl-diffutils-boot0-3.7"
  "--enable-fas
  t-install" "--build=riscv64-unknown-linux-gnu" failed with status 1
  note: keeping build directory
  `/tmp/guix-build-diffutils-boot0-3.7.drv-1'
  builder for
  `/gnu/store/a3dn372lr9pgn3mb7j5s423x0ja1893q-diffutils-boot0-3.7.drv'
  failed with exit code 1              build of
  /gnu/store/a3dn372lr9pgn3mb7j5s423x0ja1893q-diffutils-boot0-3.7.drv
  failed
  View build log at '/var/log/guix/drvs/a3/dn372lr9pgn3mb7j5s423x0ja1893q-diffutils-boot0-3.7.drv.bz2'.
  ...
  cannot build derivation
  `/gnu/store/62l68kz6zz8m008qa8d0c5ariz7fd97z-hello-2.10.drv': 1
  dependencies couldn't be built
  guix build: error: build of
  `/gnu/store/62l68kz6zz8m008qa8d0c5ariz7fd97z-hello-2.10.drv' failed


I didn't find anything obvious to me in the build log or config.log, but
maybe someone else will:

  https://www.aikidev.net/~vagrant/riscv64/guix/


Some other boot-* stuff downloaded and/or built successfully, but this
appears to block any further progress for me at the moment...


live well,
  vagrant

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

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

* Re: RISCV porting effort
  2021-06-07  7:09 RISCV porting effort Efraim Flashner
                   ` (3 preceding siblings ...)
  2021-06-13 17:24 ` Vagrant Cascadian
@ 2021-06-13 21:21 ` Christopher Baines
  4 siblings, 0 replies; 15+ messages in thread
From: Christopher Baines @ 2021-06-13 21:21 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: guix-devel, guix-sysadmin

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


Efraim Flashner <efraim@flashner.co.il> 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.

I also recently received a HiFive Umatched board which I ordered months
ago.

While I don't really have the time right at the moment to actually do
much with it, I've got it connected to the internet and can consider
offering SSH access to anyone who could make use of it for porting Guix
to RISCV.

I brought it with building things for Guix in mind, if people would
prefer it being owned by guix-europe, I'm open to selling it.

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

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

* Re: RISCV porting effort
  2021-06-13 17:24 ` Vagrant Cascadian
@ 2021-06-14  7:27   ` Efraim Flashner
  2021-06-15  1:00     ` Vagrant Cascadian
  0 siblings, 1 reply; 15+ messages in thread
From: Efraim Flashner @ 2021-06-14  7:27 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: guix-devel

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

On Sun, Jun 13, 2021 at 10:24:13AM -0700, Vagrant Cascadian wrote:
> On 2021-06-07, Efraim Flashner wrote:
> > Last week my HiFive Umatched¹ board came
> ...
> > 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.
> 
> I, on the other hand, went straight for Debian, of course! I stole the
> vendor kernel and u-boot and built a Debian rootfs... and after a few
> tries got it running.
> 
> live well,
>   vagrant

Do you have notes on what you did? Right now I was thinking of taking
the Ubuntu image, keeping /boot with their kernel and u-boot and
replacing the rest of it with Debian. (And copying the device-tree dtb
files to /boot/firmware/kernel-version)


-- 
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] 15+ messages in thread

* Re: RISCV porting effort
  2021-06-14  7:27   ` Efraim Flashner
@ 2021-06-15  1:00     ` Vagrant Cascadian
  2021-06-15 12:37       ` Efraim Flashner
  0 siblings, 1 reply; 15+ messages in thread
From: Vagrant Cascadian @ 2021-06-15  1:00 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: guix-devel

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

On 2021-06-14, Efraim Flashner wrote:
> On Sun, Jun 13, 2021 at 10:24:13AM -0700, Vagrant Cascadian wrote:
>> On 2021-06-07, Efraim Flashner wrote:
>> > Last week my HiFive Umatched¹ board came
>> ...
>> > 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.
>> 
>> I, on the other hand, went straight for Debian, of course! I stole the
>> vendor kernel and u-boot and built a Debian rootfs... and after a few
>> tries got it running.
>> 
>> live well,
>>   vagrant
>
> Do you have notes on what you did? Right now I was thinking of taking
> the Ubuntu image, keeping /boot with their kernel and u-boot and
> replacing the rest of it with Debian. (And copying the device-tree dtb
> files to /boot/firmware/kernel-version)

I didn't take notes, but off the top of my head something like this:

  Booted the OE image that shipped with it on the microSD

  add partition for new rootfs (cfdisk /dev/mmcblk?)

  mkfs.ext4 /dev/mmcblkXpY
  mount -o noatime /dev/mmcblkXpY /mnt

  git clone https://salsa.debian.org/installer-team/debootstrap
  cd deboostrap
  sudo DEBOOTSTRAP_DIR=$(pwd) ./deboostrap --arch=riscv64 sid /mnt http://deb.debian.org/debian-ports
  echo 'UUID=...  / ext4 errors=remount-ro 0 1' > /mnt/etc/fstab
  echo 'tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0' >> /mnt/etc/fstab

  sudo chroot /mnt adduser vagrant --gecos ,,,
  sudo chroot /mnt adduser vagrant sudo
  sudo chroot /mnt passwd vagrant

  add another entry to /boot/extlinux/extlinux.conf using the
  appropriate root=/dev/mmcblkXpY and/or root=UUID=...

Probably missed something, but that's the jist.

Then, to build guix...

  git clone https://salsa.debian.org/debian/guix/
  cd guix
  git remote add originguix https://git.savannah.gnu.org/git/guix.git
  git fetch
  git format-patch -o debian/patches originguix/master..originguix/wip-riscv
  # add new patches to debian/patches/series
  
  # adjust debian/rules and debian/control to use guile-3.0...

  # build the package!
  DEB_BUILD_OPTIONS='nocheck parallel=5' sbuild --chroot-mode=unshare -d UNRELEASED -c sid 

Upgrading to use guile-3.0 required a manually rebuilt guile-gnutls
against guile-3.0 as well...

Just pushed debian/wip-riscv64 to https://salsa.debian.org/debian/guix/
if you want to look at my most recent attempt.

Notably, this is just the wip-riscv patches applied against guix 1.3.0;
maybe building against guix master will be more successful?


live well,
  vagrant

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

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

* Re: RISCV porting effort
  2021-06-15  1:00     ` Vagrant Cascadian
@ 2021-06-15 12:37       ` Efraim Flashner
  0 siblings, 0 replies; 15+ messages in thread
From: Efraim Flashner @ 2021-06-15 12:37 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: guix-devel

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

On Mon, Jun 14, 2021 at 06:00:21PM -0700, Vagrant Cascadian wrote:
> On 2021-06-14, Efraim Flashner wrote:
> > On Sun, Jun 13, 2021 at 10:24:13AM -0700, Vagrant Cascadian wrote:
> >> On 2021-06-07, Efraim Flashner wrote:
> >> > Last week my HiFive Umatched¹ board came
> >> ...
> >> > 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.
> >> 
> >> I, on the other hand, went straight for Debian, of course! I stole the
> >> vendor kernel and u-boot and built a Debian rootfs... and after a few
> >> tries got it running.
> >> 
> >> live well,
> >>   vagrant
> >
> > Do you have notes on what you did? Right now I was thinking of taking
> > the Ubuntu image, keeping /boot with their kernel and u-boot and
> > replacing the rest of it with Debian. (And copying the device-tree dtb
> > files to /boot/firmware/kernel-version)
> 
> I didn't take notes, but off the top of my head something like this:
> 
>   Booted the OE image that shipped with it on the microSD
> 
>   add partition for new rootfs (cfdisk /dev/mmcblk?)

Not a bad idea. I tried flashing a new SD card with their 2021.05 image
but it gave me kernel panics over the serial console so I reflashed it
with 2021.03. Actually, after flashing it I deleted everything in
/dev/sda4 and did debootstrap there and left extlinux setup as-is.

>   mkfs.ext4 /dev/mmcblkXpY
>   mount -o noatime /dev/mmcblkXpY /mnt
> 
>   git clone https://salsa.debian.org/installer-team/debootstrap
>   cd deboostrap
>   sudo DEBOOTSTRAP_DIR=$(pwd) ./deboostrap --arch=riscv64 sid /mnt http://deb.debian.org/debian-ports

I added --include=openssh-server,sudo

>   echo 'UUID=...  / ext4 errors=remount-ro 0 1' > /mnt/etc/fstab
>   echo 'tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0' >> /mnt/etc/fstab
> 
>   sudo chroot /mnt adduser vagrant --gecos ,,,
>   sudo chroot /mnt adduser vagrant sudo
>   sudo chroot /mnt passwd vagrant
> 
>   add another entry to /boot/extlinux/extlinux.conf using the
>   appropriate root=/dev/mmcblkXpY and/or root=UUID=...
> 
> Probably missed something, but that's the jist.

You forgot to mention what password you used ;P jkjk

echo "unmatched" > /etc/hostname
cat >>/etc/network/interfaces <<EOF
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
EOF

> Then, to build guix...
> 
>   git clone https://salsa.debian.org/debian/guix/
>   cd guix
>   git remote add originguix https://git.savannah.gnu.org/git/guix.git
>   git fetch
>   git format-patch -o debian/patches originguix/master..originguix/wip-riscv
>   # add new patches to debian/patches/series
>   
>   # adjust debian/rules and debian/control to use guile-3.0...
> 
>   # build the package!
>   DEB_BUILD_OPTIONS='nocheck parallel=5' sbuild --chroot-mode=unshare -d UNRELEASED -c sid 
> 
> Upgrading to use guile-3.0 required a manually rebuilt guile-gnutls
> against guile-3.0 as well...
> 
> Just pushed debian/wip-riscv64 to https://salsa.debian.org/debian/guix/
> if you want to look at my most recent attempt.
> 
> Notably, this is just the wip-riscv patches applied against guix 1.3.0;
> maybe building against guix master will be more successful?
> 
> 
> live well,
>   vagrant

I'm actually thinking of moving my reprepro setup off my g4 and hosting
it on my desktop (where I can get my gpg key more easily) and then
rsyncing it up to my server. If I setup pbuilder on the hifive unmatched
then I'll add those packages to the ones I already have online.



-- 
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] 15+ messages in thread

* Re: RISCV porting effort (now in stock @mouser)
  2021-06-10 13:20   ` Efraim Flashner
  2021-06-11 22:07     ` Ludovic Courtès
@ 2021-06-18 13:05     ` Gabriel Wicki
  1 sibling, 0 replies; 15+ messages in thread
From: Gabriel Wicki @ 2021-06-18 13:05 UTC (permalink / raw)
  To: guix-devel

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

So i checked mouser (europe) and it seems they have it in stock (361
in Munich right now). Not sure whether this was real i ordered one
and it seems it will be shipped next week.. Now i have to rush to
buy a case and a PSU (i already have a freedom respecting video
card) ;)

So everybody: if you want one: order now!


On Thu, Jun 10, 2021 at 04:20:42PM +0300, Efraim Flashner wrote:
> [...] but the lead time is still expected to be 6 months
> between ordering and shipping dates.
"Factory Lead Time" is still at about 6 months, but since the first
batch has not yet sold out... Also: if you ordered last November (in
reaction to SiFive's pre-order announcement) they already announced
first shipment to be no earlier than February.


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

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

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

Thread overview: 15+ 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-18 13:05     ` RISCV porting effort (now in stock @mouser) Gabriel Wicki
2021-06-11 11:16 ` RISCV porting effort Efraim Flashner
2021-06-13 17:24 ` Vagrant Cascadian
2021-06-14  7:27   ` Efraim Flashner
2021-06-15  1:00     ` Vagrant Cascadian
2021-06-15 12:37       ` Efraim Flashner
2021-06-13 21:21 ` Christopher Baines

all messages for Guix-related lists mirrored at yhetil.org

This inbox may be cloned and mirrored by anyone:

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

Example config snippet for mirrors.


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