summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/packages/bootloaders.scm27
-rw-r--r--guix/import/buildroot.scm18
2 files changed, 23 insertions, 22 deletions
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 41a2de9706..ed4ca599d3 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -552,7 +552,10 @@ board-independent tools.")))
          #:phases
          (modify-phases %standard-phases
            (replace 'configure
-             (lambda* (#:key outputs make-flags #:allow-other-keys)
+             (lambda* (#:key inputs outputs make-flags #:allow-other-keys)
+               (and=> (assoc-ref inputs "bl31")
+                      (lambda (bl31)
+                        (setenv "BL31" (string-append bl31 "/bl31.bin"))))
                (let ((config-name (string-append ,board "_defconfig")))
                  (if (file-exists? (string-append "configs/" config-name))
                      (apply invoke "make" `(,@make-flags ,config-name))
@@ -599,6 +602,12 @@ board-independent tools.")))
                   uboot-files)
                  #t)))))))))
 
+(define-public (make-buildroot-u-boot-package board buildroot-configuration-flags triplet)
+  "Given a BUILDROOT-CONFIGURATION-FLAGS (the 'y and 'n parts of a
+BUILDROOT-CONFIGURATION), return a fitting u-boot package"
+  (let ((base (make-u-boot-package board triplet)))
+    (package (inherit base))))
+
 (define-public u-boot-vexpress
   (make-u-boot-package "vexpress_ca9x4" "arm-linux-gnueabihf"))
 
@@ -636,22 +645,8 @@ it fits within common partitioning schemes.")
   (let ((base (make-u-boot-package board triplet)))
     (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 ((bl31 (string-append (assoc-ref inputs "firmware")
-                                             "/bl31.bin")))
-                    (setenv "BL31" bl31)
-                    ;; This is necessary when we're using the bundled dtc.
-                    ;(setenv "PATH" (string-append (getenv "PATH") ":"
-                    ;                              "scripts/dtc"))
-                    )
-                  #t))))))
       (native-inputs
-       `(("firmware" ,arm-trusted-firmware-sun50i-a64)
+       `(("bl31" ,arm-trusted-firmware-sun50i-a64)
          ,@(package-native-inputs base))))))
 
 (define-public u-boot-pine64-plus
diff --git a/guix/import/buildroot.scm b/guix/import/buildroot.scm
index 73801433dd..0ae06de5ec 100644
--- a/guix/import/buildroot.scm
+++ b/guix/import/buildroot.scm
@@ -128,10 +128,16 @@
            `((bootloader
              (inherit u-boot-bootloader)
              (package
-              (make-u-boot-package
-               ,(string-append (assoc-ref buildroot-configuration "BR2_TARGET_UBOOT_BOARD_DEFCONFIG")
-                               "_defconfig")
-               (if (eq? (assoc-ref "BR2_aarch64" 'y)
-                        "aarch64-linux-gnu"
-                        "arm-linux-gnueabihf"))))
+              (make-buildroot-u-boot-package
+               ,(string-append (assoc-ref buildroot-configuration "BR2_TARGET_UBOOT_BOARD_DEFCONFIG"))
+               (quote ,(filter (match-lambda
+                        ((a . 'y)
+                         (string-prefix? "BR2_TARGET_UBOOT_" a))
+                        ((a . 'n)
+                         (string-prefix? "BR2_TARGET_UBOOT_" a))
+                        (_ #f))
+                       buildroot-configuration))
+               ,(if (eq? (assoc-ref buildroot-configuration "BR2_aarch64") 'y)
+                    "aarch64-linux-gnu"
+                    "arm-linux-gnueabihf")))
              (installer install-buildroot-u-boot))))))))