From 9112c78af5ed872f25f7d01a8d7553a3778ea25f Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Tue, 3 Sep 2019 02:29:16 +0200 Subject: gnu: u-boot: Provide make-buildroot-u-boot-package. * gnu/packages/bootloaders.scm (make-u-boot-package): Modify. (make-buildroot-u-boot-package): New public procedure. (make-u-boot-sunxi64-package): Modify. (buildroot->guix-package): Use make-buildroot-u-boot-package. --- gnu/packages/bootloaders.scm | 27 +++++++++++---------------- guix/import/buildroot.scm | 18 ++++++++++++------ 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)))))))) -- cgit 1.4.1