GNU bug report logs - #59761
[PATCH 0/2] Add u-boot-ts7970-q-2g-1000mhz-c.

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Fri, 2 Dec 2022 05:30:03 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

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 59761 in the body.
You can then email your comments to 59761 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 guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Fri, 02 Dec 2022 05:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 02 Dec 2022 05:30:03 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 0/2] Add u-boot-ts7970-q-2g-1000mhz-c.
Date: Fri,  2 Dec 2022 00:29:03 -0500
Hello!

This makes our make-u-boot-package procedure more flexible, and builds on it
to add a new U-Boot bootloader package for an i.MX6 embedded board.

Thanks,

Maxim Cournoyer (2):
  gnu: make-u-boot-package: Add a u-boot argument.
  gnu: Add u-boot-ts7970-q-2g-1000mhz-c.

 gnu/packages/bootloaders.scm | 238 +++++++++++++++++++++++------------
 1 file changed, 155 insertions(+), 83 deletions(-)


base-commit: 4781f0458de7419606b71bdf0fe56bca83ace910
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Fri, 02 Dec 2022 05:32:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 1/2] gnu: make-u-boot-package: Add a u-boot argument.
Date: Fri,  2 Dec 2022 00:30:51 -0500
And have that u-boot argument used as the complete base of the template, so
that a user can override it.

