Subject: [PATCH 3/4] bootloader: Add make-u-boot-bootloader.

From: Danny Milosavljevic <[email-masked]>
Date: Fri, 11 May 2018 16:36:51 +0200

* gnu/bootloader/u-boot.scm (make-u-boot-bootloader): New procedure.
(u-boot-allwinner-bootloader): Delete variable.
(u-boot-imx-bootloader): Delete variable.
(u-boot-beaglebone-black-bootloader): Modify.
(u-boot-nintendo-nes-classic-edition-bootloader): Modify.
(u-boot-a20-olinuxino-lime-bootloader): Modify.
(u-boot-a20-olinuxino-lime2-bootloader): Modify.
(u-boot-a20-olinuxino-micro-bootloader): Modify.
(u-boot-banana-pi-m2-ultra-bootloader): Modify.
(u-boot-mx6cuboxi-bootloader): Modify.
(u-boot-wandboard-bootloader): Modify.
(u-boot-novena-bootloader): Modify.
---
 gnu/bootloader/u-boot.scm | 54 ++++++++++++++---------------------------------
 1 file changed, 16 insertions(+), 38 deletions(-)

diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index e0941c961..feda17f99 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -36,7 +36,8 @@
             u-boot-mx6cuboxi-bootloader
             u-boot-nintendo-nes-classic-edition-bootloader
             u-boot-novena-bootloader
-            u-boot-wandboard-bootloader))
+            u-boot-wandboard-bootloader
+            make-u-boot-bootloader))
 
 (define install-u-boot
   #~(lambda (bootloader device mount-point)
@@ -104,58 +105,35 @@
    (package #f)
    (installer install-u-boot)))
 
-(define u-boot-beaglebone-black-bootloader
-  (bootloader
-   (inherit u-boot-bootloader)
-   (package u-boot-beagle-bone-black)
-   (installer install-beaglebone-black-u-boot)))
-
-(define u-boot-allwinner-bootloader
+(define (make-u-boot-bootloader bootloader-package)
+  "Given BOOTLOADER-PACKAGE, make a bootloader that can install."
   (bootloader
-   (inherit u-boot-bootloader)
-   (installer install-allwinner-u-boot)))
+    (inherit u-boot-bootloader)
+    (package bootloader-package)))
 
-(define u-boot-imx-bootloader
-  (bootloader
-   (inherit u-boot-bootloader)
-   (installer install-imx-u-boot)))
+(define u-boot-beaglebone-black-bootloader
+  (make-u-boot-bootloader u-boot-beagle-bone-black))
 
 (define u-boot-nintendo-nes-classic-edition-bootloader
-  (bootloader
-    (inherit u-boot-allwinner-bootloader)
-    (package u-boot-nintendo-nes-classic-edition)))
+  (make-u-boot-bootloader u-boot-nintendo-nes-classic-edition))
 
 (define u-boot-a20-olinuxino-lime-bootloader
-  (bootloader
-   (inherit u-boot-allwinner-bootloader)
-   (package u-boot-a20-olinuxino-lime)))
+  (make-u-boot-bootloader u-boot-a20-olinuxino-lime))
 
 (define u-boot-a20-olinuxino-lime2-bootloader
-  (bootloader
-   (inherit u-boot-allwinner-bootloader)
-   (package u-boot-a20-olinuxino-lime2)))
+  (make-u-boot-bootloader u-boot-a20-olinuxino-lime2))
 
 (define u-boot-a20-olinuxino-micro-bootloader
-  (bootloader
-   (inherit u-boot-allwinner-bootloader)
-   (package u-boot-a20-olinuxino-micro)))
+  (make-u-boot-bootloader u-boot-a20-olinuxino-micro))
 
 (define u-boot-banana-pi-m2-ultra-bootloader
-  (bootloader
-   (inherit u-boot-allwinner-bootloader)
-   (package u-boot-banana-pi-m2-ultra)))
+  (make-u-boot-bootloader u-boot-banana-pi-m2-ultra))
 
 (define u-boot-mx6cuboxi-bootloader
-  (bootloader
-   (inherit u-boot-imx-bootloader)
-   (package u-boot-mx6cuboxi)))
+  (make-u-boot-bootloader u-boot-mx6cuboxi))
 
 (define u-boot-wandboard-bootloader
-  (bootloader
-   (inherit u-boot-imx-bootloader)
-   (package u-boot-wandboard)))
+  (make-u-boot-bootloader u-boot-wandboard))
 
 (define u-boot-novena-bootloader
-  (bootloader
-   (inherit u-boot-imx-bootloader)
-   (package u-boot-novena)))
+  (make-u-boot-bootloader u-boot-novena))