[PATCH 0/8] guix: Add or1k-elf platform.

  • Done
  • quality assurance status badge
Details
2 participants
  • Jean-Pierre De Jesus DIAZ
  • Mathieu Othacehe
Owner
unassigned
Submitted by
Jean-Pierre De Jesus DIAZ
Severity
normal
J
J
Jean-Pierre De Jesus DIAZ wrote on 10 Jan 2024 00:12
(address . guix-patches@gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
cover.1704841447.git.jean@foundationdevices.com
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 10 Jan 2024 00:14
[PATCH 1/8] guix: Add ork1-elf platform.
(address . guix-patches@gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
577f930d63230d1308c15c10d6cbc50afe973a40.1704841447.git.jean@foundationdevices.com
* 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

Toggle diff (72 lines)
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@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
J
J
Jean-Pierre De Jesus DIAZ wrote on 10 Jan 2024 00:14
[PATCH 2/8] gnu: cross-gcc-toolchain: Use fixed name.
(address . guix-patches@gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
f4750efebd8ba6ea90a614744eebec8140443085.1704841447.git.jean@foundationdevices.com
* 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(-)

Toggle diff (17 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 10 Jan 2024 00:14
[PATCH 3/8] gnu: Add gcc-cross-or1k-elf-toolchain.
(address . guix-patches@gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
0d9f8aafd0d1358ff306e6325c72bf8a94bdd084.1704841447.git.jean@foundationdevices.com
* 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(+)

Toggle diff (15 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 10 Jan 2024 00:14
[PATCH 4/8] gnu: make-crust-package: Memoize.
(address . guix-patches@gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
03b0bc119e7bf279aef49b05078faa08a2534945.1704841447.git.jean@foundationdevices.com
* gnu/packages/firmware.scm (make-crust-package): Use mlambda.

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

Toggle diff (173 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 10 Jan 2024 00:14
[PATCH 5/8] gnu: make-crust-package: Update to 0.6.
(address . guix-patches@gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
ceca70e5e11eea4da7ebf7f6f75059f7e6b2ab0f.1704841447.git.jean@foundationdevices.com
* 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(-)

Toggle diff (76 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 10 Jan 2024 00:14
[PATCH 6/8] gnu: make-crust-package: Use or1k-elf as target.
(address . guix-patches@gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
ccf911abd5f6c728a928e7ce421d9d78cf400d97.1704841447.git.jean@foundationdevices.com
* 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(-)

Toggle diff (41 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 10 Jan 2024 00:14
[PATCH 7/8] gnu: Add make-crust-tools.
(address . guix-patches@gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
06c55ad18bd524cb50b250f1c3c4452702480cf4.1704841447.git.jean@foundationdevices.com
* gnu/packages/firmware.scm (make-crust-tools): New procedure.

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

Toggle diff (55 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 10 Jan 2024 00:14
[PATCH 8/8] gnu: make-crust-package: Unite firmware and tools.
(address . guix-patches@gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
14de180628dedfa8a21d08a0243a76c12b6f7f06.1704841447.git.jean@foundationdevices.com
* 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(-)

Toggle diff (51 lines)
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
M
M
Mathieu Othacehe wrote on 12 Jan 2024 21:22
Re: [bug#68355] [PATCH 1/8] guix: Add ork1-elf platform.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87le8ujo95.fsf@gnu.org
Hello,

This looks good and I have only cosmetic remarks.

Toggle quote (4 lines)
> * 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
M
M
Mathieu Othacehe wrote on 12 Jan 2024 21:25
Re: [bug#68355] [PATCH 2/8] gnu: cross-gcc-toolchain: Use fixed name.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87h6jijo3a.fsf@gnu.org
Toggle quote (3 lines)
> * 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

Toggle quote (4 lines)
> - (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
M
M
Mathieu Othacehe wrote on 12 Jan 2024 21:26
Re: [bug#68355] [PATCH 5/8] gnu: make-crust-package: Update to 0.6.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87cyu6jo1t.fsf@gnu.org
Toggle quote (3 lines)
> * gnu/packages/firmware.scm (make-crust-package): Update to 0.6.
>

No new line.

Toggle quote (2 lines)
> * 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
M
M
Mathieu Othacehe wrote on 12 Jan 2024 21:30
Re: [bug#68355] [PATCH 7/8] gnu: Add make-crust-tools.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
878r4ujnv8.fsf@gnu.org
Toggle quote (13 lines)
>
> + (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.

Toggle quote (6 lines)
> + (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
J
J
Jean-Pierre De Jesus DIAZ wrote on 19 Jan 2024 14:54
[PATCH v2 1/9] guix: Add ork1-elf platform.
(address . 68355@debbugs.gnu.org)
4e6b129a26d38305073c392c04707498a2ddfe69.1705672190.git.jean@foundationdevices.com
* 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

Toggle diff (74 lines)
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@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
J
J
Jean-Pierre De Jesus DIAZ wrote on 19 Jan 2024 14:54
[PATCH v2 2/9] gnu: cross-gcc-toolchain: Use fixed name.
(address . 68355@debbugs.gnu.org)
1a8897818195eb8da2c7b6d03828380cf8999304.1705672190.git.jean@foundationdevices.com
* 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(-)

Toggle diff (17 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 19 Jan 2024 14:54
[PATCH v2 3/9] gnu: Add gcc-cross-or1k-elf-toolchain.
(address . 68355@debbugs.gnu.org)
ce2ecb35fcfc336ffe182a1ec586ded1c0391cdb.1705672190.git.jean@foundationdevices.com
* 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(+)

Toggle diff (15 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 19 Jan 2024 14:54
[PATCH v2 4/9] gnu: make-crust-package: Use shorter synopsis.
(address . 68355@debbugs.gnu.org)
5c98358be6cb8da449c5fa04a57f1ff6c440134d.1705672190.git.jean@foundationdevices.com
* 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(-)

Toggle diff (15 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 19 Jan 2024 14:54
[PATCH v2 5/9] gnu: make-crust-package: Memoize.
(address . 68355@debbugs.gnu.org)
43f09e1afdcc3cb1dbaf44fb7e6cdea24c41bd1d.1705672190.git.jean@foundationdevices.com
* gnu/packages/firmware.scm (make-crust-package): Use mlambda.

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

Toggle diff (175 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 19 Jan 2024 14:54
[PATCH v2 6/9] gnu: make-crust-package: Update to 0.6.
(address . 68355@debbugs.gnu.org)
9cfcd4262f00aabf959c7219243d554023ddcc35.1705672190.git.jean@foundationdevices.com
* 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(-)

Toggle diff (76 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 19 Jan 2024 14:54
[PATCH v2 7/9] gnu: make-crust-package: Use or1k-elf as target.
(address . 68355@debbugs.gnu.org)
e83d3ef2c0a16a313799e8366d21abeb52ef3769.1705672190.git.jean@foundationdevices.com
* 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(-)

Toggle diff (41 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 19 Jan 2024 14:54
[PATCH v2 8/9] gnu: Add make-crust-tools.
(address . 68355@debbugs.gnu.org)
f1957767ada03fdc29bd95a9a18cd315e977569b.1705672190.git.jean@foundationdevices.com
* gnu/packages/firmware.scm (make-crust-tools): New procedure.

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

Toggle diff (57 lines)
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
J
J
Jean-Pierre De Jesus DIAZ wrote on 19 Jan 2024 14:54
[PATCH v2 9/9] gnu: make-crust-package: Unite firmware and tools.
(address . 68355@debbugs.gnu.org)
92e1321694edfd5e3522e991a11a2ba6ece12552.1705672190.git.jean@foundationdevices.com
* 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(-)

Toggle diff (51 lines)
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
M
M
Mathieu Othacehe wrote on 22 Jan 2024 11:32
Re: [bug#68355] [PATCH v2 1/9] guix: Add ork1-elf platform.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87h6j5ejzn.fsf@gnu.org
Hello,

Thanks for the v2, I applied the series.

Mathieu
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 68355@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 68355
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch