GNU bug report logs - #68355
[PATCH 0/8] guix: Add or1k-elf platform.

Previous Next

Package: guix-patches;

Reported by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>

Date: Tue, 9 Jan 2024 23:13:02 UTC

Severity: normal

Tags: patch

Done: Mathieu Othacehe <othacehe <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 68355 in the body.
You can then email your comments to 68355 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Tue, 09 Jan 2024 23:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>:
New bug report received and forwarded. Copy sent to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org. (Tue, 09 Jan 2024 23:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: guix-patches <at> gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 0/8] guix: Add or1k-elf platform.
Date: Wed, 10 Jan 2024 00:12:15 +0100
This patch series adds the or1k-elf platform, a cross-gcc-toolchain
package for it and refactors the sole user of it to use GNU Guix
cross-compilation means (for MAKE-CRUST-PACKAGE).

The latter procedure has been split into MAKE-CRUST-TOOLS and
MAKE-CRUST-FIRMWARE since there's a part for the or1k-elf target
and other for the current system or target, adding to that the tools has
been disabled by default on the recent version by the upstream project
since the firmware should be loaded by U-Boot, however decided to build
the tool anyway to avoid breaking any users of this package, as a result
MAKE-CRUST-PACKAGE combines MAKE-CRUST-TOOLS and MAKE-CRUST-FIRMWARE.

Jean-Pierre De Jesus DIAZ (8):
  guix: Add ork1-elf platform.
  gnu: cross-gcc-toolchain: Use fixed name.
  gnu: Add gcc-cross-or1k-elf-toolchain.
  gnu: make-crust-package: Memoize.
  gnu: make-crust-package: Update to 0.6.
  gnu: make-crust-package: Use or1k-elf as target.
  gnu: Add make-crust-tools.
  gnu: make-crust-package: Unite firmware and tools.

 Makefile.am                      |   1 +
 doc/guix.texi                    |   6 +
 gnu/packages/cross-base.scm      |   4 +-
 gnu/packages/cross-toolchain.scm |   3 +
 gnu/packages/firmware.scm        | 187 ++++++++++++++++++-------------
 guix/platforms/or1k.scm          |  28 +++++
 6 files changed, 152 insertions(+), 77 deletions(-)
 create mode 100644 guix/platforms/or1k.scm


base-commit: 8920cf302c5a2fd457a2629afe24cf4768f1fed7
-- 
2.41.0





Information forwarded to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Tue, 09 Jan 2024 23:16:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: guix-patches <at> gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 1/8] guix: Add ork1-elf platform.
Date: Wed, 10 Jan 2024 00:14:35 +0100
* Makefile.am (MODULES): Add guix/platforms/or1k.scm.

* doc/guix.texi: Document or1k-elf platform.

* guix/platforms/or1k.scm (or1k-elf): New variable.

Change-Id: I3f71a0fa97f1ebd2bbdbf6cd00a93b477a123648
---
 Makefile.am             |  1 +
 doc/guix.texi           |  6 ++++++
 guix/platforms/or1k.scm | 28 ++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+)
 create mode 100644 guix/platforms/or1k.scm

diff --git a/Makefile.am b/Makefile.am
index b64dcaa77c..deee38232f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -140,6 +140,7 @@ MODULES =					\
   guix/platforms/arm.scm                        \
   guix/platforms/avr.scm                        \
   guix/platforms/mips.scm                       \
+  guix/platforms/or1k.scm                       \
   guix/platforms/powerpc.scm                    \
   guix/platforms/riscv.scm                      \
   guix/platforms/x86.scm                        \
diff --git a/doc/guix.texi b/doc/guix.texi
index 395545bed7..8b32722d64 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -16902,6 +16902,7 @@ Cross-Compilation
    - i686-linux-gnu
    - i686-w64-mingw32
    - mips64el-linux-gnu
+   - or1k-elf
    - powerpc-linux-gnu
    - powerpc64le-linux-gnu
    - riscv64-linux-gnu
@@ -46093,6 +46094,11 @@ Supported Platforms
 from AVR Libc.
 @end defvar
 
+@defvar or1k-elf
+Platform targeting OpenRISC 1000 CPU without an operating system and without a
+C standard library.
+@end defvar
+
 @node System Images
 @chapter Creating System Images
 
