unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Herman Rimm via Guix-patches via <guix-patches@gnu.org>
To: 74842@debbugs.gnu.org
Cc: Efraim Flashner <efraim@flashner.co.il>,
	Vagrant Cascadian <vagrant@debian.org>
Subject: [bug#74842] [PATCH 4/4] gnu: Add make-u-boot-rockchip-package procedure.
Date: Thu, 12 Dec 2024 22:07:11 +0100	[thread overview]
Message-ID: <ab45dc97fcd5f92a23e7237e8549de818e207b53.1734037218.git.herman@rimm.ee> (raw)
In-Reply-To: <6a1609d369654f967bdcb42bec27357b5f522ebf.1734037218.git.herman@rimm.ee>

* gnu/packages/bootloaders.scm (make-u-boot-rockchip-package): Add.
(u-boot-orangepi-r1-plus-lts-rk3328, u-boot-puma-rk3399,
u-boot-rock64-rk3328, u-boot-firefly-rk3399, u-boot-rockpro64-rk3399,
u-boot-pinebook-pro-rk3399): Use procedure.

Change-Id: I0d7632e46cfed312f8b2843c6fafc912077bc241
---
 gnu/packages/bootloaders.scm | 136 +++++++++++------------------------
 1 file changed, 41 insertions(+), 95 deletions(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 15cdaddd7e..8d3cda760a 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -18,7 +18,7 @@
 ;;; Copyright © 2022, 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
 ;;; Copyright © 2021 Stefan <stefan-guix@vodafonemail.de>
 ;;; Copyright © 2022, 2023, 2024 Maxim Cournoyer <maxim.cournoyer@gmail.com>
-;;; Copyright © 2023 Herman Rimm <herman@rimm.ee>
+;;; Copyright © 2023-2024 Herman Rimm <herman@rimm.ee>
 ;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
 ;;; Copyright © 2024 Zheng Junjie <873216071@qq.com>
 ;;;
@@ -1145,6 +1145,27 @@ (define*-public (make-u-boot-package board triplet
                          (copy-file file target-file)))
                      uboot-files)))))))))))
 