* gnu/packages/bootloaders.scm (make-u-boot-package): New U-BOOT argument.
Document it.
[native-inputs]: Move the native-inputs of U-BOOT first, so that the
cross compilation tools can be overridden via U-BOOT.
[arguments]: Rewrite using substitute-keyword-arguments, extending rather than
overriding most arguments.  Use gexps.
---
 gnu/packages/bootloaders.scm | 180 +++++++++++++++++++----------------
 1 file changed, 97 insertions(+), 83 deletions(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 8888c51736..7ec9bbb543 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
 ;;; Copyright © 2021 Stefan <stefan-guix <at> vodafonemail.de>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -782,11 +783,13 @@ (define*-public (make-u-boot-package board triplet
                                      defconfig
                                      configs
                                      name-suffix
-                                     append-description)
+                                     append-description
+                                     (u-boot u-boot))
   "Return a U-Boot package for BOARD cross-compiled for TRIPLET with the
 optional DEFCONFIG file and optional configuration changes from CONFIGS.
 NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
-appended to the package description."
+appended to the package description.  U-BOOT can be used when a fork or a
+different version of U-Boot must be used."
   (let ((same-arch? (lambda ()
                       (string=? (%current-system)
                                 (gnu-triplet->nix-system triplet)))))
@@ -801,90 +804,101 @@ (define*-public (make-u-boot-package board triplet
                                       "\n\n" append-description)
                        (package-description u-boot)))
       (native-inputs
-       `(,@(if (not (same-arch?))
+       ;; Note: leave the native u-boot inputs first, so that a user can
+       ;; override the cross-gcc and cross-binutils packages.
+       `(,@(package-native-inputs u-boot)
+         ,@(if (not (same-arch?))
                `(("cross-gcc" ,(cross-gcc triplet))
                  ("cross-binutils" ,(cross-binutils triplet)))
-               `())
-         ,@(package-native-inputs u-boot)))
+               `())))
       (arguments
-       `(#:modules ((ice-9 ftw)
-                    (srfi srfi-1)
-                    (guix build gnu-build-system)
-                    (guix build kconfig)
-                    (guix build utils))
-         #:imported-modules (,@%gnu-build-system-modules
-                             (guix build kconfig))
-         #:test-target "test"
-         #:make-flags
-         (list "HOSTCC=gcc"
-               ,@(if (not (same-arch?))
-                     `((string-append "CROSS_COMPILE=" ,triplet "-"))
-                     '()))
-         #:phases
-         (modify-phases %standard-phases
-           (replace 'configure
-             (lambda* (#:key outputs make-flags #:allow-other-keys)
-               (let* ((config-name (string-append ,board "_defconfig"))
-                      (config-file (string-append "configs/" config-name))
-                      (defconfig ,defconfig)
-                      (configs ',configs))
-                 (when defconfig
-                   ;; Replace the board-specific defconfig with the given one.
-                   (copy-file defconfig config-file))
-                 (if (file-exists? config-file)
-                     (begin
-                       (when configs
-                         (modify-defconfig config-file configs))
-                       (apply invoke "make" `(,@make-flags ,config-name))
-                       (verify-config ".config" config-file))
-                     (begin
-                       (display "invalid board name; valid board names are:"
-                                (current-error-port))
-                       (let ((suffix-len (string-length "_defconfig"))
-                             (entries (scandir "configs")))
-                         (for-each (lambda (file-name)
-                                     (when (string-suffix? "_defconfig" file-name)
-                                       (format (current-error-port)
-                                               "- ~A\n"
-                                               (string-drop-right file-name
-                                                                  suffix-len))))
-                                   (sort entries string-ci<)))
-                       (error "invalid boardname ~s" ,board))))))
-           (add-after 'configure 'disable-tools-libcrypto
-             ;; Disable libcrypto due to GPL and OpenSSL license
-             ;; incompatibilities
-             (lambda _
-               (substitute* ".config"
-                 (("CONFIG_TOOLS_LIBCRYPTO=.*$") "CONFIG_TOOLS_LIBCRYPTO=n"))))
-           (replace 'install
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let* ((out (assoc-ref outputs "out"))
-                      (libexec (string-append out "/libexec"))
-                      (uboot-files (append
-                                    (remove
-                                     ;; Those would not be reproducible
-                                     ;; because of the randomness used
-                                     ;; to produce them.
-                                     ;; It's expected that the user will
-                                     ;; use u-boot-tools to generate them
-                                     ;; instead.
-                                     (lambda (name)
-                                       (string-suffix?
-                                        "sunxi-spl-with-ecc.bin"
-                                        name))
-                                     (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
-                                    (find-files "." "^(MLO|SPL)$"))))
-                 (mkdir-p libexec)
-                 (install-file ".config" libexec)
-                 ;; Useful for "qemu -kernel".
-                 (install-file "u-boot" libexec)
-                 (for-each
-                  (lambda (file)
-                    (let ((target-file (string-append libexec "/" file)))
-                      (mkdir-p (dirname target-file))
-                      (copy-file file target-file)))
-                  uboot-files)
-                 #t)))))))))
+       (substitute-keyword-arguments (package-arguments u-boot)
+         ((#:modules modules '())
+          `((ice-9 ftw)
+            (srfi srfi-1)
+            (guix build gnu-build-system)
+            (guix build kconfig)
+            (guix build utils)
+            ,@modules))
+         ((#:imported-modules imported-modules '())
+          `((guix build kconfig)
+            ,@%gnu-build-system-modules
+            ,@imported-modules))
+         ((#:test-target _ "test")
+          "test")
+         ((#:make-flags make-flags '())
+          #~(list "HOSTCC=gcc"
+                  #$@(if (not (same-arch?))
+                         (list (string-append "CROSS_COMPILE=" triplet "-"))
+                         '())
+                  #$@make-flags))
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (replace 'configure
+                (lambda* (#:key outputs make-flags #:allow-other-keys)
+                  (let* ((config-name (string-append #$board "_defconfig"))
+                         (config-file (string-append "configs/" config-name))
+                         (defconfig #$defconfig)
+                         (configs '#$configs))
+                    (when defconfig
+                      ;; Replace the board-specific defconfig with the given
+                      ;; one.
+                      (copy-file defconfig config-file))
+                    (if (file-exists? config-file)
+                        (begin
+                          (when configs
+                            (modify-defconfig config-file configs))
+                          (apply invoke "make" `(,@make-flags ,config-name))
+                          (verify-config ".config" config-file))
+                        (begin
+                          (display "invalid board name; valid board names are:"
+                                   (current-error-port))
+                          (let ((suffix-len (string-length "_defconfig"))
+                                (entries (scandir "configs")))
+                            (for-each (lambda (file-name)
+                                        (when (string-suffix? "_defconfig"
+                                                              file-name)
+                                          (format (current-error-port)
+                                                  "- ~A\n"
+                                                  (string-drop-right
+                                                   file-name suffix-len))))
+                                      (sort entries string-ci<)))
+                          (error "invalid boardname ~s" #$board))))))
+              (add-after 'configure 'disable-tools-libcrypto
+                ;; Disable libcrypto due to GPL and OpenSSL license
+                ;; incompatibilities
+                (lambda _
+                  (substitute* ".config"
+                    (("CONFIG_TOOLS_LIBCRYPTO=.*$")
+                     "CONFIG_TOOLS_LIBCRYPTO=n"))))
+              (replace 'install
+                (lambda* (#:key outputs #:allow-other-keys)
+                  (let ((libexec (string-append #$output "/libexec"))
+                        (uboot-files
+                         (append
+                          (remove
+                           ;; Those would not be reproducible
+                           ;; because of the randomness used to
+                           ;; produce them.  It's expected that the
+                           ;; user will use u-boot-tools to generate
+                           ;; them instead.
+                           (lambda (name)
+                             (string-suffix?
+                              "sunxi-spl-with-ecc.bin"
+                              name))
+                           (find-files "."
+                                       ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+                          (find-files "." "^(MLO|SPL)$"))))
+                    (mkdir-p libexec)
+                    (install-file ".config" libexec)
+                    ;; Useful for "qemu -kernel".
+                    (install-file "u-boot" libexec)
+                    (for-each
+                     (lambda (file)
+                       (let ((target-file (string-append libexec "/" file)))
+                         (mkdir-p (dirname target-file))
+                         (copy-file file target-file)))
+                     uboot-files)))))))))))
 
 (define-public u-boot-malta
   (make-u-boot-package "malta" "mips64el-linux-gnuabi64"))
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Fri, 02 Dec 2022 05:32:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 2/2] gnu: Add u-boot-ts7970-q-2g-1000mhz-c.
Date: Fri,  2 Dec 2022 00:30:52 -0500
* gnu/packages/bootloaders.scm (u-boot-ts-mx6): New variable.
(u-boot-ts7970-q-2g-1000mhz-c): Likewise.
---
 gnu/packages/bootloaders.scm | 58 ++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 7ec9bbb543..ed3dace87d 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1271,6 +1271,64 @@ (define-public u-boot-rpi-4-32b-efi-bin
 (define-public u-boot-rpi-arm64-efi-bin
   (make-u-boot-bin-package u-boot-rpi-arm64-efi))
 
+(define u-boot-ts-mx6
+  ;; There is no release; use the latest commit of the
+  ;; 'imx_v2015.04_3.14.52_1.1.0_ga' branch.
+  (let ((revision "0")
+        (commit "344403c64d93813fce8c6d94ed4c3ffb1fe2a181"))
+    (package
+      (inherit u-boot)
+      (name "u-boot-ts-mx6")
+      (version (git-version "2015.04_3" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/embeddedTS/u-boot-imx")
+                      (commit commit)))
+                (file-name (git-file-name "u-boot-imx-ts" version))
+                (sha256
+                 (base32
+                  "081swfz204dsy0nss4r55b8453w766yp2wgrh5y10l3gjc0fkrs1"))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments u-boot)
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'patch-for-reproducibility
+                (lambda _
+                  ;; Substitute dynamically computed timestamps with static
+                  ;; ones.
+                  (substitute* "Makefile"
+                    (("U_BOOT_DATE \"%b %d %C%y\"")
+                     "U_BOOT_DATE \"Jan 01 1969\"")
+                    (("U_BOOT_TIME \"%T\"")
+                     "U_BOOT_TIME \"00:00:00\""))))
+              (add-before 'build 'adjust-for-gcc10
+                (lambda _
+                  (invoke "gcc" "--version")
+                  (copy-file "include/linux/compiler-gcc6.h"
+                             "include/linux/compiler-gcc10.h")
+                  (substitute* "arch/arm/Makefile"
+                    (("march=armv5")
+                     "march=armv5te"))))
+              (add-after 'install 'build+install-tools
+                (lambda* (#:key make-flags #:allow-other-keys)
+                  (apply invoke "make" "tools-all" make-flags)
+                  (invoke "find")
+                  (install-file "tools/env/fw_printenv"
+                                (string-append #$output "/bin"))
+                  (symlink (string-append #$output "/bin/fw_printenv")
+                           (string-append #$output "/bin/fw_setenv"))))))))
+      (native-inputs
+       (modify-inputs (package-native-inputs u-boot)
+         (delete "dtc"))))))            ;otherwise the build fails
+
+(define-public u-boot-ts7970-q-2g-1000mhz-c
+  (make-u-boot-package "ts7970-q-2g-1000mhz-c" "arm-linux-gnueabihf"
+                       #:u-boot u-boot-ts-mx6
+                       #:append-description "This U-Boot variant is for the
+Technologic System TS-7970 revision C board, which includes a quad core
+Freescale i.MX6 CPU and 2 GiB of RAM clocked at 1000MHz."))
+
 (define-public vboot-utils
   (package
     (name "vboot-utils")
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 07 Dec 2022 15:03:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v2 1/3] gnu: make-u-boot-package: Add a u-boot argument.
Date: Wed,  7 Dec 2022 10:01:59 -0500
And have that u-boot argument used as the complete base of the template, so
that a user can override it.

* gnu/packages/bootloaders.scm (make-u-boot-package): New U-BOOT argument.
Document it.
[native-inputs]: Move the native-inputs of U-BOOT first, so that the
cross compilation tools can be overridden via U-BOOT.
[arguments]: Rewrite using substitute-keyword-arguments, extending rather than
overriding most arguments.  Use gexps.
---
 gnu/packages/bootloaders.scm | 180 +++++++++++++++++++----------------
 1 file changed, 97 insertions(+), 83 deletions(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 8888c51736..7ec9bbb543 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
 ;;; Copyright © 2021 Stefan <stefan-guix <at> vodafonemail.de>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -782,11 +783,13 @@ (define*-public (make-u-boot-package board triplet
                                      defconfig
                                      configs
                                      name-suffix
-                                     append-description)
+                                     append-description
+                                     (u-boot u-boot))
   "Return a U-Boot package for BOARD cross-compiled for TRIPLET with the
 optional DEFCONFIG file and optional configuration changes from CONFIGS.
 NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
-appended to the package description."
+appended to the package description.  U-BOOT can be used when a fork or a
+different version of U-Boot must be used."
   (let ((same-arch? (lambda ()
                       (string=? (%current-system)
                                 (gnu-triplet->nix-system triplet)))))
@@ -801,90 +804,101 @@ (define*-public (make-u-boot-package board triplet
                                       "\n\n" append-description)
                        (package-description u-boot)))
       (native-inputs
-       `(,@(if (not (same-arch?))
+       ;; Note: leave the native u-boot inputs first, so that a user can
+       ;; override the cross-gcc and cross-binutils packages.
+       `(,@(package-native-inputs u-boot)
+         ,@(if (not (same-arch?))
                `(("cross-gcc" ,(cross-gcc triplet))
                  ("cross-binutils" ,(cross-binutils triplet)))
-               `())
-         ,@(package-native-inputs u-boot)))
+               `())))
       (arguments
-       `(#:modules ((ice-9 ftw)
-                    (srfi srfi-1)
-                    (guix build gnu-build-system)
-                    (guix build kconfig)
-                    (guix build utils))
-         #:imported-modules (,@%gnu-build-system-modules
-                             (guix build kconfig))
-         #:test-target "test"
-         #:make-flags
-         (list "HOSTCC=gcc"
-               ,@(if (not (same-arch?))
-                     `((string-append "CROSS_COMPILE=" ,triplet "-"))
-                     '()))
-         #:phases
-         (modify-phases %standard-phases
-           (replace 'configure
-             (lambda* (#:key outputs make-flags #:allow-other-keys)
-               (let* ((config-name (string-append ,board "_defconfig"))
-                      (config-file (string-append "configs/" config-name))
-                      (defconfig ,defconfig)
-                      (configs ',configs))
-                 (when defconfig
-                   ;; Replace the board-specific defconfig with the given one.
-                   (copy-file defconfig config-file))
-                 (if (file-exists? config-file)
-                     (begin
-                       (when configs
-                         (modify-defconfig config-file configs))
-                       (apply invoke "make" `(,@make-flags ,config-name))
-                       (verify-config ".config" config-file))
-                     (begin
-                       (display "invalid board name; valid board names are:"
-                                (current-error-port))
-                       (let ((suffix-len (string-length "_defconfig"))
-                             (entries (scandir "configs")))
-                         (for-each (lambda (file-name)
-                                     (when (string-suffix? "_defconfig" file-name)
-                                       (format (current-error-port)
-                                               "- ~A\n"
-                                               (string-drop-right file-name
-                                                                  suffix-len))))
-                                   (sort entries string-ci<)))
-                       (error "invalid boardname ~s" ,board))))))
-           (add-after 'configure 'disable-tools-libcrypto
-             ;; Disable libcrypto due to GPL and OpenSSL license
-             ;; incompatibilities
-             (lambda _
-               (substitute* ".config"
-                 (("CONFIG_TOOLS_LIBCRYPTO=.*$") "CONFIG_TOOLS_LIBCRYPTO=n"))))
-           (replace 'install
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let* ((out (assoc-ref outputs "out"))
-                      (libexec (string-append out "/libexec"))
-                      (uboot-files (append
-                                    (remove
-                                     ;; Those would not be reproducible
-                                     ;; because of the randomness used
-                                     ;; to produce them.
-                                     ;; It's expected that the user will
-                                     ;; use u-boot-tools to generate them
-                                     ;; instead.
-                                     (lambda (name)
-                                       (string-suffix?
-                                        "sunxi-spl-with-ecc.bin"
-                                        name))
-                                     (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
-                                    (find-files "." "^(MLO|SPL)$"))))
-                 (mkdir-p libexec)
-                 (install-file ".config" libexec)
-                 ;; Useful for "qemu -kernel".
-                 (install-file "u-boot" libexec)
-                 (for-each
-                  (lambda (file)
-                    (let ((target-file (string-append libexec "/" file)))
-                      (mkdir-p (dirname target-file))
-                      (copy-file file target-file)))
-                  uboot-files)
-                 #t)))))))))
+       (substitute-keyword-arguments (package-arguments u-boot)
+         ((#:modules modules '())
+          `((ice-9 ftw)
+            (srfi srfi-1)
+            (guix build gnu-build-system)
+            (guix build kconfig)
+            (guix build utils)
+            ,@modules))
+         ((#:imported-modules imported-modules '())
+          `((guix build kconfig)
+            ,@%gnu-build-system-modules
+            ,@imported-modules))
+         ((#:test-target _ "test")
+          "test")
+         ((#:make-flags make-flags '())
+          #~(list "HOSTCC=gcc"
+                  #$@(if (not (same-arch?))
+                         (list (string-append "CROSS_COMPILE=" triplet "-"))
+                         '())
+                  #$@make-flags))
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (replace 'configure
+                (lambda* (#:key outputs make-flags #:allow-other-keys)
+                  (let* ((config-name (string-append #$board "_defconfig"))
+                         (config-file (string-append "configs/" config-name))
+                         (defconfig #$defconfig)
+                         (configs '#$configs))
+                    (when defconfig
+                      ;; Replace the board-specific defconfig with the given
+                      ;; one.
+                      (copy-file defconfig config-file))
+                    (if (file-exists? config-file)
+                        (begin
+                          (when configs
+                            (modify-defconfig config-file configs))
+                          (apply invoke "make" `(,@make-flags ,config-name))
+                          (verify-config ".config" config-file))
+                        (begin
+                          (display "invalid board name; valid board names are:"
+                                   (current-error-port))
+                          (let ((suffix-len (string-length "_defconfig"))
+                                (entries (scandir "configs")))
+                            (for-each (lambda (file-name)
+                                        (when (string-suffix? "_defconfig"
+                                                              file-name)
+                                          (format (current-error-port)
+                                                  "- ~A\n"
+                                                  (string-drop-right
+                                                   file-name suffix-len))))
+                                      (sort entries string-ci<)))
+                          (error "invalid boardname ~s" #$board))))))
+              (add-after 'configure 'disable-tools-libcrypto
+                ;; Disable libcrypto due to GPL and OpenSSL license
+                ;; incompatibilities
+                (lambda _
+                  (substitute* ".config"
+                    (("CONFIG_TOOLS_LIBCRYPTO=.*$")
+                     "CONFIG_TOOLS_LIBCRYPTO=n"))))
+              (replace 'install
+                (lambda* (#:key outputs #:allow-other-keys)
+                  (let ((libexec (string-append #$output "/libexec"))
+                        (uboot-files
+                         (append
+                          (remove
+                           ;; Those would not be reproducible
+                           ;; because of the randomness used to
+                           ;; produce them.  It's expected that the
+                           ;; user will use u-boot-tools to generate
+                           ;; them instead.
+                           (lambda (name)
+                             (string-suffix?
+                              "sunxi-spl-with-ecc.bin"
+                              name))
+                           (find-files "."
+                                       ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+                          (find-files "." "^(MLO|SPL)$"))))
+                    (mkdir-p libexec)
+                    (install-file ".config" libexec)
+                    ;; Useful for "qemu -kernel".
+                    (install-file "u-boot" libexec)
+                    (for-each
+                     (lambda (file)
+                       (let ((target-file (string-append libexec "/" file)))
+                         (mkdir-p (dirname target-file))
+                         (copy-file file target-file)))
+                     uboot-files)))))))))))
 
 (define-public u-boot-malta
   (make-u-boot-package "malta" "mips64el-linux-gnuabi64"))

base-commit: d4c2ea9226c229e56022ba641100ee7f5db8f53f
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 07 Dec 2022 15:03:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v2 2/3] gnu: make-u-boot-package: Install .imx files.
Date: Wed,  7 Dec 2022 10:02:00 -0500
* gnu/packages/bootloaders.scm
(make-u-boot-package) [phases] <install>: Add imx to the regexp of files
considered for installation.
---
 gnu/packages/bootloaders.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 7ec9bbb543..ab2cf06fd5 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -887,7 +887,7 @@ (define*-public (make-u-boot-package board triplet
                               "sunxi-spl-with-ecc.bin"
                               name))
                            (find-files "."
-                                       ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+                                       ".*\\.(bin|efi|img|imx|spl|itb|dtb|rksd)$"))
                           (find-files "." "^(MLO|SPL)$"))))
                     (mkdir-p libexec)
                     (install-file ".config" libexec)
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 07 Dec 2022 15:03:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v2 3/3] gnu: Add u-boot-ts7970-q-2g-1000mhz-c.
Date: Wed,  7 Dec 2022 10:02:01 -0500
* gnu/packages/bootloaders.scm (u-boot-ts-mx6): New variable.
(u-boot-ts7970-q-2g-1000mhz-c): Likewise.
---
 gnu/packages/bootloaders.scm | 59 ++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index ab2cf06fd5..28a85eeca5 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1271,6 +1271,65 @@ (define-public u-boot-rpi-4-32b-efi-bin
 (define-public u-boot-rpi-arm64-efi-bin
   (make-u-boot-bin-package u-boot-rpi-arm64-efi))
 
+(define u-boot-ts-mx6
+  ;; There is no release; use the latest commit of the
+  ;; 'imx_v2015.04_3.14.52_1.1.0_ga' branch.
+  (let ((revision "0")
+        (commit "344403c64d93813fce8c6d94ed4c3ffb1fe2a181"))
+    (package
+      (inherit u-boot)
+      (name "u-boot-ts-mx6")
+      (version (git-version "2015.04_3" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/embeddedTS/u-boot-imx")
+                      (commit commit)))
+                (file-name (git-file-name "u-boot-imx-ts" version))
+                (sha256
+                 (base32
+                  "081swfz204dsy0nss4r55b8453w766yp2wgrh5y10l3gjc0fkrs1"))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments u-boot)
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'patch-for-reproducibility
+                (lambda _
+                  ;; Substitute dynamically computed timestamps with static
+                  ;; ones.
+                  (substitute* "Makefile"
+                    (("U_BOOT_DATE \"%b %d %C%y\"")
+                     "U_BOOT_DATE \"Jan 01 1969\"")
+                    (("U_BOOT_TIME \"%T\"")
+                     "U_BOOT_TIME \"00:00:00\""))))
+              (add-before 'build 'adjust-for-gcc10
+                (lambda _
+                  (invoke "gcc" "--version")
+                  (copy-file "include/linux/compiler-gcc6.h"
+                             "include/linux/compiler-gcc10.h")
+                  (substitute* "arch/arm/Makefile"
+                    (("march=armv5")
+                     "march=armv5te"))))
+              (add-after 'install 'build+install-tools
+                (lambda* (#:key make-flags #:allow-other-keys)
+                  (apply invoke "make" "tools-all" make-flags)
+                  (install-file "tools/env/fw_printenv"
+                                (string-append #$output "/bin"))
+                  (symlink (string-append #$output "/bin/fw_printenv")
+                           (string-append #$output "/bin/fw_setenv"))))))))
+      (native-inputs
+       (modify-inputs (package-native-inputs u-boot)
+         (delete "dtc"))))))            ;otherwise the build fails
+
+(define-public u-boot-ts7970-q-2g-1000mhz-c
+  (make-u-boot-package "ts7970-q-2g-1000mhz-c" "arm-linux-gnueabihf"
+                       #:u-boot u-boot-ts-mx6
+                       #:append-description
+                       "This U-Boot variant is for the Technologic Systems
+TS-7970 revision C board, which includes a quad core Freescale i.MX6 CPU and 2
+GiB of RAM clocked at 1000MHz.  The binary U-Boot image to flash is the
+@file{libexec/u-boot.imx} file."))
+
 (define-public vboot-utils
   (package
     (name "vboot-utils")
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 14 Dec 2022 02:33:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 1/4] gnu: make-u-boot-package: Add a u-boot argument.
Date: Tue, 13 Dec 2022 21:32:33 -0500
And have that u-boot argument used as the complete base of the template, so
that a user can override it.

* gnu/packages/bootloaders.scm (make-u-boot-package): New U-BOOT argument.
Document it.
[native-inputs]: Move the native-inputs of U-BOOT first, so that the
cross compilation tools can be overridden via U-BOOT.
[arguments]: Rewrite using substitute-keyword-arguments, extending rather than
overriding most arguments.  Use gexps.
---
 gnu/packages/bootloaders.scm | 180 +++++++++++++++++++----------------
 1 file changed, 97 insertions(+), 83 deletions(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 8888c51736..7ec9bbb543 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
 ;;; Copyright © 2021 Stefan <stefan-guix <at> vodafonemail.de>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -782,11 +783,13 @@ (define*-public (make-u-boot-package board triplet
                                      defconfig
                                      configs
                                      name-suffix
-                                     append-description)
+                                     append-description
+                                     (u-boot u-boot))
   "Return a U-Boot package for BOARD cross-compiled for TRIPLET with the
 optional DEFCONFIG file and optional configuration changes from CONFIGS.
 NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
-appended to the package description."
+appended to the package description.  U-BOOT can be used when a fork or a
+different version of U-Boot must be used."
   (let ((same-arch? (lambda ()
                       (string=? (%current-system)
                                 (gnu-triplet->nix-system triplet)))))
@@ -801,90 +804,101 @@ (define*-public (make-u-boot-package board triplet
                                       "\n\n" append-description)
                        (package-description u-boot)))
       (native-inputs
-       `(,@(if (not (same-arch?))
+       ;; Note: leave the native u-boot inputs first, so that a user can
+       ;; override the cross-gcc and cross-binutils packages.
+       `(,@(package-native-inputs u-boot)
+         ,@(if (not (same-arch?))
                `(("cross-gcc" ,(cross-gcc triplet))
                  ("cross-binutils" ,(cross-binutils triplet)))
-               `())
-         ,@(package-native-inputs u-boot)))
+               `())))
       (arguments
-       `(#:modules ((ice-9 ftw)
-                    (srfi srfi-1)
-                    (guix build gnu-build-system)
-                    (guix build kconfig)
-                    (guix build utils))
-         #:imported-modules (,@%gnu-build-system-modules
-                             (guix build kconfig))
-         #:test-target "test"
-         #:make-flags
-         (list "HOSTCC=gcc"
-               ,@(if (not (same-arch?))
-                     `((string-append "CROSS_COMPILE=" ,triplet "-"))
-                     '()))
-         #:phases
-         (modify-phases %standard-phases
-           (replace 'configure
-             (lambda* (#:key outputs make-flags #:allow-other-keys)
-               (let* ((config-name (string-append ,board "_defconfig"))
-                      (config-file (string-append "configs/" config-name))
-                      (defconfig ,defconfig)
-                      (configs ',configs))
-                 (when defconfig
-                   ;; Replace the board-specific defconfig with the given one.
-                   (copy-file defconfig config-file))
-                 (if (file-exists? config-file)
-                     (begin
-                       (when configs
-                         (modify-defconfig config-file configs))
-                       (apply invoke "make" `(,@make-flags ,config-name))
-                       (verify-config ".config" config-file))
-                     (begin
-                       (display "invalid board name; valid board names are:"
-                                (current-error-port))
-                       (let ((suffix-len (string-length "_defconfig"))
-                             (entries (scandir "configs")))
-                         (for-each (lambda (file-name)
-                                     (when (string-suffix? "_defconfig" file-name)
-                                       (format (current-error-port)
-                                               "- ~A\n"
-                                               (string-drop-right file-name
-                                                                  suffix-len))))
-                                   (sort entries string-ci<)))
-                       (error "invalid boardname ~s" ,board))))))
-           (add-after 'configure 'disable-tools-libcrypto
-             ;; Disable libcrypto due to GPL and OpenSSL license
-             ;; incompatibilities
-             (lambda _
-               (substitute* ".config"
-                 (("CONFIG_TOOLS_LIBCRYPTO=.*$") "CONFIG_TOOLS_LIBCRYPTO=n"))))
-           (replace 'install
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let* ((out (assoc-ref outputs "out"))
-                      (libexec (string-append out "/libexec"))
-                      (uboot-files (append
-                                    (remove
-                                     ;; Those would not be reproducible
-                                     ;; because of the randomness used
-                                     ;; to produce them.
-                                     ;; It's expected that the user will
-                                     ;; use u-boot-tools to generate them
-                                     ;; instead.
-                                     (lambda (name)
-                                       (string-suffix?
-                                        "sunxi-spl-with-ecc.bin"
-                                        name))
-                                     (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
-                                    (find-files "." "^(MLO|SPL)$"))))
-                 (mkdir-p libexec)
-                 (install-file ".config" libexec)
-                 ;; Useful for "qemu -kernel".
-                 (install-file "u-boot" libexec)
-                 (for-each
-                  (lambda (file)
-                    (let ((target-file (string-append libexec "/" file)))
-                      (mkdir-p (dirname target-file))
-                      (copy-file file target-file)))
-                  uboot-files)
-                 #t)))))))))
+       (substitute-keyword-arguments (package-arguments u-boot)
+         ((#:modules modules '())
+          `((ice-9 ftw)
+            (srfi srfi-1)
+            (guix build gnu-build-system)
+            (guix build kconfig)
+            (guix build utils)
+            ,@modules))
+         ((#:imported-modules imported-modules '())
+          `((guix build kconfig)
+            ,@%gnu-build-system-modules
+            ,@imported-modules))
+         ((#:test-target _ "test")
+          "test")
+         ((#:make-flags make-flags '())
+          #~(list "HOSTCC=gcc"
+                  #$@(if (not (same-arch?))
+                         (list (string-append "CROSS_COMPILE=" triplet "-"))
+                         '())
+                  #$@make-flags))
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (replace 'configure
+                (lambda* (#:key outputs make-flags #:allow-other-keys)
+                  (let* ((config-name (string-append #$board "_defconfig"))
+                         (config-file (string-append "configs/" config-name))
+                         (defconfig #$defconfig)
+                         (configs '#$configs))
+                    (when defconfig
+                      ;; Replace the board-specific defconfig with the given
+                      ;; one.
+                      (copy-file defconfig config-file))
+                    (if (file-exists? config-file)
+                        (begin
+                          (when configs
+                            (modify-defconfig config-file configs))
+                          (apply invoke "make" `(,@make-flags ,config-name))
+                          (verify-config ".config" config-file))
+                        (begin
+                          (display "invalid board name; valid board names are:"
+                                   (current-error-port))
+                          (let ((suffix-len (string-length "_defconfig"))
+                                (entries (scandir "configs")))
+                            (for-each (lambda (file-name)
+                                        (when (string-suffix? "_defconfig"
+                                                              file-name)
+                                          (format (current-error-port)
+                                                  "- ~A\n"
+                                                  (string-drop-right
+                                                   file-name suffix-len))))
+                                      (sort entries string-ci<)))
+                          (error "invalid boardname ~s" #$board))))))
+              (add-after 'configure 'disable-tools-libcrypto
+                ;; Disable libcrypto due to GPL and OpenSSL license
+                ;; incompatibilities
+                (lambda _
+                  (substitute* ".config"
+                    (("CONFIG_TOOLS_LIBCRYPTO=.*$")
+                     "CONFIG_TOOLS_LIBCRYPTO=n"))))
+              (replace 'install
+                (lambda* (#:key outputs #:allow-other-keys)
+                  (let ((libexec (string-append #$output "/libexec"))
+                        (uboot-files
+                         (append
+                          (remove
+                           ;; Those would not be reproducible
+                           ;; because of the randomness used to
+                           ;; produce them.  It's expected that the
+                           ;; user will use u-boot-tools to generate
+                           ;; them instead.
+                           (lambda (name)
+                             (string-suffix?
+                              "sunxi-spl-with-ecc.bin"
+                              name))
+                           (find-files "."
+                                       ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+                          (find-files "." "^(MLO|SPL)$"))))
+                    (mkdir-p libexec)
+                    (install-file ".config" libexec)
+                    ;; Useful for "qemu -kernel".
+                    (install-file "u-boot" libexec)
+                    (for-each
+                     (lambda (file)
+                       (let ((target-file (string-append libexec "/" file)))
+                         (mkdir-p (dirname target-file))
+                         (copy-file file target-file)))
+                     uboot-files)))))))))))
 
 (define-public u-boot-malta
   (make-u-boot-package "malta" "mips64el-linux-gnuabi64"))

base-commit: 0ffa501f2b3e83ae56e9c2bd31418439090e869a
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 14 Dec 2022 02:33:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 4/4] gnu: Add u-boot-ts7970-q-2g-1000mhz-c-bootloader.
Date: Tue, 13 Dec 2022 21:32:36 -0500
* gnu/bootloader/u-boot.scm (u-boot-ts7970-q-2g-1000mhz-c-bootloader): New
variable.
---
 gnu/bootloader/u-boot.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 6cad33b741..65d7923465 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe <at> gmail.com>
 ;;; Copyright © 2020 Julien Lepiller <julien <at> lepiller.eu>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -42,6 +43,7 @@ (define-module (gnu bootloader u-boot)
             u-boot-puma-rk3399-bootloader
             u-boot-rock64-rk3328-bootloader
             u-boot-rockpro64-rk3399-bootloader
+            u-boot-ts7970-q-2g-1000mhz-c-bootloader
             u-boot-wandboard-bootloader))
 
 (define install-u-boot
@@ -127,6 +129,12 @@ (define install-rockpro64-rk3399-u-boot
 
 (define install-pinebook-pro-rk3399-u-boot install-rockpro64-rk3399-u-boot)
 
+(define install-u-boot-ts7970-q-2g-1000mhz-c-u-boot
+  #~(lambda (bootloader device mount-point)
+      (let ((u-boot.imx (string-append bootloader "/libexec/u-boot.imx"))
+            (install-dir (string-append mount-point "/boot")))
+        (install-file u-boot.imx install-dir))))
+
 
 
 ;;;
@@ -255,3 +263,13 @@ (define u-boot-pinebook-pro-rk3399-bootloader
    (inherit u-boot-bootloader)
    (package u-boot-pinebook-pro-rk3399)
    (disk-image-installer install-pinebook-pro-rk3399-u-boot)))
+
+(define u-boot-ts7970-q-2g-1000mhz-c-bootloader
+  ;; This bootloader doesn't really need to be installed, as it is read from
+  ;; an SPI memory chip, not the SD card.  It is copied to /boot/u-boot.imx
+  ;; for convenience and should be manually flashed at the U-Boot prompt.
+  (bootloader
+   (inherit u-boot-bootloader)
+   (package u-boot-ts7970-q-2g-1000mhz-c)
+   (installer install-u-boot-ts7970-q-2g-1000mhz-c-u-boot)
+   (disk-image-installer #f)))
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 14 Dec 2022 02:33:03 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 2/4] gnu: make-u-boot-package: Install .imx files.
Date: Tue, 13 Dec 2022 21:32:34 -0500
* gnu/packages/bootloaders.scm
(make-u-boot-package) [phases] <install>: Add imx to the regexp of files
considered for installation.
---
 gnu/packages/bootloaders.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 7ec9bbb543..ab2cf06fd5 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -887,7 +887,7 @@ (define*-public (make-u-boot-package board triplet
                               "sunxi-spl-with-ecc.bin"
                               name))
                            (find-files "."
-                                       ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+                                       ".*\\.(bin|efi|img|imx|spl|itb|dtb|rksd)$"))
                           (find-files "." "^(MLO|SPL)$"))))
                     (mkdir-p libexec)
                     (install-file ".config" libexec)
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 14 Dec 2022 02:33:03 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 3/4] gnu: Add u-boot-ts7970-q-2g-1000mhz-c.
Date: Tue, 13 Dec 2022 21:32:35 -0500
* gnu/packages/bootloaders.scm (u-boot-ts-mx6): New variable.
(u-boot-ts7970-q-2g-1000mhz-c): Likewise.
---
 gnu/packages/bootloaders.scm | 150 +++++++++++++++++++++++++++++++++++
 1 file changed, 150 insertions(+)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index ab2cf06fd5..02c1c1a17a 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1271,6 +1271,156 @@ (define-public u-boot-rpi-4-32b-efi-bin
 (define-public u-boot-rpi-arm64-efi-bin
   (make-u-boot-bin-package u-boot-rpi-arm64-efi))
 
+(define u-boot-ts-mx6
+  ;; There is no release; use the latest commit of the
+  ;; 'imx_v2015.04_3.14.52_1.1.0_ga' branch.
+  (let ((revision "0")
+        (commit "344403c64d93813fce8c6d94ed4c3ffb1fe2a181"))
+    (package
+      (inherit u-boot)
+      (name "u-boot-ts-mx6")
+      (version (git-version "2015.04_3" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/embeddedTS/u-boot-imx")
+                      (commit commit)))
+                (file-name (git-file-name "u-boot-imx-ts" version))
+                (sha256
+                 (base32
+                  "081swfz204dsy0nss4r55b8453w766yp2wgrh5y10l3gjc0fkrs1"))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments u-boot)
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'patch-u-boot
+                (lambda _
+                  (substitute* (find-files "include/configs" "^ts[0-9]{4}\\.h$")
+                    ;; Default to boot a standard zImage instead of a uImage.
+                    (("/boot/uImage")
+                     "/boot/zImage")
+                    (("uimage")
+                     "zimage")
+                    (("bootm \\$\\{loadaddr}")
+                     "bootz ${loadaddr}")
+                    ;; This reference DTB is not available in mainline.
+                    (("ts7970-revf.dtb")
+                     "ts7970.dtb")
+                    ;; Enable support for DISTRO_DEFAULTS, which enables to
+                    ;; use 'sysboot' to boot Guix System.  Also enable
+                    ;; "standard" boot commands for dealing with discovery and
+                    ;; booting of syslinux configurations (extlinux.conf).
+
+                    ;; Disable the stock CONFIG_BOOTCOMMAND to avoid a
+                    ;; redefinition error.
+                    (("CONFIG_BOOTCOMMAND")
+                     "CONFIG_BOOTCOMMAND_DISABLED")
+                    (("CONFIG_BOOTDELAY")
+                     "CONFIG_BOOTDELAY_DISABLED")
+                    ;; Inspired by include/configs/embestmx6boards.h
+                    (("#define CONFIG_EXTRA_ENV_SETTINGS.*" anchor)
+                     (string-append
+                      "#include <config_distro_defaults.h>\n\n"
+                      "#define MEM_LAYOUT_ENV_SETTINGS \\\n"
+                      "	\"bootm_size=0x10000000\\0\" \\\n"
+                      "	\"kernel_addr_r=0x10800000\\0\" \\\n"
+                      "	\"fdt_addr_r=0x18000000\\0\" \\\n"
+                      "	\"scriptaddr=0x18100000\\0\" \\\n"
+                      "	\"pxefile_addr_r=0x18200000\\0\" \\\n"
+                      "	\"ramdisk_addr_r=0x18300000\\0\"\n\n"
+                      "#define BOOT_TARGET_DEVICES(func) \\\n"
+                      "	func(MMC, mmc, 0) \\\n"
+                      "	func(MMC, mmc, 1) \\\n"
+                      "	func(SATA, sata, 0) \\\n"
+                      "	func(USB, usb, 0) \\\n"
+                      "	func(PXE, pxe, na) \\\n"
+                      "	func(DHCP, dhcp, na)\n\n"
+                      "#include <config_distro_bootcmd.h>\n\n"
+                      anchor
+                      ;; Sadly, the user config CONFIG_DEFAULT_FDT_FILE did
+                      ;; not exist in that older U-Boot, a placeholder is
+                      ;; added here, to be substituted in each TS U-Boot board
+                      ;; package.
+                      "        \"fdtfile=DEFAULT_FDT_FILE\\0\" \\\n"
+                      "        MEM_LAYOUT_ENV_SETTINGS \\\n"
+                      "        BOOTENV \\\n")))))
+              (add-after 'unpack 'patch-for-reproducibility
+                (lambda _
+                  ;; Substitute dynamically computed timestamps with static
+                  ;; ones.
+                  (substitute* "Makefile"
+                    (("U_BOOT_DATE \"%b %d %C%y\"")
+                     "U_BOOT_DATE \"Jan 01 1969\"")
+                    (("U_BOOT_TIME \"%T\"")
+                     "U_BOOT_TIME \"00:00:00\""))))
+              (add-before 'build 'adjust-for-gcc10
+                (lambda _
+                  (copy-file "include/linux/compiler-gcc6.h"
+                             "include/linux/compiler-gcc10.h")
+                  (substitute* "arch/arm/Makefile"
+                    (("march=armv5")
+                     "march=armv5te"))))
+              (add-after 'install 'build+install-tools
+                (lambda* (#:key make-flags #:allow-other-keys)
+                  ;; Apply a trivial patch not backported from mainline to fix
+                  ;; cross-compilation of tools (see:
+                  ;; https://source.denx.de/u-boot/u-boot/-/commit/
+                  ;; 3b0825296aeba69c2cbfd3e179db2e9cbe5e70d7).
+                  (substitute* '("tools/Makefile" "tools/env/Makefile")
+                    (("^HOSTCC = \\$\\(CC)" all)
+                     (string-append "override " all)))
+                  (apply invoke "make" "tools-all" make-flags)
+                  (install-file "tools/env/fw_printenv"
+                                (string-append #$output "/bin"))
+                  (symlink (string-append #$output "/bin/fw_printenv")
+                           (string-append #$output "/bin/fw_setenv"))))))))
+      (native-inputs
+       (modify-inputs (package-native-inputs u-boot)
+         (delete "dtc"))))))            ;otherwise the build fails
+
+(define-public u-boot-ts7970-q-2g-1000mhz-c
+  (let ((base
+         (make-u-boot-package "ts7970-q-2g-1000mhz-c" "arm-linux-gnueabihf"
+                              #:u-boot u-boot-ts-mx6
+                              #:append-description
+                              "This U-Boot variant is for the Technologic
+Systems TS-7970 revision C board, which includes a quad core Freescale i.MX6
+CPU and 2 GiB of RAM clocked at 1000MHz.  The binary U-Boot image to flash is
+the @file{libexec/u-boot.imx} file.  It can be used with the @file{zImage} and
+the @file{imx6q-ts7970.dtb} files provided by the
+@code{linux-libre-arm-generic} image.
+
+To flash this bootloader, write it to an SD card, then using the U-Boot serial
+console:
+@example
+mmc dev 0
+load mmc 0:1 ${loadaddr} /u-boot.imx
+sf probe
+sf erase 0 0x80000
+sf write ${loadaddr} 0x400 $filesize
+@end example
+
+The factory values of U-Boot must also be reset so that it boots using a
+zImage instead of the default uImage:
+@example
+run clearenv
+reset
+@end example
+
+For more information, refer to
+@url{https://docs.embeddedts.com/TS-7970#Update_U-Boot}.")))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (add-after 'patch-u-boot 'set-default-fdt-file
+                (lambda _
+                  (substitute* "include/configs/ts7970.h"
+                    (("DEFAULT_FDT_FILE")
+                     "imx6q-ts7970.dtb")))))))))))
+
 (define-public vboot-utils
   (package
     (name "vboot-utils")
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Tue, 20 Dec 2022 18:23:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v4 1/2] gnu: Add u-boot-ts7970-q-2g-1000mhz-c.
Date: Tue, 20 Dec 2022 13:22:34 -0500
* gnu/packages/bootloaders.scm (u-boot-ts-mx6): New variable.
(u-boot-ts7970-q-2g-1000mhz-c): Likewise.
---

(no changes since v1)

 gnu/packages/bootloaders.scm | 150 +++++++++++++++++++++++++++++++++++
 1 file changed, 150 insertions(+)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 738f3975f5..545803ece1 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1251,6 +1251,156 @@ (define-public u-boot-rpi-4-32b-efi-bin
 (define-public u-boot-rpi-arm64-efi-bin
   (make-u-boot-bin-package u-boot-rpi-arm64-efi))
 
+(define u-boot-ts-mx6
+  ;; There is no release; use the latest commit of the
+  ;; 'imx_v2015.04_3.14.52_1.1.0_ga' branch.
+  (let ((revision "0")
+        (commit "344403c64d93813fce8c6d94ed4c3ffb1fe2a181"))
+    (package
+      (inherit u-boot)
+      (name "u-boot-ts-mx6")
+      (version (git-version "2015.04_3" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/embeddedTS/u-boot-imx")
+                      (commit commit)))
+                (file-name (git-file-name "u-boot-imx-ts" version))
+                (sha256
+                 (base32
+                  "081swfz204dsy0nss4r55b8453w766yp2wgrh5y10l3gjc0fkrs1"))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments u-boot)
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'patch-u-boot
+                (lambda _
+                  (substitute* (find-files "include/configs" "^ts[0-9]{4}\\.h$")
+                    ;; Default to boot a standard zImage instead of a uImage.
+                    (("/boot/uImage")
+                     "/boot/zImage")
+                    (("uimage")
+                     "zimage")
+                    (("bootm \\$\\{loadaddr}")
+                     "bootz ${loadaddr}")
+                    ;; This reference DTB is not available in mainline.
+                    (("ts7970-revf.dtb")
+                     "ts7970.dtb")
+                    ;; Enable support for DISTRO_DEFAULTS, which enables to
+                    ;; use 'sysboot' to boot Guix System.  Also enable
+                    ;; "standard" boot commands for dealing with discovery and
+                    ;; booting of syslinux configurations (extlinux.conf).
+
+                    ;; Disable the stock CONFIG_BOOTCOMMAND to avoid a
+                    ;; redefinition error.
+                    (("CONFIG_BOOTCOMMAND")
+                     "CONFIG_BOOTCOMMAND_DISABLED")
+                    (("CONFIG_BOOTDELAY")
+                     "CONFIG_BOOTDELAY_DISABLED")
+                    ;; Inspired by include/configs/embestmx6boards.h
+                    (("#define CONFIG_EXTRA_ENV_SETTINGS.*" anchor)
+                     (string-append
+                      "#include <config_distro_defaults.h>\n\n"
+                      "#define MEM_LAYOUT_ENV_SETTINGS \\\n"
+                      "	\"bootm_size=0x10000000\\0\" \\\n"
+                      "	\"kernel_addr_r=0x10800000\\0\" \\\n"
+                      "	\"fdt_addr_r=0x18000000\\0\" \\\n"
+                      "	\"scriptaddr=0x18100000\\0\" \\\n"
+                      "	\"pxefile_addr_r=0x18200000\\0\" \\\n"
+                      "	\"ramdisk_addr_r=0x18300000\\0\"\n\n"
+                      "#define BOOT_TARGET_DEVICES(func) \\\n"
+                      "	func(MMC, mmc, 0) \\\n"
+                      "	func(MMC, mmc, 1) \\\n"
+                      "	func(SATA, sata, 0) \\\n"
+                      "	func(USB, usb, 0) \\\n"
+                      "	func(PXE, pxe, na) \\\n"
+                      "	func(DHCP, dhcp, na)\n\n"
+                      "#include <config_distro_bootcmd.h>\n\n"
+                      anchor
+                      ;; Sadly, the user config CONFIG_DEFAULT_FDT_FILE did
+                      ;; not exist in that older U-Boot, a placeholder is
+                      ;; added here, to be substituted in each TS U-Boot board
+                      ;; package.
+                      "        \"fdtfile=DEFAULT_FDT_FILE\\0\" \\\n"
+                      "        MEM_LAYOUT_ENV_SETTINGS \\\n"
+                      "        BOOTENV \\\n")))))
+              (add-after 'unpack 'patch-for-reproducibility
+                (lambda _
+                  ;; Substitute dynamically computed timestamps with static
+                  ;; ones.
+                  (substitute* "Makefile"
+                    (("U_BOOT_DATE \"%b %d %C%y\"")
+                     "U_BOOT_DATE \"Jan 01 1969\"")
+                    (("U_BOOT_TIME \"%T\"")
+                     "U_BOOT_TIME \"00:00:00\""))))
+              (add-before 'build 'adjust-for-gcc10
+                (lambda _
+                  (copy-file "include/linux/compiler-gcc6.h"
+                             "include/linux/compiler-gcc10.h")
+                  (substitute* "arch/arm/Makefile"
+                    (("march=armv5")
+                     "march=armv5te"))))
+              (add-after 'install 'build+install-tools
+                (lambda* (#:key make-flags #:allow-other-keys)
+                  ;; Apply a trivial patch not backported from mainline to fix
+                  ;; cross-compilation of tools (see:
+                  ;; https://source.denx.de/u-boot/u-boot/-/commit/
+                  ;; 3b0825296aeba69c2cbfd3e179db2e9cbe5e70d7).
+                  (substitute* '("tools/Makefile" "tools/env/Makefile")
+                    (("^HOSTCC = \\$\\(CC)" all)
+                     (string-append "override " all)))
+                  (apply invoke "make" "tools-all" make-flags)
+                  (install-file "tools/env/fw_printenv"
+                                (string-append #$output "/bin"))
+                  (symlink (string-append #$output "/bin/fw_printenv")
+                           (string-append #$output "/bin/fw_setenv"))))))))
+      (native-inputs
+       (modify-inputs (package-native-inputs u-boot)
+         (delete "dtc"))))))            ;otherwise the build fails
+
+(define-public u-boot-ts7970-q-2g-1000mhz-c
+  (let ((base
+         (make-u-boot-package "ts7970-q-2g-1000mhz-c" "arm-linux-gnueabihf"
+                              #:u-boot u-boot-ts-mx6
+                              #:append-description
+                              "This U-Boot variant is for the Technologic
+Systems TS-7970 revision C board, which includes a quad core Freescale i.MX6
+CPU and 2 GiB of RAM clocked at 1000MHz.  The binary U-Boot image to flash is
+the @file{libexec/u-boot.imx} file.  It can be used with the @file{zImage} and
+the @file{imx6q-ts7970.dtb} files provided by the
+@code{linux-libre-arm-generic} image.
+
+To flash this bootloader, write it to an SD card, then using the U-Boot serial
+console:
+@example
+mmc dev 0
+load mmc 0:1 ${loadaddr} /u-boot.imx
+sf probe
+sf erase 0 0x80000
+sf write ${loadaddr} 0x400 $filesize
+@end example
+
+The factory values of U-Boot must also be reset so that it boots using a
+zImage instead of the default uImage:
+@example
+run clearenv
+reset
+@end example
+
+For more information, refer to
+@url{https://docs.embeddedts.com/TS-7970#Update_U-Boot}.")))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (add-after 'patch-u-boot 'set-default-fdt-file
+                (lambda _
+                  (substitute* "include/configs/ts7970.h"
+                    (("DEFAULT_FDT_FILE")
+                     "imx6q-ts7970.dtb")))))))))))
+
 (define-public vboot-utils
   (package
     (name "vboot-utils")

base-commit: daaef7858ffe2d0eb0378670a6447400410d1ff9
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Tue, 20 Dec 2022 18:23:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v4 2/2] gnu: Add u-boot-ts7970-q-2g-1000mhz-c-bootloader.
Date: Tue, 20 Dec 2022 13:22:35 -0500
* gnu/bootloader/u-boot.scm (u-boot-ts7970-q-2g-1000mhz-c-bootloader): New
variable.

---

Changes in v4:
- Rebase on top of #60224 and master

 gnu/bootloader/u-boot.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 6cad33b741..65d7923465 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe <at> gmail.com>
 ;;; Copyright © 2020 Julien Lepiller <julien <at> lepiller.eu>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -42,6 +43,7 @@ (define-module (gnu bootloader u-boot)
             u-boot-puma-rk3399-bootloader
             u-boot-rock64-rk3328-bootloader
             u-boot-rockpro64-rk3399-bootloader
+            u-boot-ts7970-q-2g-1000mhz-c-bootloader
             u-boot-wandboard-bootloader))
 
 (define install-u-boot
@@ -127,6 +129,12 @@ (define install-rockpro64-rk3399-u-boot
 
 (define install-pinebook-pro-rk3399-u-boot install-rockpro64-rk3399-u-boot)
 
+(define install-u-boot-ts7970-q-2g-1000mhz-c-u-boot
+  #~(lambda (bootloader device mount-point)
+      (let ((u-boot.imx (string-append bootloader "/libexec/u-boot.imx"))
+            (install-dir (string-append mount-point "/boot")))
+        (install-file u-boot.imx install-dir))))
+
 
 
 ;;;
@@ -255,3 +263,13 @@ (define u-boot-pinebook-pro-rk3399-bootloader
    (inherit u-boot-bootloader)
    (package u-boot-pinebook-pro-rk3399)
    (disk-image-installer install-pinebook-pro-rk3399-u-boot)))
+
+(define u-boot-ts7970-q-2g-1000mhz-c-bootloader
+  ;; This bootloader doesn't really need to be installed, as it is read from
+  ;; an SPI memory chip, not the SD card.  It is copied to /boot/u-boot.imx
+  ;; for convenience and should be manually flashed at the U-Boot prompt.
+  (bootloader
+   (inherit u-boot-bootloader)
+   (package u-boot-ts7970-q-2g-1000mhz-c)
+   (installer install-u-boot-ts7970-q-2g-1000mhz-c-u-boot)
+   (disk-image-installer #f)))
-- 
2.38.1





Added blocking bug(s) 60224 Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 20 Dec 2022 18:36:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Thu, 29 Dec 2022 19:39:02 GMT) Full text and rfc822 format available.

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

From: Ricardo Wurmus <rekado <at> elephly.net>
To: 59761 <at> debbugs.gnu.org
Subject: [PATCH 0/2] Add u-boot-ts7970-q-2g-1000mhz-c.
Date: Thu, 29 Dec 2022 20:33:16 +0100
Hi Maxim,

there seems to be some overlap between this and
https://issues.guix.gnu.org/60224.  Looking just at v4 I only have one
comment.

In your substitute* replacements it’s better not to use string-append.
You can include real line breaks in a string and escape line breaks with
\.  This is preferable to gluing strings together.  For something as
long as the replacements in this package consider using a patch file
instead.  This has the added advantage of failing the build when the
patch cannot be applied cleanly.

The rest looks good to me.

-- 
Ricardo




Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 04 Jan 2023 04:18:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 59761 <at> debbugs.gnu.org
Subject: Re: bug#59761: [PATCH 0/2] Add u-boot-ts7970-q-2g-1000mhz-c.
Date: Tue, 03 Jan 2023 23:17:00 -0500
Hi Ricardo,

Ricardo Wurmus <rekado <at> elephly.net> writes:

> Hi Maxim,
>
> there seems to be some overlap between this and
> https://issues.guix.gnu.org/60224.

Yes, I ended up splitting my changes focusing on u-boot in #60224, which
should be reviewed before and blocking this change here, which is based
on it.

> Looking just at v4 I only have one
> comment.
>
> In your substitute* replacements it’s better not to use string-append.

Oh?  Why is this so?  There must be hundreds of string-append occurences
used in such place, so I'm curious.

> You can include real line breaks in a string and escape line breaks with
> \.  This is preferable to gluing strings together.

OK, I guess this is your rationale for the above comment (cleaner).

> For something as
> long as the replacements in this package consider using a patch file
> instead.  This has the added advantage of failing the build when the
> patch cannot be applied cleanly.

I agree that a patch would be most suitable here, especially that if
something breaks, if would likely be silent (unlikely to be caught at
build time).  I'll extract this as a patch.

> The rest looks good to me.

OK.  I'll await your comments on #60224, which is awaiting feedback
post-rework based on your earlier feedback.

PS: I had also missed that email; please keep me in CC in all your
replies :-).

-- 
Thanks,
Maxim




Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 04 Jan 2023 05:33:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v5 1/2] gnu: Add u-boot-ts7970-q-2g-1000mhz-c.
Date: Wed,  4 Jan 2023 00:32:33 -0500
* gnu/packages/bootloaders.scm (u-boot-ts-mx6): New variable.
(u-boot-ts7970-q-2g-1000mhz-c): Likewise.

---

Changes in v5:
- Update package revision to 08809160fbc60d6e949fa9d37d9a41aab8fef742
- Refactor patch-u-boot phase to use single string blocks
- Drop upstreamed patch in build+install-tools phase

 gnu/packages/bootloaders.scm | 148 +++++++++++++++++++++++++++++++++++
 1 file changed, 148 insertions(+)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 7016b33f4f..22c15d13f1 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1339,6 +1339,154 @@ (define-public u-boot-rpi-4-32b-efi-bin
 (define-public u-boot-rpi-arm64-efi-bin
   (make-u-boot-bin-package u-boot-rpi-arm64-efi))
 
+(define u-boot-ts-mx6
+  ;; There is no release; use the latest commit of the
+  ;; 'imx_v2015.04_3.14.52_1.1.0_ga' branch.
+  (let ((revision "0")
+        (commit "08809160fbc60d6e949fa9d37d9a41aab8fef742"))
+    (package
+      (inherit u-boot)
+      (name "u-boot-ts-mx6")
+      (version (git-version "2015.04_3" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/embeddedTS/u-boot-imx")
+                      (commit commit)))
+                (file-name (git-file-name "u-boot-imx-ts" version))
+                (sha256
+                 (base32
+                  "01mja33351hkcs59rmfvppqlxqw4rh9gng7a7hx2cfspqwh2y6kr"))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments u-boot)
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'patch-u-boot
+                (lambda _
+                  (substitute* (find-files "include/configs" "^ts[0-9]{4}\\.h$")
+                    ;; Default to boot a standard zImage instead of a uImage.
+                    (("/boot/uImage")
+                     "/boot/zImage")
+                    (("uimage")
+                     "zimage")
+                    (("bootm \\$\\{loadaddr}")
+                     "bootz ${loadaddr}")
+                    ;; This reference DTB is not available in mainline.
+                    (("ts7970-revf.dtb")
+                     "ts7970.dtb")
+                    ;; Enable support for DISTRO_DEFAULTS, which enables to
+                    ;; use 'sysboot' to boot Guix System.  Also enable
+                    ;; "standard" boot commands for dealing with discovery and
+                    ;; booting of syslinux configurations (extlinux.conf).
+
+                    ;; Disable the stock CONFIG_BOOTCOMMAND to avoid a
+                    ;; redefinition error.
+                    (("CONFIG_BOOTCOMMAND")
+                     "CONFIG_BOOTCOMMAND_DISABLED")
+                    (("CONFIG_BOOTDELAY")
+                     "CONFIG_BOOTDELAY_DISABLED")
+                    ;; Inspired by include/configs/embestmx6boards.h
+                    (("#define CONFIG_EXTRA_ENV_SETTINGS.*" anchor)
+                     (string-append "\
+#include <config_distro_defaults.h>
+
+#define MEM_LAYOUT_ENV_SETTINGS    \\
+\t\"bootm_size=0x10000000\\0\"     \\
+\t\"kernel_addr_r=0x10800000\\0\"  \\
+\t\"fdt_addr_r=0x18000000\\0\"     \\
+\t\"scriptaddr=0x18100000\\0\"     \\
+\t\"pxefile_addr_r=0x18200000\\0\" \\
+\t\"ramdisk_addr_r=0x18300000\\0\"
+
+#define BOOT_TARGET_DEVICES(func)  \\
+\tfunc(MMC, mmc, 0)                \\
+\tfunc(MMC, mmc, 1)                \\
+\tfunc(SATA, sata, 0)              \\
+\tfunc(USB, usb, 0)                \\
+\tfunc(PXE, pxe, na)               \\
+\tfunc(DHCP, dhcp, na)
+
+#include <config_distro_bootcmd.h>
+
+" anchor
+
+;; Sadly, the user config CONFIG_DEFAULT_FDT_FILE did not exist in that older
+;; U-Boot.  A placeholder is added here, to be substituted in each TS U-Boot
+;; board package.
+"\
+\t\"fdtfile=DEFAULT_FDT_FILE\\0\" \\
+\tMEM_LAYOUT_ENV_SETTINGS \\
+\tBOOTENV \\\n")))))
+              (add-after 'unpack 'patch-for-reproducibility
+                (lambda _
+                  ;; Substitute dynamically computed timestamps with static
+                  ;; ones.
+                  (substitute* "Makefile"
+                    (("U_BOOT_DATE \"%b %d %C%y\"")
+                     "U_BOOT_DATE \"Jan 01 1969\"")
+                    (("U_BOOT_TIME \"%T\"")
+                     "U_BOOT_TIME \"00:00:00\""))))
+              (add-before 'build 'adjust-for-gcc10
+                (lambda _
+                  (copy-file "include/linux/compiler-gcc6.h"
+                             "include/linux/compiler-gcc10.h")
+                  (substitute* "arch/arm/Makefile"
+                    (("march=armv5")
+                     "march=armv5te"))))
+              (add-after 'install 'build+install-tools
+                (lambda* (#:key make-flags #:allow-other-keys)
+                  (apply invoke "make" "tools-all" make-flags)
+                  (install-file "tools/env/fw_printenv"
+                                (string-append #$output "/bin"))
+                  (symlink (string-append #$output "/bin/fw_printenv")
+                           (string-append #$output "/bin/fw_setenv"))))))))
+      (native-inputs
+       (modify-inputs (package-native-inputs u-boot)
+         (delete "dtc"))))))            ;otherwise the build fails
+
+(define-public u-boot-ts7970-q-2g-1000mhz-c
+  (let ((base
+         (make-u-boot-package "ts7970-q-2g-1000mhz-c" "arm-linux-gnueabihf"
+                              #:u-boot u-boot-ts-mx6
+                              #:append-description
+                              "This U-Boot variant is for the Technologic
+Systems TS-7970 revision C board, which includes a quad core Freescale i.MX6
+CPU and 2 GiB of RAM clocked at 1000MHz.  The binary U-Boot image to flash is
+the @file{libexec/u-boot.imx} file.  It can be used with the @file{zImage} and
+the @file{imx6q-ts7970.dtb} files provided by the
+@code{linux-libre-arm-generic} image.
+
+To flash this bootloader, write it to an SD card, then using the U-Boot serial
+console:
+@example
+mmc dev 0
+load mmc 0:1 ${loadaddr} /u-boot.imx
+sf probe
+sf erase 0 0x80000
+sf write ${loadaddr} 0x400 $filesize
+@end example
+
+The factory values of U-Boot must also be reset so that it boots using a
+zImage instead of the default uImage:
+@example
+run clearenv
+reset
+@end example
+
+For more information, refer to
+@url{https://docs.embeddedts.com/TS-7970#Update_U-Boot}.")))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (add-after 'patch-u-boot 'set-default-fdt-file
+                (lambda _
+                  (substitute* "include/configs/ts7970.h"
+                    (("DEFAULT_FDT_FILE")
+                     "imx6q-ts7970.dtb")))))))))))
+
 (define-public vboot-utils
   (package
     (name "vboot-utils")

base-commit: fef10282afdb97af43d1ec1c0c955a7fdc313e3c
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 04 Jan 2023 05:33:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v5 2/2] gnu: Add u-boot-ts7970-q-2g-1000mhz-c-bootloader.
Date: Wed,  4 Jan 2023 00:32:34 -0500
* gnu/bootloader/u-boot.scm (u-boot-ts7970-q-2g-1000mhz-c-bootloader): New
variable.

---

(no changes since v4)

Changes in v4:
- Rebase on top of #60224 and master

 gnu/bootloader/u-boot.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 6cad33b741..65d7923465 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe <at> gmail.com>
 ;;; Copyright © 2020 Julien Lepiller <julien <at> lepiller.eu>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -42,6 +43,7 @@ (define-module (gnu bootloader u-boot)
             u-boot-puma-rk3399-bootloader
             u-boot-rock64-rk3328-bootloader
             u-boot-rockpro64-rk3399-bootloader
+            u-boot-ts7970-q-2g-1000mhz-c-bootloader
             u-boot-wandboard-bootloader))
 
 (define install-u-boot
@@ -127,6 +129,12 @@ (define install-rockpro64-rk3399-u-boot
 
 (define install-pinebook-pro-rk3399-u-boot install-rockpro64-rk3399-u-boot)
 
+(define install-u-boot-ts7970-q-2g-1000mhz-c-u-boot
+  #~(lambda (bootloader device mount-point)
+      (let ((u-boot.imx (string-append bootloader "/libexec/u-boot.imx"))
+            (install-dir (string-append mount-point "/boot")))
+        (install-file u-boot.imx install-dir))))
+
 
 
 ;;;
@@ -255,3 +263,13 @@ (define u-boot-pinebook-pro-rk3399-bootloader
    (inherit u-boot-bootloader)
    (package u-boot-pinebook-pro-rk3399)
    (disk-image-installer install-pinebook-pro-rk3399-u-boot)))
+
+(define u-boot-ts7970-q-2g-1000mhz-c-bootloader
+  ;; This bootloader doesn't really need to be installed, as it is read from
+  ;; an SPI memory chip, not the SD card.  It is copied to /boot/u-boot.imx
+  ;; for convenience and should be manually flashed at the U-Boot prompt.
+  (bootloader
+   (inherit u-boot-bootloader)
+   (package u-boot-ts7970-q-2g-1000mhz-c)
+   (installer install-u-boot-ts7970-q-2g-1000mhz-c-u-boot)
+   (disk-image-installer #f)))
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 04 Jan 2023 05:35:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 59761 <at> debbugs.gnu.org
Subject: Re: bug#59761: [PATCH 0/2] Add u-boot-ts7970-q-2g-1000mhz-c.
Date: Wed, 04 Jan 2023 00:34:38 -0500
Hi,

Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes:

>> For something as
>> long as the replacements in this package consider using a patch file
>> instead.  This has the added advantage of failing the build when the
>> patch cannot be applied cleanly.
>
> I agree that a patch would be most suitable here, especially that if
> something breaks, if would likely be silent (unlikely to be caught at
> build time).  I'll extract this as a patch.

After re-diving into the code, I opted to kept it as a substitution
given it affects multiple config files in the same way, and would make a
large, redundant patch.  I cleaned it up per your suggestions (see v5).

-- 
Thanks,
Maxim




Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 04 Jan 2023 07:38:02 GMT) Full text and rfc822 format available.

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

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 59761 <at> debbugs.gnu.org
Subject: Re: bug#59761: [PATCH 0/2] Add u-boot-ts7970-q-2g-1000mhz-c.
Date: Wed, 04 Jan 2023 08:35:51 +0100
> PS: I had also missed that email; please keep me in CC in all your
> replies :-).

Oh, that’s odd.  I’m replying “from scratch” going just by the bug
number in issues.guix.gnu.org; it doesn’t expose your email address in a
convenient way, so I usually just grab the issue number and write an
email.

Shouldn’t debbugs Cc you when receiving comments on your patch
submission?

-- 
Ricardo




Information forwarded to guix-patches <at> gnu.org:
bug#59761; Package guix-patches. (Wed, 04 Jan 2023 14:47:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 59761 <at> debbugs.gnu.org
Subject: Re: bug#59761: [PATCH 0/2] Add u-boot-ts7970-q-2g-1000mhz-c.
Date: Wed, 04 Jan 2023 09:46:04 -0500
Hi Ricardo,

Ricardo Wurmus <rekado <at> elephly.net> writes:

>> PS: I had also missed that email; please keep me in CC in all your
>> replies :-).
>
> Oh, that’s odd.  I’m replying “from scratch” going just by the bug
> number in issues.guix.gnu.org; it doesn’t expose your email address in a
> convenient way, so I usually just grab the issue number and write an
> email.
>
> Shouldn’t debbugs Cc you when receiving comments on your patch
> submission?

It would be nice if it did, but I don't think it does.  Also, the
'X-Debbugs-Cc' header used in teams.scm doesn't seem to cause an actual
CC; I think it'd just cause someone not already subscribed to the
guix-patches mailing list to be sent an email.  I think it'd be better
to simply use git-send-email's '--cc', or both.

My Gnus email filter is based on the Return-Path:

--8<---------------cut here---------------start------------->8---
	   (nnimap-split-methods
	    ;; Filter guix mailing lists based on Return
	    (("list.\\1" "^Return-Path: <\\(.*\\)-bounces.*@\\(non\\)?gnu.org>")
             ("list.\\1" "^Return-Path: <\\(.*\\)-bounces.*@lists.denx.de>")
             ("list.\\1" "^Return-Path: <\\(.*\\)-owner <at> vger.kernel.org>")
	     ("INBOX" "")))
--8<---------------cut here---------------end--------------->8---

I think when Cc: is used in an email, it causes the Return-Path to be
that of the person sending the email rather than mailman's email, which
is what the above filter expects.

-- 
Thanks,
Maxim




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Thu, 19 Jan 2023 02:31:02 GMT) Full text and rfc822 format available.

Notification sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
bug acknowledged by developer. (Thu, 19 Jan 2023 02:31:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 59761-done <at> debbugs.gnu.org
Cc: rekado <at> elephly.net
Subject: Re: bug#59761: [PATCH 0/2] Add u-boot-ts7970-q-2g-1000mhz-c.
Date: Wed, 18 Jan 2023 21:30:49 -0500
Hi,

Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes:

> * gnu/bootloader/u-boot.scm (u-boot-ts7970-q-2g-1000mhz-c-bootloader): New
> variable.
>
> ---
>
> (no changes since v4)
>
> Changes in v4:
> - Rebase on top of #60224 and master
>
>  gnu/bootloader/u-boot.scm | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

Now applied!

-- 
Thanks,
Maxim




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

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

Previous Next


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