diff --git a/guix/platforms/or1k.scm b/guix/platforms/or1k.scm
new file mode 100644
index 0000000000..bf983085c5
--- /dev/null
+++ b/guix/platforms/or1k.scm
@@ -0,0 +1,28 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2024 Foundation Devices, Inc. <hello <at> foundationdevices.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix platforms or1k)
+  #:use-module (guix platform)
+  #:use-module (guix records)
+  #:export (or1k-elf))
+
+(define or1k-elf
+  (platform
+   (target "or1k-elf")
+   (system #f)
+   (glibc-dynamic-linker #f)))
-- 
2.41.0





Information forwarded to ludo <at> gnu.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Tue, 09 Jan 2024 23:16:02 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: guix-patches <at> gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 2/8] gnu: cross-gcc-toolchain: Use fixed name.
Date: Wed, 10 Jan 2024 00:14:36 +0100
* gnu/packages/cross-base.scm (cross-gcc-toolchain) <name>: Always use
  gcc-cross- prefix regardless of TARGET having a C standard library or
  not.

Change-Id: I5cbe89c61e5bd324a385db17c27131ea5ef75669
---
 gnu/packages/cross-base.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 6ee7b315d8..6abf07be17 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -745,7 +745,9 @@ (define* (cross-gcc-toolchain/implementation target
   "Returns PACKAGE that contains a cross-compilation tool chain for TARGET
 with XBINUTILS, XGCC and LIBC (if exists for TARGET)."
   (package
-    (name (string-append (package-name xgcc) "-toolchain"))
+    ;; Using PACKAGE-NAME of XGCC is avoided here as there are platforms that still
+    ;; need a toolchain but don't have a libc.
+    (name (string-append "gcc-cross-" target "-toolchain"))
     (version (package-version xgcc))
     (source #f)
     (build-system trivial-build-system)
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Tue, 09 Jan 2024 23:16:02 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: guix-patches <at> gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 3/8] gnu: Add gcc-cross-or1k-elf-toolchain.
Date: Wed, 10 Jan 2024 00:14:37 +0100
* gnu/packages/cross-toolchain.scm (gcc-cross-or1k-elf-toolchain): New
  variable.

Change-Id: Iaf7ed60dbbe116a5efbad8e94be9b2dee51faf15
---
 gnu/packages/cross-toolchain.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
index ab071e1005..5072462cbb 100644
--- a/gnu/packages/cross-toolchain.scm
+++ b/gnu/packages/cross-toolchain.scm
@@ -38,5 +38,8 @@ (define-public gcc-cross-avr-toolchain
 (define-public gcc-cross-i686-w64-mingw32-toolchain
   (cross-gcc-toolchain "i686-w64-mingw32"))
 
+(define-public gcc-cross-or1k-elf-toolchain
+  (cross-gcc-toolchain "or1k-elf"))
+
 (define-public gcc-cross-x86_64-w64-mingw32-toolchain
   (cross-gcc-toolchain "x86_64-w64-mingw32"))
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Tue, 09 Jan 2024 23:16:03 GMT) Full text and rfc822 format available.

Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: guix-patches <at> gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 4/8] gnu: make-crust-package: Memoize.
Date: Wed, 10 Jan 2024 00:14:38 +0100
* gnu/packages/firmware.scm (make-crust-package): Use mlambda.

Change-Id: I2d916b96bc650f3731a69505e086cf8f8f470809
---
 gnu/packages/firmware.scm | 153 +++++++++++++++++++-------------------
 1 file changed, 77 insertions(+), 76 deletions(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index e691bf33da..5567bcfe45 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1190,81 +1190,82 @@ (define-public arm-trusted-firmware-imx8mq
           ;; Adding debug symbols causes the size to exceed limits.
           #~(delete "DEBUG=1" #$flags)))))))
 
-(define (make-crust-package platform)
-  (package
-    (name (string-append "crust-"
-                         (string-replace-substring platform "_" "-")))
-    (version "0.5")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             ;; There are only GitHub generated release snapshots.
-             (url "https://github.com/crust-firmware/crust")
-             (commit (string-append "v" version))))
-       (file-name (git-file-name "crust" version))
-       (sha256
-        (base32
-         "0xgbbhifg3miwd3yp6jq9kp7nqgz5gzy00w95vba45j8jk5vjvvz"))))
-    (build-system gnu-build-system)
-    (arguments
-     (list
-      #:tests? #f                       ;no test suite
-      #:make-flags
-      (let ((triplet-without-vendor
-             (and (%current-target-system)
-                  ;; TODO: Is there a use case for allowing this?
-                  (not (target-avr?))
-                  (match (string-split (nix-system->gnu-triplet
-                                        (%current-target-system)) #\-)
-                    ((arch vendor os ..1)
-                     (string-join `(,arch ,@os) "-"))))))
-        #~(list "CROSS_COMPILE=or1k-elf-"
-                "V=1"
-                #$@(if triplet-without-vendor
-                       ;; We are cross-compiling the tools, intended to be
-                       ;; executable for the target system.
-                       (list (string-append "HOSTAR=" triplet-without-vendor
-                                            "-ar")
-                             (string-append "HOSTCC=" triplet-without-vendor
-                                            "-gcc"))
-                       ;; Not cross-compiling.
-                       (list "HOSTAR=ar"
-                             "HOSTCC=gcc"))
-                "LEX=flex"))
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-after 'unpack 'do-not-build-tests
-            (lambda _
-              ;; Attempting to build the tools test binary on a non-aarch64
-              ;; architecture fails with: "No cache cleaning implementation
-              ;; available for this architecture".  Avoid building it (see:
-              ;; https://github.com/crust-firmware/crust/issues/182).
-              (substitute* "tools/Makefile"
-                (("tools-y \\+= test") ""))))
-          (delete 'configure)
-          (add-before 'build 'defconfig
-            (lambda* (#:key make-flags #:allow-other-keys)
-              (let ((config-name (string-append #$platform "_defconfig")))
-                (apply invoke "make" (cons config-name make-flags)))))
-          (replace 'install
-            (lambda _
-              (for-each (lambda (file)
-                          (install-file file (string-append #$output
-                                                            "/libexec")))
-                        (find-files "." "(scp\\.bin|\\.config)$"))
-              (install-file "build/tools/load"
-                            (string-append #$output "/bin")))))))
-    ;; The firmware is cross-compiled using a "bare bones" compiler (no libc).
-    ;; Use our own tool chain for that.
-    (native-inputs
-     (list bison
-           (cross-gcc "or1k-elf")
-           (cross-binutils "or1k-elf")
-           flex))
-    (home-page "https://github.com/crust-firmware/crust")
-    (synopsis "System control processor firmware for Allwinner sunxi boards")
-    (description "Crust improves battery life and thermal performance by
+(define make-crust-package
+  (mlambda (platform)
+    (package
+      (name (string-append "crust-"
+                           (string-replace-substring platform "_" "-")))
+      (version "0.5")
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               ;; There are only GitHub generated release snapshots.
+               (url "https://github.com/crust-firmware/crust")
+               (commit (string-append "v" version))))
+         (file-name (git-file-name "crust" version))
+         (sha256
+          (base32
+           "0xgbbhifg3miwd3yp6jq9kp7nqgz5gzy00w95vba45j8jk5vjvvz"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:tests? #f                       ;no test suite
+        #:make-flags
+        (let ((triplet-without-vendor
+               (and (%current-target-system)
+                    ;; TODO: Is there a use case for allowing this?
+                    (not (target-avr?))
+                    (match (string-split (nix-system->gnu-triplet
+                                          (%current-target-system)) #\-)
+                      ((arch vendor os ..1)
+                       (string-join `(,arch ,@os) "-"))))))
+          #~(list "CROSS_COMPILE=or1k-elf-"
+                  "V=1"
+                  #$@(if triplet-without-vendor
+                         ;; We are cross-compiling the tools, intended to be
+                         ;; executable for the target system.
+                         (list (string-append "HOSTAR=" triplet-without-vendor
+                                              "-ar")
+                               (string-append "HOSTCC=" triplet-without-vendor
+                                              "-gcc"))
+                         ;; Not cross-compiling.
+                         (list "HOSTAR=ar"
+                               "HOSTCC=gcc"))
+                  "LEX=flex"))
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'do-not-build-tests
+              (lambda _
+                ;; Attempting to build the tools test binary on a non-aarch64
+                ;; architecture fails with: "No cache cleaning implementation
+                ;; available for this architecture".  Avoid building it (see:
+                ;; https://github.com/crust-firmware/crust/issues/182).
+                (substitute* "tools/Makefile"
+                  (("tools-y \\+= test") ""))))
+            (delete 'configure)
+            (add-before 'build 'defconfig
+              (lambda* (#:key make-flags #:allow-other-keys)
+                (let ((config-name (string-append #$platform "_defconfig")))
+                  (apply invoke "make" (cons config-name make-flags)))))
+            (replace 'install
+              (lambda _
+                (for-each (lambda (file)
+                            (install-file file (string-append #$output
+                                                              "/libexec")))
+                          (find-files "." "(scp\\.bin|\\.config)$"))
+                (install-file "build/tools/load"
+                              (string-append #$output "/bin")))))))
+      ;; The firmware is cross-compiled using a "bare bones" compiler (no libc).
+      ;; Use our own tool chain for that.
+      (native-inputs
+       (list bison
+             (cross-gcc "or1k-elf")
+             (cross-binutils "or1k-elf")
+             flex))
+      (home-page "https://github.com/crust-firmware/crust")
+      (synopsis "System control processor firmware for Allwinner sunxi boards")
+      (description "Crust improves battery life and thermal performance by
 implementing a deep sleep state.  During deep sleep, the CPU cores, the DRAM
 controller, and most onboard peripherals are powered down, reducing power
 consumption by 80% or more compared to an idle device.  On boards without a
@@ -1274,7 +1275,7 @@ (define (make-crust-package platform)
 Crust is designed to run on a specific SCP implementation, Allwinner's
 AR100.")
     ;; Most files are dual-licensed "BSD-3 OR GPL2", a few are GPL2 only.
-    (license (list license:bsd-3 license:gpl2))))
+    (license (list license:bsd-3 license:gpl2)))))
 
 (define-public crust-pinebook
   (make-crust-package "pinebook"))
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Tue, 09 Jan 2024 23:16:04 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: guix-patches <at> gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 5/8] gnu: make-crust-package: Update to 0.6.
Date: Wed, 10 Jan 2024 00:14:39 +0100
* gnu/packages/firmware.scm (make-crust-package): Update to 0.6.

* gnu/packages/firmware.scm (make-crust-package): Do not install host
  tool as it is not built by default.

Change-Id: Ia79ae8208589601d32235f6d8ace9dce3f8d74f9
---
 gnu/packages/firmware.scm | 42 ++++++++-------------------------------
 1 file changed, 8 insertions(+), 34 deletions(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 5567bcfe45..30422a573c 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1195,7 +1195,7 @@ (define make-crust-package
     (package
       (name (string-append "crust-"
                            (string-replace-substring platform "_" "-")))
-      (version "0.5")
+      (version "0.6")
       (source
        (origin
          (method git-fetch)
@@ -1206,43 +1206,19 @@ (define make-crust-package
          (file-name (git-file-name "crust" version))
          (sha256
           (base32
-           "0xgbbhifg3miwd3yp6jq9kp7nqgz5gzy00w95vba45j8jk5vjvvz"))))
+           "1blq6bi2rmg4qqwwr07pamv28b50mwcsybhpn9bws8vbzxa43afd"))))
       (build-system gnu-build-system)
       (arguments
        (list
         #:tests? #f                       ;no test suite
         #:make-flags
-        (let ((triplet-without-vendor
-               (and (%current-target-system)
-                    ;; TODO: Is there a use case for allowing this?
-                    (not (target-avr?))
-                    (match (string-split (nix-system->gnu-triplet
-                                          (%current-target-system)) #\-)
-                      ((arch vendor os ..1)
-                       (string-join `(,arch ,@os) "-"))))))
-          #~(list "CROSS_COMPILE=or1k-elf-"
-                  "V=1"
-                  #$@(if triplet-without-vendor
-                         ;; We are cross-compiling the tools, intended to be
-                         ;; executable for the target system.
-                         (list (string-append "HOSTAR=" triplet-without-vendor
-                                              "-ar")
-                               (string-append "HOSTCC=" triplet-without-vendor
-                                              "-gcc"))
-                         ;; Not cross-compiling.
-                         (list "HOSTAR=ar"
-                               "HOSTCC=gcc"))
-                  "LEX=flex"))
+        #~(list "CROSS_COMPILE=or1k-elf-"
+                "V=1"
+                "HOSTAR=ar"
+                "HOSTCC=gcc"
+                "LEX=flex")
         #:phases
         #~(modify-phases %standard-phases
-            (add-after 'unpack 'do-not-build-tests
-              (lambda _
-                ;; Attempting to build the tools test binary on a non-aarch64
-                ;; architecture fails with: "No cache cleaning implementation
-                ;; available for this architecture".  Avoid building it (see:
-                ;; https://github.com/crust-firmware/crust/issues/182).
-                (substitute* "tools/Makefile"
-                  (("tools-y \\+= test") ""))))
             (delete 'configure)
             (add-before 'build 'defconfig
               (lambda* (#:key make-flags #:allow-other-keys)
@@ -1253,9 +1229,7 @@ (define make-crust-package
                 (for-each (lambda (file)
                             (install-file file (string-append #$output
                                                               "/libexec")))
-                          (find-files "." "(scp\\.bin|\\.config)$"))
-                (install-file "build/tools/load"
-                              (string-append #$output "/bin")))))))
+                          (find-files "." "(scp\\.bin|\\.config)$")))))))
       ;; The firmware is cross-compiled using a "bare bones" compiler (no libc).
       ;; Use our own tool chain for that.
       (native-inputs
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Tue, 09 Jan 2024 23:16:04 GMT) Full text and rfc822 format available.

Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: guix-patches <at> gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 6/8] gnu: make-crust-package: Use or1k-elf as target.
Date: Wed, 10 Jan 2024 00:14:40 +0100
* gnu/packages/firmware.scm (make-crust-package): Use or1k-elf as the
  target.

Change-Id: I6c8bf053527f1e12e35402f18cebf8e75557c788
---
 gnu/packages/firmware.scm | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 30422a573c..e62f29993a 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1210,13 +1210,13 @@ (define make-crust-package
       (build-system gnu-build-system)
       (arguments
        (list
+        #:target "or1k-elf"
         #:tests? #f                       ;no test suite
-        #:make-flags
-        #~(list "CROSS_COMPILE=or1k-elf-"
-                "V=1"
-                "HOSTAR=ar"
-                "HOSTCC=gcc"
-                "LEX=flex")
+        #:make-flags #~'("CROSS_COMPILE=or1k-elf-"
+                         "V=1"
+                         "HOSTAR=ar"
+                         "HOSTCC=gcc"
+                         "LEX=flex")
         #:phases
         #~(modify-phases %standard-phases
             (delete 'configure)
@@ -1230,13 +1230,7 @@ (define make-crust-package
                             (install-file file (string-append #$output
                                                               "/libexec")))
                           (find-files "." "(scp\\.bin|\\.config)$")))))))
-      ;; The firmware is cross-compiled using a "bare bones" compiler (no libc).
-      ;; Use our own tool chain for that.
-      (native-inputs
-       (list bison
-             (cross-gcc "or1k-elf")
-             (cross-binutils "or1k-elf")
-             flex))
+      (native-inputs (list bison flex))
       (home-page "https://github.com/crust-firmware/crust")
       (synopsis "System control processor firmware for Allwinner sunxi boards")
       (description "Crust improves battery life and thermal performance by
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Tue, 09 Jan 2024 23:16:05 GMT) Full text and rfc822 format available.

Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: guix-patches <at> gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 7/8] gnu: Add make-crust-tools.
Date: Wed, 10 Jan 2024 00:14:41 +0100
* gnu/packages/firmware.scm (make-crust-tools): New procedure.

Change-Id: Iac05ecf1796e4c10692a423c12423ea9b078d141
---
 gnu/packages/firmware.scm | 42 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index e62f29993a..c3deab5224 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1245,6 +1245,48 @@ (define make-crust-package
     ;; Most files are dual-licensed "BSD-3 OR GPL2", a few are GPL2 only.
     (license (list license:bsd-3 license:gpl2)))))
 
+(define make-crust-tools
+  (mlambda (platform firmware)
+    (package
+      (inherit firmware)
+      (name (string-append "crust-"
+                           (string-replace-substring platform "_" "-")
+                           "-tools"))
+      (arguments
+       (list #:make-flags
+             #~(list "V=1"
+                     "LEX=flex"
+                     (string-append "HOSTAR=" #$(ar-for-target))
+                     (string-append "HOSTCC=" #$(cc-for-target)))
+             #:phases
+             #~(modify-phases %standard-phases
+                 (add-after 'unpack 'do-not-build-tests
+                   (lambda _
+                     ;; Attempting to build the tools test binary on a
+                     ;; non-aarch64 architecture fails with: "No cache
+                     ;; cleaning implementation available for this
+                     ;; architecture".  Avoid building it (see:
+                     ;; https://github.com/crust-firmware/crust/issues/182).
+                     (substitute* "tools/Makefile"
+                       (("tools-y \\+= test") ""))))
+                 (replace 'configure
+                   (lambda* (#:key inputs native-inputs #:allow-other-keys)
+                     (copy-file (search-input-file inputs "/libexec/.config")
+                                ".config")))
+                 (replace 'build
+                   (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
+                     (apply invoke "make" "tools"
+                            `(,@(if parallel-build?
+                                    `("-j" ,(number->string (parallel-job-count)))
+                                     '())
+                              ,@make-flags))))
+                 (replace 'install
+                   (lambda _
+                     (install-file "build/tools/load"
+                                   (string-append #$output "/bin")))))))
+      (synopsis "System control processor firmware for Allwinner sunxi boards (tools)")
+      (inputs (list firmware)))))
+
 (define-public crust-pinebook
   (make-crust-package "pinebook"))
 
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Tue, 09 Jan 2024 23:16:05 GMT) Full text and rfc822 format available.

Message #29 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: guix-patches <at> gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 8/8] gnu: make-crust-package: Unite firmware and tools.
Date: Wed, 10 Jan 2024 00:14:42 +0100
* gnu/packages/firmware.scm (make-crust-package): Perform union of
  make-crust-firmware and make-crust-tools.

* gnu/packages/firmware.scm (make-crust-firmware): New procedure.

Change-Id: I687bb6d53aae9bd60ed988baf9d17e92f31faa7b
---
 gnu/packages/firmware.scm | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index c3deab5224..71444f190d 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1190,11 +1190,12 @@ (define-public arm-trusted-firmware-imx8mq
           ;; Adding debug symbols causes the size to exceed limits.
           #~(delete "DEBUG=1" #$flags)))))))
 
-(define make-crust-package
+(define make-crust-firmware
   (mlambda (platform)
     (package
       (name (string-append "crust-"
-                           (string-replace-substring platform "_" "-")))
+                           (string-replace-substring platform "_" "-")
+                           "-firmware"))
       (version "0.6")
       (source
        (origin
@@ -1287,6 +1288,29 @@ (define make-crust-tools
       (synopsis "System control processor firmware for Allwinner sunxi boards (tools)")
       (inputs (list firmware)))))
 
+(define make-crust-package
+  (mlambda (platform)
+    (let* ((firmware (make-crust-firmware platform))
+           (tools (make-crust-tools platform firmware)))
+      (package
+        (inherit firmware)
+        (name (string-append "crust-"
+                             (string-replace-substring platform "_" "-")))
+        (source #f)
+        (build-system trivial-build-system)
+        (arguments
+         (list #:modules '((guix build union))
+               #:builder
+               #~(begin
+                   (use-modules (ice-9 match)
+                                (guix build union))
+
+                   (match %build-inputs
+                     (((names . directory) ...)
+                      (union-build #$output directory))))))
+        (native-inputs '())
+        (inputs (list firmware tools))))))
+
 (define-public crust-pinebook
   (make-crust-package "pinebook"))
 
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 12 Jan 2024 20:23:01 GMT) Full text and rfc822 format available.

Message #32 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, 68355 <at> debbugs.gnu.org,
 Simon Tournier <zimon.toutoune <at> gmail.com>,
 Ludovic Courtès <ludo <at> gnu.org>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>, Ricardo Wurmus <rekado <at> elephly.net>,
 Christopher Baines <guix <at> cbaines.net>
Subject: Re: [bug#68355] [PATCH 1/8] guix: Add ork1-elf platform.
Date: Fri, 12 Jan 2024 21:22:14 +0100
Hello,

This looks good and I have only cosmetic remarks.

> * Makefile.am (MODULES): Add guix/platforms/or1k.scm.
>
> * doc/guix.texi: Document or1k-elf platform.

No new line between those commit log entries.

Thanks,

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 12 Jan 2024 20:26:02 GMT) Full text and rfc822 format available.

Message #35 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 68355 <at> debbugs.gnu.org
Subject: Re: [bug#68355] [PATCH 2/8] gnu: cross-gcc-toolchain: Use fixed name.
Date: Fri, 12 Jan 2024 21:25:45 +0100
> * gnu/packages/cross-base.scm (cross-gcc-toolchain) <name>: Always use
>   gcc-cross- prefix regardless of TARGET having a C standard library or
>   not.
  ^
  no alignment here

> -    (name (string-append (package-name xgcc) "-toolchain"))
> +    ;; Using PACKAGE-NAME of XGCC is avoided here as there are platforms that still
> +    ;; need a toolchain but don't have a libc.

There is a 78 columns limit. If you are using Emacs, you can enable
whitespace mode to display the characters that are over the limit, then
use `fill-paragraph` to have Emacs fix it for you.

Thanks,

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 12 Jan 2024 20:27:01 GMT) Full text and rfc822 format available.

Message #38 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Cc: Vagrant Cascadian <vagrant <at> debian.org>, 68355 <at> debbugs.gnu.org,
 Efraim Flashner <efraim <at> flashner.co.il>
Subject: Re: [bug#68355] [PATCH 5/8] gnu: make-crust-package: Update to 0.6.
Date: Fri, 12 Jan 2024 21:26:38 +0100
> * gnu/packages/firmware.scm (make-crust-package): Update to 0.6.
>

No new line.

> * gnu/packages/firmware.scm (make-crust-package): Do not install host
>   tool as it is not built by default.
  ^
  no indent

here and in other patches.

Thanks,

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 12 Jan 2024 20:31:02 GMT) Full text and rfc822 format available.

Message #41 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Cc: Vagrant Cascadian <vagrant <at> debian.org>, 68355 <at> debbugs.gnu.org,
 Efraim Flashner <efraim <at> flashner.co.il>
Subject: Re: [bug#68355] [PATCH 7/8] gnu: Add make-crust-tools.
Date: Fri, 12 Jan 2024 21:30:35 +0100
>  
> +                 (replace 'configure
> +                   (lambda* (#:key inputs native-inputs #:allow-other-keys)
> +                     (copy-file (search-input-file inputs "/libexec/.config")
> +                                ".config")))
> +                 (replace 'build
> +                   (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
> +                     (apply invoke "make" "tools"
> +                            `(,@(if parallel-build?
> +                                    `("-j" ,(number->string (parallel-job-count)))
> +                                     '())
> +                              ,@make-flags))))

Please wrap everything above the 78 columns limit.

> +                 (replace 'install
> +                   (lambda _
> +                     (install-file "build/tools/load"
> +                                   (string-append #$output "/bin")))))))
> +      (synopsis "System control processor firmware for Allwinner sunxi boards (tools)")

This synopsis is too long (>= 80 characters). Fixing it implies to fix
the one of make-crust-firmware I guess.

Thanks,

Mathieu




Information forwarded to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 19 Jan 2024 13:56:02 GMT) Full text and rfc822 format available.

Message #44 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 68355 <at> debbugs.gnu.org
Cc: othacehe <at> gnu.org, Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v2 1/9] guix: Add ork1-elf platform.
Date: Fri, 19 Jan 2024 14:54:40 +0100
* doc/guix.texi: Document or1k-elf platform.
* guix/platforms/or1k.scm (or1k-elf): New variable.
* Makefile.am (MODULES): Add guix/platforms/or1k.scm.

Change-Id: I3f71a0fa97f1ebd2bbdbf6cd00a93b477a123648
---
 Makefile.am             |  1 +
 doc/guix.texi           |  6 ++++++
 guix/platforms/or1k.scm | 28 ++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+)
 create mode 100644 guix/platforms/or1k.scm

diff --git a/Makefile.am b/Makefile.am
index d3b9532c7a..bdc97498aa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -140,6 +140,7 @@ MODULES =					\
   guix/platforms/arm.scm                        \
   guix/platforms/avr.scm                        \
   guix/platforms/mips.scm                       \
+  guix/platforms/or1k.scm                       \
   guix/platforms/powerpc.scm                    \
   guix/platforms/riscv.scm                      \
   guix/platforms/x86.scm                        \
diff --git a/doc/guix.texi b/doc/guix.texi
index ac17f91f7d..df6ce91736 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -16903,6 +16903,7 @@ Cross-Compilation
    - i686-linux-gnu
    - i686-w64-mingw32
    - mips64el-linux-gnu
+   - or1k-elf
    - powerpc-linux-gnu
    - powerpc64le-linux-gnu
    - riscv64-linux-gnu
@@ -46167,6 +46168,11 @@ Supported Platforms
 from AVR Libc.
 @end defvar
 
+@defvar or1k-elf
+Platform targeting OpenRISC 1000 CPU without an operating system and without a
+C standard library.
+@end defvar
+
 @node System Images
 @chapter Creating System Images
 
diff --git a/guix/platforms/or1k.scm b/guix/platforms/or1k.scm
new file mode 100644
index 0000000000..bf983085c5
--- /dev/null
+++ b/guix/platforms/or1k.scm
@@ -0,0 +1,28 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2024 Foundation Devices, Inc. <hello <at> foundationdevices.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix platforms or1k)
+  #:use-module (guix platform)
+  #:use-module (guix records)
+  #:export (or1k-elf))
+
+(define or1k-elf
+  (platform
+   (target "or1k-elf")
+   (system #f)
+   (glibc-dynamic-linker #f)))

base-commit: 0eadd486484fcf9a234758842f74ba28361640db
-- 
2.41.0





Information forwarded to ludo <at> gnu.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 19 Jan 2024 13:56:02 GMT) Full text and rfc822 format available.

Message #47 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 68355 <at> debbugs.gnu.org
Cc: othacehe <at> gnu.org, Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v2 2/9] gnu: cross-gcc-toolchain: Use fixed name.
Date: Fri, 19 Jan 2024 14:54:41 +0100
* gnu/packages/cross-base.scm (cross-gcc-toolchain) <name>: Always use
gcc-cross- prefix regardless of TARGET having a C standard library or not.

Change-Id: I5cbe89c61e5bd324a385db17c27131ea5ef75669
---
 gnu/packages/cross-base.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 6ee7b315d8..2d79e0acf6 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -745,7 +745,9 @@ (define* (cross-gcc-toolchain/implementation target
   "Returns PACKAGE that contains a cross-compilation tool chain for TARGET
 with XBINUTILS, XGCC and LIBC (if exists for TARGET)."
   (package
-    (name (string-append (package-name xgcc) "-toolchain"))
+    ;; Using PACKAGE-NAME of XGCC is avoided here as there are platforms that
+    ;; still need a toolchain but don't have a libc (e.g. or1k-elf).
+    (name (string-append "gcc-cross-" target "-toolchain"))
     (version (package-version xgcc))
     (source #f)
     (build-system trivial-build-system)
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 19 Jan 2024 13:56:03 GMT) Full text and rfc822 format available.

Message #50 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 68355 <at> debbugs.gnu.org
Cc: othacehe <at> gnu.org, Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v2 3/9] gnu: Add gcc-cross-or1k-elf-toolchain.
Date: Fri, 19 Jan 2024 14:54:42 +0100
* gnu/packages/cross-toolchain.scm (gcc-cross-or1k-elf-toolchain): New
variable.

Change-Id: Iaf7ed60dbbe116a5efbad8e94be9b2dee51faf15
---
 gnu/packages/cross-toolchain.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/packages/cross-toolchain.scm b/gnu/packages/cross-toolchain.scm
index ab071e1005..5072462cbb 100644
--- a/gnu/packages/cross-toolchain.scm
+++ b/gnu/packages/cross-toolchain.scm
@@ -38,5 +38,8 @@ (define-public gcc-cross-avr-toolchain
 (define-public gcc-cross-i686-w64-mingw32-toolchain
   (cross-gcc-toolchain "i686-w64-mingw32"))
 
+(define-public gcc-cross-or1k-elf-toolchain
+  (cross-gcc-toolchain "or1k-elf"))
+
 (define-public gcc-cross-x86_64-w64-mingw32-toolchain
   (cross-gcc-toolchain "x86_64-w64-mingw32"))
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 19 Jan 2024 13:56:03 GMT) Full text and rfc822 format available.

Message #53 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 68355 <at> debbugs.gnu.org
Cc: othacehe <at> gnu.org, Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v2 4/9] gnu: make-crust-package: Use shorter synopsis.
Date: Fri, 19 Jan 2024 14:54:43 +0100
* gnu/packages/firmware.scm (make-crust-package) <synopsis>: Make it
short.

Change-Id: I8b93b25a9a6a75aaa92ffa590d0fd46a5511fd49
---
 gnu/packages/firmware.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 75294fadf4..533cbca550 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1270,7 +1270,7 @@ (define (make-crust-package platform)
            (cross-binutils "or1k-elf")
            flex))
     (home-page "https://github.com/crust-firmware/crust")
-    (synopsis "System control processor firmware for Allwinner sunxi boards")
+    (synopsis "Firmware for Allwinner sunxi SoCs")
     (description "Crust improves battery life and thermal performance by
 implementing a deep sleep state.  During deep sleep, the CPU cores, the DRAM
 controller, and most onboard peripherals are powered down, reducing power
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 19 Jan 2024 13:56:03 GMT) Full text and rfc822 format available.

Message #56 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 68355 <at> debbugs.gnu.org
Cc: othacehe <at> gnu.org, Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v2 5/9] gnu: make-crust-package: Memoize.
Date: Fri, 19 Jan 2024 14:54:44 +0100
* gnu/packages/firmware.scm (make-crust-package): Use mlambda.

Change-Id: I2d916b96bc650f3731a69505e086cf8f8f470809
---
 gnu/packages/firmware.scm | 155 +++++++++++++++++++-------------------
 1 file changed, 78 insertions(+), 77 deletions(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 533cbca550..eb5251de5e 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1197,81 +1197,82 @@ (define-public arm-trusted-firmware-imx8mq
           ;; Adding debug symbols causes the size to exceed limits.
           #~(delete "DEBUG=1" #$flags)))))))
 
-(define (make-crust-package platform)
-  (package
-    (name (string-append "crust-"
-                         (string-replace-substring platform "_" "-")))
-    (version "0.5")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             ;; There are only GitHub generated release snapshots.
-             (url "https://github.com/crust-firmware/crust")
-             (commit (string-append "v" version))))
-       (file-name (git-file-name "crust" version))
-       (sha256
-        (base32
-         "0xgbbhifg3miwd3yp6jq9kp7nqgz5gzy00w95vba45j8jk5vjvvz"))))
-    (build-system gnu-build-system)
-    (arguments
-     (list
-      #:tests? #f                       ;no test suite
-      #:make-flags
-      (let ((triplet-without-vendor
-             (and (%current-target-system)
-                  ;; TODO: Is there a use case for allowing this?
-                  (not (target-avr?))
-                  (match (string-split (nix-system->gnu-triplet
-                                        (%current-target-system)) #\-)
-                    ((arch vendor os ..1)
-                     (string-join `(,arch ,@os) "-"))))))
-        #~(list "CROSS_COMPILE=or1k-elf-"
-                "V=1"
-                #$@(if triplet-without-vendor
-                       ;; We are cross-compiling the tools, intended to be
-                       ;; executable for the target system.
-                       (list (string-append "HOSTAR=" triplet-without-vendor
-                                            "-ar")
-                             (string-append "HOSTCC=" triplet-without-vendor
-                                            "-gcc"))
-                       ;; Not cross-compiling.
-                       (list "HOSTAR=ar"
-                             "HOSTCC=gcc"))
-                "LEX=flex"))
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-after 'unpack 'do-not-build-tests
-            (lambda _
-              ;; Attempting to build the tools test binary on a non-aarch64
-              ;; architecture fails with: "No cache cleaning implementation
-              ;; available for this architecture".  Avoid building it (see:
-              ;; https://github.com/crust-firmware/crust/issues/182).
-              (substitute* "tools/Makefile"
-                (("tools-y \\+= test") ""))))
-          (delete 'configure)
-          (add-before 'build 'defconfig
-            (lambda* (#:key make-flags #:allow-other-keys)
-              (let ((config-name (string-append #$platform "_defconfig")))
-                (apply invoke "make" (cons config-name make-flags)))))
-          (replace 'install
-            (lambda _
-              (for-each (lambda (file)
-                          (install-file file (string-append #$output
-                                                            "/libexec")))
-                        (find-files "." "(scp\\.bin|\\.config)$"))
-              (install-file "build/tools/load"
-                            (string-append #$output "/bin")))))))
-    ;; The firmware is cross-compiled using a "bare bones" compiler (no libc).
-    ;; Use our own tool chain for that.
-    (native-inputs
-     (list bison
-           (cross-gcc "or1k-elf")
-           (cross-binutils "or1k-elf")
-           flex))
-    (home-page "https://github.com/crust-firmware/crust")
-    (synopsis "Firmware for Allwinner sunxi SoCs")
-    (description "Crust improves battery life and thermal performance by
+(define make-crust-package
+  (mlambda (platform)
+    (package
+      (name (string-append "crust-"
+                           (string-replace-substring platform "_" "-")))
+      (version "0.5")
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               ;; There are only GitHub generated release snapshots.
+               (url "https://github.com/crust-firmware/crust")
+               (commit (string-append "v" version))))
+         (file-name (git-file-name "crust" version))
+         (sha256
+          (base32
+           "0xgbbhifg3miwd3yp6jq9kp7nqgz5gzy00w95vba45j8jk5vjvvz"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:tests? #f                       ;no test suite
+        #:make-flags
+        (let ((triplet-without-vendor
+               (and (%current-target-system)
+                    ;; TODO: Is there a use case for allowing this?
+                    (not (target-avr?))
+                    (match (string-split (nix-system->gnu-triplet
+                                          (%current-target-system)) #\-)
+                      ((arch vendor os ..1)
+                       (string-join `(,arch ,@os) "-"))))))
+          #~(list "CROSS_COMPILE=or1k-elf-"
+                  "V=1"
+                  #$@(if triplet-without-vendor
+                         ;; We are cross-compiling the tools, intended to be
+                         ;; executable for the target system.
+                         (list (string-append "HOSTAR=" triplet-without-vendor
+                                              "-ar")
+                               (string-append "HOSTCC=" triplet-without-vendor
+                                              "-gcc"))
+                         ;; Not cross-compiling.
+                         (list "HOSTAR=ar"
+                               "HOSTCC=gcc"))
+                  "LEX=flex"))
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'do-not-build-tests
+              (lambda _
+                ;; Attempting to build the tools test binary on a non-aarch64
+                ;; architecture fails with: "No cache cleaning implementation
+                ;; available for this architecture".  Avoid building it (see:
+                ;; https://github.com/crust-firmware/crust/issues/182).
+                (substitute* "tools/Makefile"
+                  (("tools-y \\+= test") ""))))
+            (delete 'configure)
+            (add-before 'build 'defconfig
+              (lambda* (#:key make-flags #:allow-other-keys)
+                (let ((config-name (string-append #$platform "_defconfig")))
+                  (apply invoke "make" (cons config-name make-flags)))))
+            (replace 'install
+              (lambda _
+                (for-each (lambda (file)
+                            (install-file file (string-append #$output
+                                                              "/libexec")))
+                          (find-files "." "(scp\\.bin|\\.config)$"))
+                (install-file "build/tools/load"
+                              (string-append #$output "/bin")))))))
+      ;; The firmware is cross-compiled using a "bare bones" compiler (no libc).
+      ;; Use our own tool chain for that.
+      (native-inputs
+       (list bison
+             (cross-gcc "or1k-elf")
+             (cross-binutils "or1k-elf")
+             flex))
+      (home-page "https://github.com/crust-firmware/crust")
+      (synopsis "Firmware for Allwinner sunxi SoCs")
+      (description "Crust improves battery life and thermal performance by
 implementing a deep sleep state.  During deep sleep, the CPU cores, the DRAM
 controller, and most onboard peripherals are powered down, reducing power
 consumption by 80% or more compared to an idle device.  On boards without a
@@ -1280,8 +1281,8 @@ (define (make-crust-package platform)
 dedicated always-on microprocessor called a System Control Processor (SCP).
 Crust is designed to run on a specific SCP implementation, Allwinner's
 AR100.")
-    ;; Most files are dual-licensed "BSD-3 OR GPL2", a few are GPL2 only.
-    (license (list license:bsd-3 license:gpl2))))
+      ;; Most files are dual-licensed "BSD-3 OR GPL2", a few are GPL2 only.
+      (license (list license:bsd-3 license:gpl2)))))
 
 (define-public crust-pinebook
   (make-crust-package "pinebook"))
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 19 Jan 2024 13:56:04 GMT) Full text and rfc822 format available.

Message #59 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 68355 <at> debbugs.gnu.org
Cc: othacehe <at> gnu.org, Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v2 6/9] gnu: make-crust-package: Update to 0.6.
Date: Fri, 19 Jan 2024 14:54:45 +0100
* gnu/packages/firmware.scm (make-crust-package): Update to 0.6.  Do not
install host tool as it is not built by default.

Change-Id: Ia79ae8208589601d32235f6d8ace9dce3f8d74f9
---
 gnu/packages/firmware.scm | 42 ++++++++-------------------------------
 1 file changed, 8 insertions(+), 34 deletions(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index eb5251de5e..a2e3f785d5 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1202,7 +1202,7 @@ (define make-crust-package
     (package
       (name (string-append "crust-"
                            (string-replace-substring platform "_" "-")))
-      (version "0.5")
+      (version "0.6")
       (source
        (origin
          (method git-fetch)
@@ -1213,43 +1213,19 @@ (define make-crust-package
          (file-name (git-file-name "crust" version))
          (sha256
           (base32
-           "0xgbbhifg3miwd3yp6jq9kp7nqgz5gzy00w95vba45j8jk5vjvvz"))))
+           "1blq6bi2rmg4qqwwr07pamv28b50mwcsybhpn9bws8vbzxa43afd"))))
       (build-system gnu-build-system)
       (arguments
        (list
         #:tests? #f                       ;no test suite
         #:make-flags
-        (let ((triplet-without-vendor
-               (and (%current-target-system)
-                    ;; TODO: Is there a use case for allowing this?
-                    (not (target-avr?))
-                    (match (string-split (nix-system->gnu-triplet
-                                          (%current-target-system)) #\-)
-                      ((arch vendor os ..1)
-                       (string-join `(,arch ,@os) "-"))))))
-          #~(list "CROSS_COMPILE=or1k-elf-"
-                  "V=1"
-                  #$@(if triplet-without-vendor
-                         ;; We are cross-compiling the tools, intended to be
-                         ;; executable for the target system.
-                         (list (string-append "HOSTAR=" triplet-without-vendor
-                                              "-ar")
-                               (string-append "HOSTCC=" triplet-without-vendor
-                                              "-gcc"))
-                         ;; Not cross-compiling.
-                         (list "HOSTAR=ar"
-                               "HOSTCC=gcc"))
-                  "LEX=flex"))
+        #~(list "CROSS_COMPILE=or1k-elf-"
+                "V=1"
+                "HOSTAR=ar"
+                "HOSTCC=gcc"
+                "LEX=flex")
         #:phases
         #~(modify-phases %standard-phases
-            (add-after 'unpack 'do-not-build-tests
-              (lambda _
-                ;; Attempting to build the tools test binary on a non-aarch64
-                ;; architecture fails with: "No cache cleaning implementation
-                ;; available for this architecture".  Avoid building it (see:
-                ;; https://github.com/crust-firmware/crust/issues/182).
-                (substitute* "tools/Makefile"
-                  (("tools-y \\+= test") ""))))
             (delete 'configure)
             (add-before 'build 'defconfig
               (lambda* (#:key make-flags #:allow-other-keys)
@@ -1260,9 +1236,7 @@ (define make-crust-package
                 (for-each (lambda (file)
                             (install-file file (string-append #$output
                                                               "/libexec")))
-                          (find-files "." "(scp\\.bin|\\.config)$"))
-                (install-file "build/tools/load"
-                              (string-append #$output "/bin")))))))
+                          (find-files "." "(scp\\.bin|\\.config)$")))))))
       ;; The firmware is cross-compiled using a "bare bones" compiler (no libc).
       ;; Use our own tool chain for that.
       (native-inputs
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 19 Jan 2024 13:56:04 GMT) Full text and rfc822 format available.

Message #62 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 68355 <at> debbugs.gnu.org
Cc: othacehe <at> gnu.org, Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v2 7/9] gnu: make-crust-package: Use or1k-elf as target.
Date: Fri, 19 Jan 2024 14:54:46 +0100
* gnu/packages/firmware.scm (make-crust-package): Use or1k-elf as the
target.

Change-Id: I6c8bf053527f1e12e35402f18cebf8e75557c788
---
 gnu/packages/firmware.scm | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index a2e3f785d5..129dd0dfdd 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1217,13 +1217,13 @@ (define make-crust-package
       (build-system gnu-build-system)
       (arguments
        (list
+        #:target "or1k-elf"
         #:tests? #f                       ;no test suite
-        #:make-flags
-        #~(list "CROSS_COMPILE=or1k-elf-"
-                "V=1"
-                "HOSTAR=ar"
-                "HOSTCC=gcc"
-                "LEX=flex")
+        #:make-flags #~'("CROSS_COMPILE=or1k-elf-"
+                         "V=1"
+                         "HOSTAR=ar"
+                         "HOSTCC=gcc"
+                         "LEX=flex")
         #:phases
         #~(modify-phases %standard-phases
             (delete 'configure)
@@ -1237,13 +1237,7 @@ (define make-crust-package
                             (install-file file (string-append #$output
                                                               "/libexec")))
                           (find-files "." "(scp\\.bin|\\.config)$")))))))
-      ;; The firmware is cross-compiled using a "bare bones" compiler (no libc).
-      ;; Use our own tool chain for that.
-      (native-inputs
-       (list bison
-             (cross-gcc "or1k-elf")
-             (cross-binutils "or1k-elf")
-             flex))
+      (native-inputs (list bison flex))
       (home-page "https://github.com/crust-firmware/crust")
       (synopsis "Firmware for Allwinner sunxi SoCs")
       (description "Crust improves battery life and thermal performance by
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 19 Jan 2024 13:56:05 GMT) Full text and rfc822 format available.

Message #65 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 68355 <at> debbugs.gnu.org
Cc: othacehe <at> gnu.org, Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v2 8/9] gnu: Add make-crust-tools.
Date: Fri, 19 Jan 2024 14:54:47 +0100
* gnu/packages/firmware.scm (make-crust-tools): New procedure.

Change-Id: Iac05ecf1796e4c10692a423c12423ea9b078d141
---
 gnu/packages/firmware.scm | 44 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 129dd0dfdd..41fe55eb2e 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1252,6 +1252,50 @@ (define make-crust-package
       ;; Most files are dual-licensed "BSD-3 OR GPL2", a few are GPL2 only.
       (license (list license:bsd-3 license:gpl2)))))
 
+(define make-crust-tools
+  (mlambda (platform firmware)
+    (package
+      (inherit firmware)
+      (name (string-append "crust-"
+                           (string-replace-substring platform "_" "-")
+                           "-tools"))
+      (arguments
+       (list #:make-flags
+             #~(list "V=1"
+                     "LEX=flex"
+                     (string-append "HOSTAR=" #$(ar-for-target))
+                     (string-append "HOSTCC=" #$(cc-for-target)))
+             #:phases
+             #~(modify-phases %standard-phases
+                 (add-after 'unpack 'do-not-build-tests
+                   (lambda _
+                     ;; Attempting to build the tools test binary on a
+                     ;; non-aarch64 architecture fails with: "No cache
+                     ;; cleaning implementation available for this
+                     ;; architecture".  Avoid building it (see:
+                     ;; https://github.com/crust-firmware/crust/issues/182).
+                     (substitute* "tools/Makefile"
+                       (("tools-y \\+= test") ""))))
+                 (replace 'configure
+                   (lambda* (#:key inputs native-inputs #:allow-other-keys)
+                     (copy-file (search-input-file inputs "/libexec/.config")
+                                ".config")))
+                 (replace 'build
+                   (lambda* (#:key make-flags parallel-build?
+                             #:allow-other-keys)
+                     (apply invoke "make" "tools"
+                            `(,@(if parallel-build?
+                                    `("-j"
+                                      ,(number->string (parallel-job-count)))
+                                     '())
+                              ,@make-flags))))
+                 (replace 'install
+                   (lambda _
+                     (install-file "build/tools/load"
+                                   (string-append #$output "/bin")))))))
+      (synopsis "Firmware for Allwinner sunxi SoCs (tools)")
+      (inputs (list firmware)))))
+
 (define-public crust-pinebook
   (make-crust-package "pinebook"))
 
-- 
2.41.0





Information forwarded to efraim <at> flashner.co.il, vagrant <at> debian.org, guix-patches <at> gnu.org:
bug#68355; Package guix-patches. (Fri, 19 Jan 2024 13:56:05 GMT) Full text and rfc822 format available.

Message #68 received at 68355 <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 68355 <at> debbugs.gnu.org
Cc: othacehe <at> gnu.org, Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v2 9/9] gnu: make-crust-package: Unite firmware and tools.
Date: Fri, 19 Jan 2024 14:54:48 +0100
* gnu/packages/firmware.scm (make-crust-package): Perform union of
make-crust-firmware and make-crust-tools.
* gnu/packages/firmware.scm (make-crust-firmware): New procedure.

Change-Id: I687bb6d53aae9bd60ed988baf9d17e92f31faa7b
---
 gnu/packages/firmware.scm | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 41fe55eb2e..828bc7402a 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1197,11 +1197,12 @@ (define-public arm-trusted-firmware-imx8mq
           ;; Adding debug symbols causes the size to exceed limits.
           #~(delete "DEBUG=1" #$flags)))))))
 
-(define make-crust-package
+(define make-crust-firmware
   (mlambda (platform)
     (package
       (name (string-append "crust-"
-                           (string-replace-substring platform "_" "-")))
+                           (string-replace-substring platform "_" "-")
+                           "-firmware"))
       (version "0.6")
       (source
        (origin
@@ -1296,6 +1297,29 @@ (define make-crust-tools
       (synopsis "Firmware for Allwinner sunxi SoCs (tools)")
       (inputs (list firmware)))))
 
+(define make-crust-package
+  (mlambda (platform)
+    (let* ((firmware (make-crust-firmware platform))
+           (tools (make-crust-tools platform firmware)))
+      (package
+        (inherit firmware)
+        (name (string-append "crust-"
+                             (string-replace-substring platform "_" "-")))
+        (source #f)
+        (build-system trivial-build-system)
+        (arguments
+         (list #:modules '((guix build union))
+               #:builder
+               #~(begin
+                   (use-modules (ice-9 match)
+                                (guix build union))
+
+                   (match %build-inputs
+                     (((names . directory) ...)
+                      (union-build #$output directory))))))
+        (native-inputs '())
+        (inputs (list firmware tools))))))
+
 (define-public crust-pinebook
   (make-crust-package "pinebook"))
 
-- 
2.41.0





Reply sent to Mathieu Othacehe <othacehe <at> gnu.org>:
You have taken responsibility. (Mon, 22 Jan 2024 10:34:03 GMT) Full text and rfc822 format available.

Notification sent to Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>:
bug acknowledged by developer. (Mon, 22 Jan 2024 10:34:03 GMT) Full text and rfc822 format available.

Message #73 received at 68355-done <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>,
 Simon Tournier <zimon.toutoune <at> gmail.com>,
 Ludovic Courtès <ludo <at> gnu.org>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>, Ricardo Wurmus <rekado <at> elephly.net>,
 68355-done <at> debbugs.gnu.org, Christopher Baines <guix <at> cbaines.net>
Subject: Re: [bug#68355] [PATCH v2 1/9] guix: Add ork1-elf platform.
Date: Mon, 22 Jan 2024 11:32:44 +0100
Hello,

Thanks for the v2, I applied the series.

Mathieu




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 19 Feb 2024 12:24:16 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 171 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.