[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#31416] [PATCH 2/4] bootloader: install-u-boot: Automatically select
From: |
Ludovic Courtès |
Subject: |
[bug#31416] [PATCH 2/4] bootloader: install-u-boot: Automatically select the correct installer. |
Date: |
Sun, 13 May 2018 11:31:23 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
Danny Milosavljevic <address@hidden> skribis:
> * 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)))))))
Hmm ‘install-beaglebone-black-u-boot’ & co are not in the same stage
AFAICS; are you missing #$ escapes here?
Also we’re probably missing (ice-9 rdelim) and (ice-9 regex) as in the
build stage.
Last, isn’t it a bit hacky? :-) Previously every <bootloader> would
contain its installation method, so this was unambiguous, but now we’re
back to guessing what installation method to use.
Ludo’.
- [bug#31416] [PATCH 1/4] system: Add os-with-u-boot., (continued)
[bug#31416] [PATCH 2/4] bootloader: install-u-boot: Automatically select the correct installer., Danny Milosavljevic, 2018/05/11
[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