Subject: [PATCH 1/4] gnu: bootloader: u-boot: Add u-boot-rockchip-bootloader.
From: Herman Rimm <[email-masked]>
To: [email-masked]
Date: Thu, 12 Dec 2024 22:03:25 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/bootloader/u-boot.scm (install-rockchip-u-boot): Add procedure.
(install-orangepi-r1-plus-lts-rk3328-u-boot,
install-firefly-rk3399-u-boot, install-rock64-rk3328-u-boot,
install-rockpro64-rk3399-u-boot, install-pinebook-pro-rk3399-u-boot):
Remove procedure.
(u-boot-rockchip-bootloader): Add variable.
(u-boot-firefly-rk3399-bootloader,
u-boot-orangepi-r1-plus-lts-rk3328-bootloader,
u-boot-rock64-rk3328-bootloader, u-boot-rockpro64-rk3399-bootloader,
u-boot-pinebook-pro-rk3399-bootloader): Inherit
u-boot-rockchip-bootloader.
[disk-image-installer]: Remove.

Change-Id: Icb7546ee2bb1742c12c7b47ff2779d278dd45b14
---
 gnu/bootloader/u-boot.scm | 66 ++++++++++-----------------------------
 1 file changed, 17 insertions(+), 49 deletions(-)

diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 5e149eaea0..5ea5f418b4 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -111,15 +111,6 @@ (define install-imx-u-boot
         (write-file-on-device u-boot (stat:size (stat u-boot))
                               image (* 69 1024)))))
 
-(define install-orangepi-r1-plus-lts-rk3328-u-boot
-  #~(lambda (bootloader root-index image)
-      (let ((idb (string-append bootloader "/libexec/idbloader.img"))
-            (u-boot (string-append bootloader "/libexec/u-boot.itb")))
-        (write-file-on-device idb (stat:size (stat idb))
-                              image (* 64 512))
-        (write-file-on-device u-boot (stat:size (stat u-boot))
-                              image (* 16384 512)))))
-
 (define install-puma-rk3399-u-boot
   #~(lambda (bootloader root-index image)
       (let ((spl (string-append bootloader "/libexec/idbloader.img"))
@@ -129,25 +120,7 @@ (define install-puma-rk3399-u-boot
         (write-file-on-device u-boot (stat:size (stat u-boot))
                               image (* 512 512)))))
 
-(define install-firefly-rk3399-u-boot
-  #~(lambda (bootloader root-index image)
-      (let ((idb (string-append bootloader "/libexec/idbloader.img"))
-            (u-boot (string-append bootloader "/libexec/u-boot.itb")))
-        (write-file-on-device idb (stat:size (stat idb))
-                              image (* 64 512))
-        (write-file-on-device u-boot (stat:size (stat u-boot))
-                              image (* 16384 512)))))
-
-(define install-rock64-rk3328-u-boot
-  #~(lambda (bootloader root-index image)
-      (let ((idb (string-append bootloader "/libexec/idbloader.img"))
-            (u-boot (string-append bootloader "/libexec/u-boot.itb")))
-        (write-file-on-device idb (stat:size (stat idb))
-                              image (* 64 512))
-        (write-file-on-device u-boot (stat:size (stat u-boot))
-                              image (* 16384 512)))))
-
-(define install-rockpro64-rk3399-u-boot
+(define install-rockchip-u-boot
   #~(lambda (bootloader root-index image)
       (let ((idb (string-append bootloader "/libexec/idbloader.img"))
             (u-boot (string-append bootloader "/libexec/u-boot.itb")))
@@ -156,8 +129,6 @@ (define install-rockpro64-rk3399-u-boot
         (write-file-on-device u-boot (stat:size (stat u-boot))
                               image (* 16384 512)))))
 
-(define install-pinebook-pro-rk3399-u-boot install-rockpro64-rk3399-u-boot)
-
 (define install-sifive-unmatched-u-boot
   #~(lambda (bootloader root-index image)
       (let ((spl (string-append bootloader "/libexec/spl/u-boot-spl.bin"))
@@ -219,6 +190,12 @@ (define u-boot-imx-bootloader
    (inherit u-boot-bootloader)
    (disk-image-installer install-imx-u-boot)))
 
+(define u-boot-rockchip-bootloader
+  ;; SD and eMMC use the same format
+  (bootloader
+   (inherit u-boot-bootloader)
+   (disk-image-installer install-rockchip-u-boot)))
+
 (define u-boot-nintendo-nes-classic-edition-bootloader
   (bootloader
     (inherit u-boot-allwinner-bootloader)
@@ -250,11 +227,9 @@ (define u-boot-cubietruck-bootloader
     (package u-boot-cubietruck)))
 
 (define u-boot-firefly-rk3399-bootloader
-  ;; SD and eMMC use the same format
   (bootloader
-   (inherit u-boot-bootloader)
-   (package u-boot-firefly-rk3399)
-   (disk-image-installer install-firefly-rk3399-u-boot)))
+   (inherit u-boot-rockchip-bootloader)
+   (package u-boot-firefly-rk3399)))
 
 (define u-boot-mx6cuboxi-bootloader
   (bootloader
@@ -273,9 +248,8 @@ (define u-boot-novena-bootloader
 
 (define u-boot-orangepi-r1-plus-lts-rk3328-bootloader
   (bootloader
-   (inherit u-boot-bootloader)
-   (package u-boot-orangepi-r1-plus-lts-rk3328)
-   (disk-image-installer install-orangepi-r1-plus-lts-rk3328-u-boot)))
+   (inherit u-boot-rockchip-bootloader)
+   (package u-boot-orangepi-r1-plus-lts-rk3328)))
 
 (define u-boot-pine64-plus-bootloader
   (bootloader
@@ -299,25 +273,19 @@ (define u-boot-puma-rk3399-bootloader
    (disk-image-installer install-puma-rk3399-u-boot)))
 
 (define u-boot-rock64-rk3328-bootloader
-  ;; SD and eMMC use the same format
   (bootloader
-   (inherit u-boot-bootloader)
-   (package u-boot-rock64-rk3328)
-   (disk-image-installer install-rock64-rk3328-u-boot)))
+   (inherit u-boot-rockchip-bootloader)
+   (package u-boot-rock64-rk3328)))
 
 (define u-boot-rockpro64-rk3399-bootloader
-  ;; SD and eMMC use the same format
   (bootloader
-   (inherit u-boot-bootloader)
-   (package u-boot-rockpro64-rk3399)
-   (disk-image-installer install-rockpro64-rk3399-u-boot)))
+   (inherit u-boot-rockchip-bootloader)
+   (package u-boot-rockpro64-rk3399)))
 
 (define u-boot-pinebook-pro-rk3399-bootloader
-  ;; SD and eMMC use the same format
   (bootloader
-   (inherit u-boot-bootloader)
-   (package u-boot-pinebook-pro-rk3399)
-   (disk-image-installer install-pinebook-pro-rk3399-u-boot)))
+   (inherit u-boot-rockchip-bootloader)
+   (package u-boot-pinebook-pro-rk3399)))
 
 (define u-boot-ts7970-q-2g-1000mhz-c-bootloader
   ;; This bootloader doesn't really need to be installed, as it is read from

base-commit: a9003b8e6b40b59c9545ae87bb441d3549630db7
-- 
2.45.2