[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: hydra: honeycomb: Customize bootloader.
From: |
Ricardo Wurmus |
Subject: |
branch master updated: hydra: honeycomb: Customize bootloader. |
Date: |
Wed, 16 Feb 2022 14:21:32 -0500 |
This is an automated email from the git hooks/post-receive script.
rekado pushed a commit to branch master
in repository maintenance.
The following commit(s) were added to refs/heads/master by this push:
new 7657d05 hydra: honeycomb: Customize bootloader.
7657d05 is described below
commit 7657d05981b4ea7f5d2494a3d9c4fe157cefa217
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Wed Feb 16 20:20:16 2022 +0100
hydra: honeycomb: Customize bootloader.
* hydra/modules/sysadmin/honeycomb.scm
(honeycomb-extlinux-configuration-file):
New procedure.
(honeycomb-bootloader): New variable.
(honeycomb-system)[bootloader]: Use it.
---
hydra/modules/sysadmin/honeycomb.scm | 75 +++++++++++++++++++++++++++++++++++-
1 file changed, 73 insertions(+), 2 deletions(-)
diff --git a/hydra/modules/sysadmin/honeycomb.scm
b/hydra/modules/sysadmin/honeycomb.scm
index b845be0..9aac70c 100644
--- a/hydra/modules/sysadmin/honeycomb.scm
+++ b/hydra/modules/sysadmin/honeycomb.scm
@@ -3,7 +3,7 @@
;;; Copyright © 2016, 2017, 2018, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020, 2021 Mathieu Othacehe <othacehe@gnu.org>
;;; Copyright © 2021 Christopher Baines <mail@cbaines.net>
-;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2021, 2022 Ricardo Wurmus <rekado@elephly.net>
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
@@ -20,7 +20,9 @@
(define-module (sysadmin honeycomb)
#:use-module (gnu)
+ #:use-module (gnu bootloader)
#:use-module (gnu bootloader u-boot)
+ #:use-module (gnu packages bootloaders)
#:use-module (gnu packages screen)
#:use-module (gnu packages ssh)
#:use-module (gnu packages linux)
@@ -37,6 +39,75 @@
#:use-module (guix utils)
#:export (honeycomb-system))
+;; This is just like extlinux-configuration-file but with a fixed FDTDIR.
+;;
+;; The generated Grub configuration tells u-boot to look for the
+;; device tree file in the kernel directory. The device tree file has
+;; an unexpected name, though, so the system doesn't boot as the file
+;; cannot be found. We arranged for the file to be stored in
+;; /boot/extlinux under the expected name. So we need to set the
+;; FDTDIR to that location in the generated
+;; /boot/extlinux/extlinux.conf.
+(define* (honeycomb-extlinux-configuration-file
+ config entries #:key
+ (system (%current-system))
+ (old-entries '())
+ #:allow-other-keys)
+ "Return the U-Boot configuration file corresponding to CONFIG, a
+<u-boot-configuration> object, and where the store is available at STORE-FS, a
+<file-system> object. OLD-ENTRIES is taken to be a list of menu entries
+corresponding to old generations of the system."
+
+ (define all-entries
+ (append entries (bootloader-configuration-menu-entries config)))
+
+ (define (menu-entry->gexp entry)
+ (let ((label (menu-entry-label entry))
+ (kernel (menu-entry-linux entry))
+ (kernel-arguments (menu-entry-linux-arguments entry))
+ (initrd (menu-entry-initrd entry)))
+ #~(format port "LABEL ~a
+ MENU LABEL ~a
+ KERNEL ~a
+ FDTDIR /boot/extlinux
+ INITRD ~a
+ APPEND ~a
+~%"
+ #$label #$label
+ #$kernel #$initrd
+ (string-join (list #$@kernel-arguments)))))
+
+ (define builder
+ #~(call-with-output-file #$output
+ (lambda (port)
+ (let ((timeout #$(bootloader-configuration-timeout config)))
+ (format port "# This file was generated from your Guix
configuration. Any changes
+# will be lost upon reconfiguration.
+UI menu.c32
+MENU TITLE GNU Guix Boot Options
+PROMPT ~a
+TIMEOUT ~a~%"
+ (if (> timeout 0) 1 0)
+ ;; timeout is expressed in 1/10s of seconds.
+ (* 10 timeout))
+ #$@(map menu-entry->gexp all-entries)
+
+ #$@(if (pair? old-entries)
+ #~((format port "~%")
+ #$@(map menu-entry->gexp old-entries)
+ (format port "~%"))
+ #~())))))
+
+ (computed-file "extlinux.conf" builder
+ #:options '(#:local-build? #t
+ #:substitutable? #f)))
+
+(define honeycomb-bootloader
+ (bootloader
+ (inherit u-boot-bootloader)
+ (name 'u-boot-for-honeycomb)
+ (configuration-file-generator honeycomb-extlinux-configuration-file)))
+
(define (sysadmin name full-name)
(user-account
(name name)
@@ -132,7 +203,7 @@
(locale "en_US.UTF-8")
(bootloader (bootloader-configuration
- (bootloader u-boot-bootloader)
+ (bootloader honeycomb-bootloader)
(target "/boot/efi")))
(kernel linux-libre-arm64-honeycomb)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: hydra: honeycomb: Customize bootloader.,
Ricardo Wurmus <=