Subject: [PATCH 4/4] bootloader: Simplify bootloader installer selection.

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

* gnu/bootloader/u-boot.scm (u-boot-bootloader): Delete variable.
(u-boot-a20-olinuxino-lime-bootloader): Delete variable.
(u-boot-a20-olinuxino-lime2-bootloader): Delete variable.
(u-boot-a20-olinuxino-micro-bootloader): Delete variable.
(u-boot-banana-pi-m2-ultra-bootloader): Delete variable.
(u-boot-beaglebone-black-bootloader): Delete variable.
(u-boot-mx6cuboxi-bootloader): Delete variable.
(u-boot-nintendo-nes-classic-edition-bootloader): Delete variable.
(u-boot-novena-bootloader): Delete variable.
(u-boot-wandboard-bootloader): Delete variable.
* gnu/packages/bootloader.scm (u-boot-beagle-bone-black): Rename to...
(u-boot-beaglebone-black): ...this.
* gnu/system/examples/beaglebone-black.tmpl: Use make-u-boot-bootloader.
* gnu/system/install.scm (os-with-u-boot): Use make-u-boot-bootloader.
(beaglebone-black-installation-os): Use make-u-boot-bootloader.
(a20-olinuxino-lime-installation-os): Use make-u-boot-bootloader.
(a20-olinuxino-lime2-emmc-installation-os): Use make-u-boot-bootloader.
(a20-olinuxino-micro-installation-os): Use make-u-boot-bootloader.
(banana-pi-m2-ultra-installation-os): Use make-u-boot-bootloader.
(mx6cuboxi-installation-os): Use make-u-boot-bootloader.
(novena-installation-os): Use make-u-boot-bootloader.
(nintendo-nes-classic-edition-installation-os): Use make-u-boot-bootloader.
(wandboard-installation-os): Use make-u-boot-bootloader.
---
 gnu/bootloader/u-boot.scm                 | 39 +------------------------------
 gnu/packages/bootloaders.scm              |  2 +-
 gnu/system/examples/beaglebone-black.tmpl |  2 +-
 gnu/system/install.scm                    | 21 ++++++++---------
 4 files changed, 13 insertions(+), 51 deletions(-)

diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index feda17f99..f804997a4 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -27,17 +27,7 @@
   #:use-module (guix monads)
   #:use-module (guix records)
   #:use-module (guix utils)
-  #:export (u-boot-bootloader
-            u-boot-a20-olinuxino-lime-bootloader
-            u-boot-a20-olinuxino-lime2-bootloader
-            u-boot-a20-olinuxino-micro-bootloader
-            u-boot-banana-pi-m2-ultra-bootloader
-            u-boot-beaglebone-black-bootloader
-            u-boot-mx6cuboxi-bootloader
-            u-boot-nintendo-nes-classic-edition-bootloader
-            u-boot-novena-bootloader
-            u-boot-wandboard-bootloader
-            make-u-boot-bootloader))
+  #:export (make-u-boot-bootloader))
 
 (define install-u-boot
   #~(lambda (bootloader device mount-point)
@@ -110,30 +100,3 @@
   (bootloader
     (inherit u-boot-bootloader)
     (package bootloader-package)))
-
-(define u-boot-beaglebone-black-bootloader
-  (make-u-boot-bootloader u-boot-beagle-bone-black))
-
-(define u-boot-nintendo-nes-classic-edition-bootloader
-  (make-u-boot-bootloader u-boot-nintendo-nes-classic-edition))
-
-(define u-boot-a20-olinuxino-lime-bootloader
-  (make-u-boot-bootloader u-boot-a20-olinuxino-lime))
-
-(define u-boot-a20-olinuxino-lime2-bootloader
-  (make-u-boot-bootloader u-boot-a20-olinuxino-lime2))
-
-(define u-boot-a20-olinuxino-micro-bootloader
-  (make-u-boot-bootloader u-boot-a20-olinuxino-micro))
-
-(define u-boot-banana-pi-m2-ultra-bootloader
-  (make-u-boot-bootloader u-boot-banana-pi-m2-ultra))
-
-(define u-boot-mx6cuboxi-bootloader
-  (make-u-boot-bootloader u-boot-mx6cuboxi))
-
-(define u-boot-wandboard-bootloader
-  (make-u-boot-bootloader u-boot-wandboard))
-
-(define u-boot-novena-bootloader
-  (make-u-boot-bootloader u-boot-novena))
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 526e53384..759abdc92 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -424,7 +424,7 @@ also initializes the boards (RAM etc).")
 (define-public u-boot-malta
   (make-u-boot-package "malta" "mips64el-linux-gnuabi64"))
 
