[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#31416] [PATCH 2/4] bootloader: install-u-boot: Automatically select
From: |
Danny Milosavljevic |
Subject: |
[bug#31416] [PATCH 2/4] bootloader: install-u-boot: Automatically select the correct installer. |
Date: |
Fri, 11 May 2018 16:36:50 +0200 |
* gnu/bootloader/u-boot.scm (install-u-boot): Automatically select the correct
installer.
---
gnu/bootloader/u-boot.scm | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index bc8f98f32..e0941c961 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -41,7 +41,24 @@
(define install-u-boot
#~(lambda (bootloader device mount-point)
(if bootloader
- (error "Failed to install U-Boot"))))
+ (let* ((config-file-name (string-append bootloader "/libexec/.config"))
+ (soc (call-with-input-file config-file-name
+ (let loop ((line (read-line port)))
+ (if (not (eof-object? line))
+ (let ((match
+ (string-match
+
"^CONFIG_SYS_SOC=\"([^\"]*)\""
+ line)))
+ (if match
+ (match:substring match 1)
+ (loop (read-line port))))
+ #f)))))
+ (match soc
+ ("am33xx" (install-beaglebone-black-u-boot bootloader device
mount-point))
+ ("mx6" (install-imx-u-boot bootloader device mount-point))
+ ("sunxi" (install-allwinner-u-boot bootloader device mount-point))
+ (_ (error "Failed to install U-Boot (no installation method found)"
+ soc)))))))
(define install-beaglebone-black-u-boot
;;
http://wiki.beyondlogic.org/index.php?title=BeagleBoneBlack_Upgrading_uBoot
[bug#31416] [PATCH 2/4] bootloader: install-u-boot: Automatically select the correct installer.,
Danny Milosavljevic <=
[bug#31416] [PATCH 4/4] bootloader: Simplify bootloader installer selection., Danny Milosavljevic, 2018/05/11
[bug#31416] [PATCH 1/4] system: Add os-with-u-boot., Ludovic Courtès, 2018/05/13
[bug#31416] [PATCH 1/4] system: Add os-with-u-boot., Jelle Licht, 2018/05/13