summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2021-06-12 23:23:43 +0300
committerEfraim Flashner <efraim@flashner.co.il>2022-01-14 11:41:15 +0200
commit03b45230d409c5f09e6ad18f23f313a13dbddb7d (patch)
treedb8981cfc724c66927d76d1d14e4b9e342a7348b
parentb0822c918e42b3e58b22bda1b10f699e0d50e666 (diff)
gnu: bootstrap: Add support for riscv64-linux.
On 7d93b21ab1c132990054372a9677c1639d54e631 gnu: glibc-for-bootstrap: Update patch. Run ./pre-inst-env guix build --target=riscv64-linux-gnu bootstrap-tarballs Producing /gnu/store/4hdzva9i0wyyfbgj1lmqc1wkk644pv07-bootstrap-tarballs-0 With guix hash -rx 1nj0fdgj08bbmfny01mp2blv7c3p2iciqh31zmf04ap5s7ygsqlp * gnu/packages/bootstrap.scm (%bootstrap-executables): Add entries for riscv64-linux. (%bootstrap-guile-hash, %bootstrap-coreutils&co, %bootstrap-binutils, %bootstrap-glibc, %bootstrap-gcc): Add entry for riscv64-linux. (raw-build-guile3): New procedure. (make-raw-bag): Use raw-build-guile3 for riscv64-linux. * guix/packages.scm (%supported-systems): Add riscv64-linux. (%cuirass-supported-systems): Remove riscv64-linux. * guix/utils.scm (target-64bit?): Add riscv64-linux. * m4/guix.m4: Add riscv64-linux as a supported system. * doc/guix.texi (GNU Distribution): Add riscv64-linux.
-rw-r--r--doc/guix.texi14
-rw-r--r--gnu/packages/bootstrap.scm112
-rw-r--r--gnu/packages/commencement.scm1
-rw-r--r--guix/packages.scm4
-rw-r--r--guix/utils.scm3
-rw-r--r--m4/guix.m42
6 files changed, 127 insertions, 9 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index bc289bad7b2..92971a531c1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -33,7 +33,7 @@ Copyright @copyright{} 2015, 2016, 2017, 2019, 2020, 2021 Leo Famulari@*
33Copyright @copyright{} 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ricardo Wurmus@* 33Copyright @copyright{} 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ricardo Wurmus@*
34Copyright @copyright{} 2016 Ben Woodcroft@* 34Copyright @copyright{} 2016 Ben Woodcroft@*
35Copyright @copyright{} 2016, 2017, 2018, 2021 Chris Marusich@* 35Copyright @copyright{} 2016, 2017, 2018, 2021 Chris Marusich@*
36Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner@* 36Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021, 2022 Efraim Flashner@*
37Copyright @copyright{} 2016 John Darrington@* 37Copyright @copyright{} 2016 John Darrington@*
38Copyright @copyright{} 2016, 2017 Nikita Gillmann@* 38Copyright @copyright{} 2016, 2017 Nikita Gillmann@*
39Copyright @copyright{} 2016, 2017, 2018, 2019, 2020 Jan Nieuwenhuizen@* 39Copyright @copyright{} 2016, 2017, 2018, 2019, 2020 Jan Nieuwenhuizen@*
@@ -564,6 +564,15 @@ build (@pxref{Tracking Bugs and Patches}). That said, the Guix
564community is actively working on improving this support, and now is a 564community is actively working on improving this support, and now is a
565great time to try it and get involved! 565great time to try it and get involved!
566 566
567@item riscv64-linux
568little-endian 64-bit RISC-V processors, specifically RV64GC, and
569Linux-Libre kernel. This playform is available as a "technology preview":
570although it is supported, substitutes are not yet available from the
571build farm (@pxref{Substitutes}), and some packages may fail to build
572(@pxref{Tracking Bugs and Patches}). That said, the Guix community is
573actively working on improving this support, and now is a great time to
574try it and get involved!
575
567@end table 576@end table
568 577
569With Guix@tie{}System, you @emph{declare} all aspects of the operating system 578With Guix@tie{}System, you @emph{declare} all aspects of the operating system
@@ -575,7 +584,8 @@ Manual}), the well-known GNU utilities and tool chain, as well as the
575graphical environment or system services of your choice. 584graphical environment or system services of your choice.
576 585
577Guix System is available on all the above platforms except 586Guix System is available on all the above platforms except
578@code{mips64el-linux} and @code{powerpc64le-linux}. 587@code{mips64el-linux}, @code{powerpc-linux}, @code{powerpc64le-linux} and
588@code{riscv64-linux}.
579 589
580@noindent 590@noindent
581For information on porting to other architectures or kernels, 591For information on porting to other architectures or kernels,
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 5a8028a4652..8bd0c4eaf3a 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -144,7 +144,16 @@
144 ("tar" 144 ("tar"
145 ,(base32 "150c8948cz8r208g6qgn2dn4f4zs5kpgbpbg6bwag6yw42rapw2l")) 145 ,(base32 "150c8948cz8r208g6qgn2dn4f4zs5kpgbpbg6bwag6yw42rapw2l"))
146 ("xz" 146 ("xz"
147 ,(base32 "0v5738idy9pqzcbrjdpxi5c6qs5m78zrpsydmrpx5cfcfzbkxzjh"))))) 147 ,(base32 "0v5738idy9pqzcbrjdpxi5c6qs5m78zrpsydmrpx5cfcfzbkxzjh")))
148 ("riscv64-linux"
149 ("bash"
150 ,(base32 "0almlf73k6hbm495kzf4bw1rzsg5qddn7z2rf5l3d1xcapac2hj3"))
151 ("mkdir"
152 ,(base32 "0rg1amdcqfkplcy1608jignl8jq0wqzfkp430mwik3f62959gya6"))
153 ("tar"
154 ,(base32 "17d3x27qhiwk7h6ns0xrvbrq0frxz89mjjh2cdwx2rraq5x6wffm"))
155 ("xz"
156 ,(base32 "0nxn75xf386vdq3igmgm8gnyk4h4x0cm8jv71vlb2jvwxh0cyw1q")))))
148 157
149(define %bootstrap-executable-base-urls 158(define %bootstrap-executable-base-urls
150 ;; This is where the bootstrap executables come from. 159 ;; This is where the bootstrap executables come from.
@@ -159,6 +168,7 @@
159 ("powerpc64le-linux" (string-append system "/20210106/" program)) 168 ("powerpc64le-linux" (string-append system "/20210106/" program))
160 ("i586-gnu" (string-append system "/20200326/" program)) 169 ("i586-gnu" (string-append system "/20200326/" program))
161 ("powerpc-linux" (string-append system "/20200923/bin/" program)) 170 ("powerpc-linux" (string-append system "/20200923/bin/" program))
171 ("riscv64-linux" (string-append system "/20210725/bin/" program))
162 (_ (string-append system "/" program 172 (_ (string-append system "/" program
163 "?id=44f07d1dc6806e97c4e9ee3e6be883cc59dc666e")))) 173 "?id=44f07d1dc6806e97c4e9ee3e6be883cc59dc666e"))))
164 174
@@ -362,6 +372,8 @@ or false to signal an error."
362 "/20200326/guile-static-stripped-2.0.14-i586-pc-gnu.tar.xz") 372 "/20200326/guile-static-stripped-2.0.14-i586-pc-gnu.tar.xz")
363 ("powerpc64le-linux" 373 ("powerpc64le-linux"
364 "/20210106/guile-static-stripped-2.0.14-powerpc64le-linux-gnu.tar.xz") 374 "/20210106/guile-static-stripped-2.0.14-powerpc64le-linux-gnu.tar.xz")
375 ("riscv64-linux"
376 "/20210725/guile-3.0.2.tar.xz")
365 (_ 377 (_
366 "/20131110/guile-2.0.9.tar.xz")))) 378 "/20131110/guile-2.0.9.tar.xz"))))
367 379
@@ -383,7 +395,9 @@ or false to signal an error."
383 ("i586-gnu" 395 ("i586-gnu"
384 (base32 "0wgqpsmvg25rnqn49ap7kwd2qxccd8dr4lllzp7i3rjvgav27vac")) 396 (base32 "0wgqpsmvg25rnqn49ap7kwd2qxccd8dr4lllzp7i3rjvgav27vac"))
385 ("powerpc-linux" 397 ("powerpc-linux"
386 (base32 "1by2p7s27fbyjzfkcw8h65h4kkqh7d23kv4sgg5jppjn2qx7swq4")))) 398 (base32 "1by2p7s27fbyjzfkcw8h65h4kkqh7d23kv4sgg5jppjn2qx7swq4"))
399 ("riscv64-linux"
400 (base32 "12pqmhsbbp7hh9r1bjdl14l3a4q06plpz6dcks9dysb4czay8p9f"))))
387 401
388(define (bootstrap-guile-origin system) 402(define (bootstrap-guile-origin system)
389 "Return an <origin> object for the Guile tarball of SYSTEM." 403 "Return an <origin> object for the Guile tarball of SYSTEM."
@@ -471,6 +485,76 @@ $out/bin/guile --version~%"
471 #:env-vars `(("GUILE_TARBALL" 485 #:env-vars `(("GUILE_TARBALL"
472 . ,(derivation->output-path guile)))))) 486 . ,(derivation->output-path guile))))))
473 487
488(define* (raw-build-guile3 name inputs
489 #:key outputs system search-paths
490 #:allow-other-keys)
491 (define (->store file)
492 (lower-object (bootstrap-executable file system)
493 system))
494
495 (define (make-guile-wrapper bash guile-real)
496 ;; The following code, run by the bootstrap guile after it is unpacked,
497 ;; creates a wrapper for itself to set its load path. This replaces the
498 ;; previous non-portable method based on reading the /proc/self/exe
499 ;; symlink.
500 '(begin
501 (use-modules (ice-9 match))
502 (match (command-line)
503 ((_ out bash)
504 (let ((bin-dir (string-append out "/bin"))
505 (guile (string-append out "/bin/guile"))
506 (guile-real (string-append out "/bin/.guile-real"))
507 ;; We must avoid using a bare dollar sign in this code,
508 ;; because it would be interpreted by the shell.
509 (dollar (string (integer->char 36))))
510 (chmod bin-dir #o755)
511 (rename-file guile guile-real)
512 (call-with-output-file guile
513 (lambda (p)
514 (format p "\
515#!~a
516export GUILE_SYSTEM_PATH=~a/share/guile/3.0
517export GUILE_SYSTEM_COMPILED_PATH=~a/lib/guile/3.0/ccache
518exec -a \"~a0\" ~a \"~a@\"\n"
519 bash out out dollar guile-real dollar)))
520 (chmod guile #o555)
521 (chmod bin-dir #o555))))))
522
523 (mlet* %store-monad ((tar (->store "tar"))
524 (xz (->store "xz"))
525 (mkdir (->store "mkdir"))
526 (bash (->store "bash"))
527 (guile (download-bootstrap-guile system))
528 (wrapper -> (make-guile-wrapper bash guile))
529 (builder
530 (text-file "build-bootstrap-guile.sh"
531 (format #f "
532echo \"unpacking bootstrap Guile to '$out'...\"
533~a $out
534cd $out
535~a -dc < $GUILE_TARBALL | ~a xv
536
537# Use the bootstrap guile to create its own wrapper to set the load path.
538GUILE_SYSTEM_PATH=$out/share/guile/3.0 \
539GUILE_SYSTEM_COMPILED_PATH=$out/lib/guile/3.0/ccache \
540$out/bin/guile -c ~s $out ~a
541
542# Sanity check.
543$out/bin/guile --version~%"
544 (derivation->output-path mkdir)
545 (derivation->output-path xz)
546 (derivation->output-path tar)
547 (object->string wrapper)
548 (derivation->output-path bash)))))
549 (raw-derivation name
550 (derivation->output-path bash) `(,builder)
551 #:system system
552 #:inputs (map derivation-input
553 (list bash mkdir tar xz guile))
554 #:sources (list builder)
555 #:env-vars `(("GUILE_TARBALL"
556 . ,(derivation->output-path guile))))))
557
474(define* (make-raw-bag name 558(define* (make-raw-bag name
475 #:key source inputs native-inputs outputs 559 #:key source inputs native-inputs outputs
476 system target) 560 system target)
@@ -478,7 +562,9 @@ $out/bin/guile --version~%"
478 (name name) 562 (name name)
479 (system system) 563 (system system)
480 (build-inputs inputs) 564 (build-inputs inputs)
481 (build raw-build))) 565 (build (cond ((target-riscv64?)
566 raw-build-guile3)
567 (else raw-build)))))
482 568
483(define %bootstrap-guile 569(define %bootstrap-guile
484 ;; The Guile used to run the build scripts of the initial derivations. 570 ;; The Guile used to run the build scripts of the initial derivations.
@@ -518,6 +604,8 @@ $out/bin/guile --version~%"
518 "/20200326/static-binaries-0-i586-pc-gnu.tar.xz") 604 "/20200326/static-binaries-0-i586-pc-gnu.tar.xz")
519 ("powerpc-linux" 605 ("powerpc-linux"
520 "/20200923/static-binaries.tar.xz") 606 "/20200923/static-binaries.tar.xz")
607 ("riscv64-linux"
608 "/20210725/static-binaries.tar.xz")
521 (_ 609 (_
522 "/20131110/static-binaries.tar.xz"))) 610 "/20131110/static-binaries.tar.xz")))
523 %bootstrap-base-urls)) 611 %bootstrap-base-urls))
@@ -544,6 +632,9 @@ $out/bin/guile --version~%"
544 ("powerpc-linux" 632 ("powerpc-linux"
545 (base32 633 (base32
546 "0kspxy0yczan2vlih6aa9hailr2inz000fqa0gn5x9d1fxxa5y8m")) 634 "0kspxy0yczan2vlih6aa9hailr2inz000fqa0gn5x9d1fxxa5y8m"))
635 ("riscv64-linux"
636 (base32
637 "0x0xjlpmyh6rkr51p00gp6pscgl6zjida1rsg8vk3rinyi6rrbkg"))
547 ("mips64el-linux" 638 ("mips64el-linux"
548 (base32 639 (base32
549 "072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753")))))) 640 "072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753"))))))
@@ -596,6 +687,8 @@ $out/bin/guile --version~%"
596 "/20200326/binutils-static-stripped-2.34-i586-pc-gnu.tar.xz") 687 "/20200326/binutils-static-stripped-2.34-i586-pc-gnu.tar.xz")
597 ("powerpc-linux" 688 ("powerpc-linux"
598 "/20200923/binutils-2.35.1.tar.xz") 689 "/20200923/binutils-2.35.1.tar.xz")
690 ("riscv64-linux"
691 "/20210725/binutils-2.34.tar.xz")
599 (_ 692 (_
600 "/20131110/binutils-2.23.2.tar.xz"))) 693 "/20131110/binutils-2.23.2.tar.xz")))
601 %bootstrap-base-urls)) 694 %bootstrap-base-urls))
@@ -616,6 +709,9 @@ $out/bin/guile --version~%"
616 ("powerpc64le-linux" 709 ("powerpc64le-linux"
617 (base32 710 (base32
618 "1klxy945c61134mzhqzz2gbk8w0n8jq7arwkrvz78d22ff2q0cwz")) 711 "1klxy945c61134mzhqzz2gbk8w0n8jq7arwkrvz78d22ff2q0cwz"))
712 ("riscv64-linux"
713 (base32
714 "0n9qf4vbilfmh1lknhw000waakj4q6s50pnjazr5137skm976z5m"))
619 ("i586-gnu" 715 ("i586-gnu"
620 (base32 716 (base32
621 "11kykv1kmqc5wln57rs4klaqa13hm952smkc57qcsyss21kfjprs")) 717 "11kykv1kmqc5wln57rs4klaqa13hm952smkc57qcsyss21kfjprs"))
@@ -681,6 +777,8 @@ $out/bin/guile --version~%"
681 "/20200326/glibc-stripped-2.31-i586-pc-gnu.tar.xz") 777 "/20200326/glibc-stripped-2.31-i586-pc-gnu.tar.xz")
682 ("powerpc-linux" 778 ("powerpc-linux"
683 "/20200923/glibc-2.32.tar.xz") 779 "/20200923/glibc-2.32.tar.xz")
780 ("riscv64-linux"
781 "/20210725/glibc-2.31.tar.xz")
684 (_ 782 (_
685 "/20131110/glibc-2.18.tar.xz"))) 783 "/20131110/glibc-2.18.tar.xz")))
686 %bootstrap-base-urls)) 784 %bootstrap-base-urls))
@@ -701,6 +799,9 @@ $out/bin/guile --version~%"
701 ("powerpc64le-linux" 799 ("powerpc64le-linux"
702 (base32 800 (base32
703 "1a1df6z8gkaq09md3jy94lixnh20599p58p0s856p10xwjaqr1iz")) 801 "1a1df6z8gkaq09md3jy94lixnh20599p58p0s856p10xwjaqr1iz"))
802 ("riscv64-linux"
803 (base32
804 "0d9x80vm7ca1pd2whcmpm1h14zxpb58kqajlxlwffzm04xfsjnxm"))
704 ("i586-gnu" 805 ("i586-gnu"
705 (base32 806 (base32
706 "14ddm10lpbas8bankmn5bcrlqvz1v5dnn1qjzxb19r57vd2w5952")) 807 "14ddm10lpbas8bankmn5bcrlqvz1v5dnn1qjzxb19r57vd2w5952"))
@@ -782,6 +883,8 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
782 "/20200326/gcc-stripped-5.5.0-i586-pc-gnu.tar.xz") 883 "/20200326/gcc-stripped-5.5.0-i586-pc-gnu.tar.xz")
783 ("powerpc-linux" 884 ("powerpc-linux"
784 "/20200923/gcc-5.5.0.tar.xz") 885 "/20200923/gcc-5.5.0.tar.xz")
886 ("riscv64-linux"
887 "/20210725/gcc-7.5.0.tar.xz")
785 (_ 888 (_
786 "/20131110/gcc-4.8.2.tar.xz"))) 889 "/20131110/gcc-4.8.2.tar.xz")))
787 %bootstrap-base-urls)) 890 %bootstrap-base-urls))
@@ -802,6 +905,9 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
802 ("powerpc64le-linux" 905 ("powerpc64le-linux"
803 (base32 906 (base32
804 "151kjsai25vz2s667bgzpisx8f281fpl3n9pxz2yrp9jlnadz3m1")) 907 "151kjsai25vz2s667bgzpisx8f281fpl3n9pxz2yrp9jlnadz3m1"))
908 ("riscv64-linux"
909 (base32
910 "1k4mbnb54wj2q37fgshf5dfixixqnhn002vhzvi9pnb57xb9v14d"))
805 ("i586-gnu" 911 ("i586-gnu"
806 (base32 912 (base32
807 "1j2zc58wzil71a34h7c70sd68dmqvcscrw3rmn2whq79vd70zvv5")) 913 "1j2zc58wzil71a34h7c70sd68dmqvcscrw3rmn2whq79vd70zvv5"))
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index a067c9cd279..94fcea0463f 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -2496,6 +2496,7 @@ exec " gcc "/bin/" program
2496 ,@(substitute-keyword-arguments (package-arguments findutils) 2496 ,@(substitute-keyword-arguments (package-arguments findutils)
2497 ((#:configure-flags flags ''()) 2497 ((#:configure-flags flags ''())
2498 `(append 2498 `(append
2499 ;; TODO: Figure out exactly with architectures need this.
2499 ,(if (target-64bit?) 2500 ,(if (target-64bit?)
2500 ''("TIME_T_32_BIT_OK=yes") 2501 ''("TIME_T_32_BIT_OK=yes")
2501 ''()) 2502 ''())
diff --git a/guix/packages.scm b/guix/packages.scm
index da8b66dfa69..9d5b23eb8a8 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -395,7 +395,7 @@ from forcing GEXP-PROMISE."
395 ;; This is the list of system types that are supported. By default, we 395 ;; This is the list of system types that are supported. By default, we
396 ;; expect all packages to build successfully here. 396 ;; expect all packages to build successfully here.
397 '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "mips64el-linux" "i586-gnu" 397 '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "mips64el-linux" "i586-gnu"
398 "powerpc64le-linux" "powerpc-linux")) 398 "powerpc64le-linux" "powerpc-linux" "riscv64-linux"))
399 399
400(define %hurd-systems 400(define %hurd-systems
401 ;; The GNU/Hurd systems for which support is being developed. 401 ;; The GNU/Hurd systems for which support is being developed.
@@ -406,7 +406,7 @@ from forcing GEXP-PROMISE."
406 ;; 406 ;;
407 ;; XXX: MIPS is unavailable in CI: 407 ;; XXX: MIPS is unavailable in CI:
408 ;; <https://lists.gnu.org/archive/html/guix-devel/2017-03/msg00790.html>. 408 ;; <https://lists.gnu.org/archive/html/guix-devel/2017-03/msg00790.html>.
409 (fold delete %supported-systems '("mips64el-linux" "powerpc-linux"))) 409 (fold delete %supported-systems '("mips64el-linux" "powerpc-linux" "riscv64-linux")))
410 410
411(define-inlinable (sanitize-inputs inputs) 411(define-inlinable (sanitize-inputs inputs)
412 "Sanitize INPUTS by turning it into a list of name/package tuples if it's 412 "Sanitize INPUTS by turning it into a list of name/package tuples if it's
diff --git a/guix/utils.scm b/guix/utils.scm
index 536323978e9..cba64645230 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -712,7 +712,8 @@ architecture (x86_64)?"
712 712
713(define* (target-64bit? #:optional (system (or (%current-target-system) 713(define* (target-64bit? #:optional (system (or (%current-target-system)
714 (%current-system)))) 714 (%current-system))))
715 (any (cut string-prefix? <> system) '("x86_64" "aarch64" "mips64" "powerpc64"))) 715 (any (cut string-prefix? <> system) '("x86_64" "aarch64" "mips64"
716 "powerpc64" "riscv64")))
716 717
717(define* (cc-for-target #:optional (target (%current-target-system))) 718(define* (cc-for-target #:optional (target (%current-target-system)))
718 (if target 719 (if target
diff --git a/m4/guix.m4 b/m4/guix.m4
index 6c8e4f1c854..700c0dfd4a6 100644
--- a/m4/guix.m4
+++ b/m4/guix.m4
@@ -89,7 +89,7 @@ courageous and port the GNU System distribution to it (see
89 # Currently only Linux-based systems are supported, and only on some 89 # Currently only Linux-based systems are supported, and only on some
90 # platforms. 90 # platforms.
91 case "$guix_system" in 91 case "$guix_system" in
92 x86_64-linux|i686-linux|armhf-linux|aarch64-linux|powerpc64le-linux|i586-gnu) 92 x86_64-linux|i686-linux|armhf-linux|aarch64-linux|powerpc64le-linux|riscv64-linux|i586-gnu)
93 ;; 93 ;;
94 mips64el-linux|powerpc-linux) 94 mips64el-linux|powerpc-linux)
95 AC_MSG_WARN([building Guix on `$guix_system', which is not supported]) 95 AC_MSG_WARN([building Guix on `$guix_system', which is not supported])