-(define-public u-boot-beagle-bone-black
+(define-public u-boot-beaglebone-black
   (make-u-boot-package "am335x_boneblack" "arm-linux-gnueabihf"))
 
 (define-public u-boot-pine64-plus
diff --git a/gnu/system/examples/beaglebone-black.tmpl b/gnu/system/examples/beaglebone-black.tmpl
index 97201330c..1fd03dab9 100644
--- a/gnu/system/examples/beaglebone-black.tmpl
+++ b/gnu/system/examples/beaglebone-black.tmpl
@@ -13,7 +13,7 @@
   ;; Assuming /dev/mmcblk1 is the eMMC, and "my-root" is
   ;; the label of the target root file system.
   (bootloader (bootloader-configuration
-               (bootloader u-boot-beaglebone-black-bootloader)
+               (bootloader (make-u-boot-bootloader u-boot-beaglebone-black))
                (target "/dev/mmcblk1")))
 
   ;; This module is required to mount the SD card.
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index b563e8b5b..7508f95a8 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -396,8 +396,7 @@ If you want a serial console, make sure to specify one in your
 operating-system's kernel-arguments (\"console=ttyS0\" or similar)."
   (operating-system (inherit os)
     (bootloader (bootloader-configuration
-                 (bootloader (bootloader (inherit u-boot-bootloader)
-                              (package (make-u-boot-package board triplet))))
+                 (bootloader (make-u-boot-bootloader (make-u-boot-package board triplet)))
                  (target bootloader-target)))))
 
 (define* (embedded-installation-os bootloader bootloader-target tty
@@ -418,7 +417,7 @@ The bootloader BOOTLOADER is installed to BOOTLOADER-TARGET."
     (initrd-modules (append extra-modules %base-initrd-modules))))
 
 (define beaglebone-black-installation-os
-  (embedded-installation-os u-boot-beaglebone-black-bootloader
+  (embedded-installation-os (make-u-boot-bootloader u-boot-beaglebone-black)
                             "/dev/sda"
                             "ttyO0"
                             #:extra-modules
@@ -427,42 +426,42 @@ The bootloader BOOTLOADER is installed to BOOTLOADER-TARGET."

 (define a20-olinuxino-lime-installation-os
-  (embedded-installation-os u-boot-a20-olinuxino-lime-bootloader
+  (embedded-installation-os (make-u-boot-bootloader u-boot-a20-olinuxino-lime)
                             "/dev/mmcblk0" ; SD card storage
                             "ttyS0"))
 
 (define a20-olinuxino-lime2-emmc-installation-os
-  (embedded-installation-os u-boot-a20-olinuxino-lime2-bootloader
+  (embedded-installation-os (make-u-boot-bootloader u-boot-a20-olinuxino-lime2)
                             "/dev/mmcblk1" ; eMMC storage
                             "ttyS0"))
 
 (define a20-olinuxino-micro-installation-os
-  (embedded-installation-os u-boot-a20-olinuxino-micro-bootloader
+  (embedded-installation-os (make-u-boot-bootloader u-boot-a20-olinuxino-micro)
                             "/dev/mmcblk0" ; SD card storage
                             "ttyS0"))
 
 (define banana-pi-m2-ultra-installation-os
-  (embedded-installation-os u-boot-banana-pi-m2-ultra-bootloader
+  (embedded-installation-os (make-u-boot-bootloader u-boot-banana-pi-m2-ultra)
                             "/dev/mmcblk1" ; eMMC storage
                             "ttyS0"))
 
 (define mx6cuboxi-installation-os
-  (embedded-installation-os u-boot-mx6cuboxi-bootloader
+  (embedded-installation-os (make-u-boot-bootloader u-boot-mx6cuboxi)
                             "/dev/mmcblk0" ; SD card storage
                             "ttymxc0"))
 
 (define novena-installation-os
-  (embedded-installation-os u-boot-novena-bootloader
+  (embedded-installation-os (make-u-boot-bootloader u-boot-novena)
                             "/dev/mmcblk1" ; SD card storage
                             "ttymxc1"))
 
 (define nintendo-nes-classic-edition-installation-os
-  (embedded-installation-os u-boot-nintendo-nes-classic-edition-bootloader
+  (embedded-installation-os (make-u-boot-bootloader u-boot-nintendo-nes-classic-edition)
                             "/dev/mmcblk0" ; SD card (solder it yourself)
                             "ttyS0"))
 
 (define wandboard-installation-os
-  (embedded-installation-os u-boot-wandboard-bootloader
+  (embedded-installation-os (make-u-boot-bootloader u-boot-wandboard)
                             "/dev/mmcblk0" ; SD card storage
                             "ttymxc0"))