+(define* (make-u-boot-rockchip-package board soc #:optional configs)
+  "Return the U-Boot package for BOARD with AAarch64 Rockchip SOC
+(System on Chip)."
+  (let* ((board (string-append board "-" (symbol->string soc)))
+         (base (make-u-boot-package board "aarch64-linux-gnu"
+                                    #:configs configs))
+         (atf (match soc
+                ('rk3399 arm-trusted-firmware-rk3399)
+                ('rk3328 arm-trusted-firmware-rk3328))))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'set-environment
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (let ((atf (assoc-ref inputs #$(package-name atf))))
+                    (setenv "BL31" (string-append atf "/bl31.elf")))))))))
+      (inputs (modify-inputs (package-inputs base) (append atf))))))
+
 (define-public u-boot-am335x-boneblack
   (let ((base (make-u-boot-package
                "am335x_evm" "arm-linux-gnueabihf"
@@ -1260,19 +1281,7 @@ (define-public u-boot-novena
 partition."))
 
 (define-public u-boot-orangepi-r1-plus-lts-rk3328
-  (let ((base (make-u-boot-package "orangepi-r1-plus-lts-rk3328" "aarch64-linux-gnu")))
-    (package
-      (inherit base)
-      (arguments
-       (substitute-keyword-arguments (package-arguments base)
-         ((#:phases phases)
-          #~(modify-phases #$phases
-              (add-after 'unpack 'set-environment
-                (lambda* (#:key native-inputs inputs #:allow-other-keys)
-                  (setenv "BL31" (search-input-file inputs "bl31.elf"))))))))
-      (inputs
-       (modify-inputs (package-inputs base)
-         (append arm-trusted-firmware-rk3328))))))
+  (make-u-boot-rockchip-package "orangepi-r1-plus-lts" 'rk3328))
 
 (define-public u-boot-cubieboard
   (make-u-boot-package "Cubieboard" "arm-linux-gnueabihf"))
@@ -1281,22 +1290,7 @@ (define-public u-boot-cubietruck
   (make-u-boot-package "Cubietruck" "arm-linux-gnueabihf"))
 
 (define-public u-boot-puma-rk3399
-  (let ((base (make-u-boot-package "puma-rk3399" "aarch64-linux-gnu")))
-    (package
-      (inherit base)
-      (arguments
-       (substitute-keyword-arguments (package-arguments base)
-         ((#:phases phases)
-          #~(modify-phases #$phases
-              (add-after 'unpack 'set-environment
-                (lambda* (#:key inputs #:allow-other-keys)
-                  (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
-              ;; Phases do not succeed on the bl31 ELF.
-              (delete 'strip)
-              (delete 'validate-runpath)))))
-      (inputs
-       (modify-inputs (package-inputs base)
-         (append arm-trusted-firmware-rk3399))))))
+  (make-u-boot-rockchip-package "puma" 'rk3399))
 
 (define-public u-boot-qemu-arm
   (make-u-boot-package "qemu_arm" "arm-linux-gnueabihf"
@@ -1417,87 +1411,39 @@ (define-public u-boot-starfive-visionfive2
          (append opensbi-for-visionfive2))))))
 
 (define-public u-boot-rock64-rk3328
-  (let ((base (make-u-boot-package "rock64-rk3328" "aarch64-linux-gnu")))
-    (package
-      (inherit base)
-      (arguments
-       (substitute-keyword-arguments (package-arguments base)
-         ((#:phases phases)
-          #~(modify-phases #$phases
-              (add-after 'unpack 'set-environment
-                (lambda* (#:key native-inputs inputs #:allow-other-keys)
-                  (setenv "BL31" (search-input-file inputs "bl31.elf"))))))))
-      (inputs
-       (modify-inputs (package-inputs base)
-         (append arm-trusted-firmware-rk3328))))))
+  (make-u-boot-rockchip-package "rock64" 'rk3328))
 
 (define-public u-boot-firefly-rk3399
-  (let ((base (make-u-boot-package "firefly-rk3399" "aarch64-linux-gnu")))
-    (package
-      (inherit base)
-      (arguments
-       (substitute-keyword-arguments (package-arguments base)
-         ((#:phases phases)
-          #~(modify-phases #$phases
-              (add-after 'unpack 'set-environment
-                (lambda* (#:key native-inputs inputs #:allow-other-keys)
-                  (setenv "BL31" (search-input-file inputs "bl31.elf"))))
-              ;; Phases do not succeed on the bl31 ELF.
-              (delete 'strip)
-              (delete 'validate-runpath)))))
-      (inputs
-       (modify-inputs (package-inputs base)
-         (append arm-trusted-firmware-rk3399))))))
+  (make-u-boot-rockchip-package "firefly" 'rk3399))
 
 (define-public u-boot-rockpro64-rk3399
-  (let ((base (make-u-boot-package "rockpro64-rk3399" "aarch64-linux-gnu"
-                                   #:configs '("CONFIG_USB=y"
-                                               "CONFIG_AHCI=y"
-                                               "CONFIG_AHCI_PCI=y"
-                                               "CONFIG_SATA=y"
-                                               "CONFIG_SATA_SIL=y"
-                                               "CONFIG_SCSI=y"
-                                               "CONFIG_SCSI_AHCI=y"
-                                               "CONFIG_DM_SCSI=y"
-                                               ;; Disable SPL FIT signatures,
-                                               ;; due to GPLv2 and Openssl
-                                               ;; license incompatibilities
-                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
+  (let ((base (make-u-boot-rockchip-package
+                "rockpro64" 'rk3399
+                '("CONFIG_USB=y"
+                  "CONFIG_AHCI=y"
+                  "CONFIG_AHCI_PCI=y"
+                  "CONFIG_SATA=y"
+                  "CONFIG_SATA_SIL=y"
+                  "CONFIG_SCSI=y"
+                  "CONFIG_SCSI_AHCI=y"
+                  "CONFIG_DM_SCSI=y"
+                  ;; Disable SPL FIT signatures, due to GPLv2 and
+                  ;; OpenSSL license incompatibilities.
+                  "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
     (package
       (inherit base)
       (arguments
        (substitute-keyword-arguments (package-arguments base)
          ((#:phases phases)
           #~(modify-phases #$phases
-              (add-after 'unpack 'set-environment
-                (lambda* (#:key inputs #:allow-other-keys)
-                  (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
               (add-after 'unpack 'patch-header
                 (lambda _
                   (substitute* "include/config_distro_bootcmd.h"
                     (("\"scsi_need_init=")
-                     "\"setenv scsi_need_init"))))))))
-      (inputs
-       (modify-inputs (package-inputs base)
-         (append arm-trusted-firmware-rk3399))))))
+                     "\"setenv scsi_need_init")))))))))))
 
 (define-public u-boot-pinebook-pro-rk3399
-  (let ((base (make-u-boot-package "pinebook-pro-rk3399" "aarch64-linux-gnu")))
-    (package
-      (inherit base)
-      (arguments
-       (substitute-keyword-arguments (package-arguments base)
-         ((#:phases phases)
-          #~(modify-phases #$phases
-              (add-after 'unpack 'set-environment
-                (lambda* (#:key native-inputs inputs #:allow-other-keys)
-                  (setenv "BL31" (search-input-file inputs "bl31.elf"))))
-              ;; Phases do not succeed on the bl31 ELF.
-              (delete 'strip)
-              (delete 'validate-runpath)))))
-      (inputs
-       (modify-inputs (package-inputs base)
-         (append arm-trusted-firmware-rk3399))))))
+  (make-u-boot-rockchip-package "pinebook-pro" 'rk3399))
 
 (define*-public (make-u-boot-bin-package u-boot-package
                                          #:key
-- 
2.45.2





      parent reply	other threads:[~2024-12-12 21:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12 21:03 [bug#74842] [PATCH 1/4] gnu: bootloader: u-boot: Add u-boot-rockchip-bootloader Herman Rimm via Guix-patches via
2024-12-12 21:07 ` [bug#74842] [PATCH 2/4] gnu: bootloader: u-boot: Add write-u-boot-image procedure Herman Rimm via Guix-patches via
2024-12-12 21:07 ` [bug#74842] [PATCH 3/4] gnu: u-boot-rockpro64-rk3399: Remove obsolete substitute Herman Rimm via Guix-patches via
2024-12-12 21:07 ` Herman Rimm via Guix-patches via [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ab45dc97fcd5f92a23e7237e8549de818e207b53.1734037218.git.herman@rimm.ee \
    --to=guix-patches@gnu.org \
    --cc=74842@debbugs.gnu.org \
    --cc=efraim@flashner.co.il \
    --cc=herman@rimm.ee \
    --cc=vagrant@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).