guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: bootloader: Add device-tree-support? option.


From: guix-commits
Subject: 01/02: bootloader: Add device-tree-support? option.
Date: Tue, 30 Aug 2022 02:51:43 -0400 (EDT)

mothacehe pushed a commit to branch master
in repository guix.

commit f126f23b132148192b2c9a89032a5831af0b3c52
Author: Reza Alizadeh Majd <r.majd@pantherx.org>
AuthorDate: Sun Aug 28 12:34:46 2022 +0430

    bootloader: Add device-tree-support? option.
    
    In some specific cases where the device tree file is already loaded in RAM, 
it
    can be preferable that the bootloader does not try to use a device tree from
    the Linux kernel tree.
    
    * gnu/bootloader.scm (<bootloader-configuration>)[device-tree-support?]: 
New field.
    * gnu/bootloader/extlinux.scm (extlinux-configuration-file): Add FDTDIR line
    based on <device-tree-support?> field of <bootloader-configuration>.
    * doc/guix.texi (Bootloader Configuration)[device-tree-support?]: Add
    documentation for the new field.
---
 doc/guix.texi               |  9 +++++++++
 gnu/bootloader.scm          |  6 +++++-
 gnu/bootloader/extlinux.scm | 12 ++++++++++--
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 7199ff6bc2..3c575dad11 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -37439,6 +37439,15 @@ corresponds to COM1 (@pxref{Serial terminal,,, 
grub,GNU GRUB manual}).
 The speed of the serial interface, as an integer.  For GRUB, the
 default value is chosen at run-time; currently GRUB chooses
 9600@tie{}bps (@pxref{Serial terminal,,, grub,GNU GRUB manual}).
+
+@item @code{device-tree-support?} (default: @code{#t})
+Whether to support Linux @uref{https://en.wikipedia.org/wiki/Devicetree,
+device tree} files loading.
+
+This option in enabled by default.  In some cases involving the
+@code{u-boot} bootloader, where the device tree has already been loaded
+in RAM, it can be handy to disable the option by setting it to
+@code{#f}.
 @end table
 
 @end deftp
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 2eec48693c..7d076ec51c 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2019, 2021 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
+;;; Copyright © 2022 Reza Alizadeh Majd <r.majd@pantherx.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -72,6 +73,7 @@
             bootloader-configuration-terminal-inputs
             bootloader-configuration-serial-unit
             bootloader-configuration-serial-speed
+            bootloader-configuration-device-tree-support?
 
             %bootloaders
             lookup-bootloader-by-name
@@ -232,7 +234,9 @@ instead~%")))
   (serial-unit        bootloader-configuration-serial-unit ;integer | #f
                       (default #f))
   (serial-speed       bootloader-configuration-serial-speed ;integer | #f
-                      (default #f)))
+                      (default #f))
+  (device-tree-support? bootloader-configuration-device-tree-support?
+                        (default #t)))  ;boolean
 
 (define-deprecated (bootloader-configuration-target config)
   bootloader-configuration-targets
diff --git a/gnu/bootloader/extlinux.scm b/gnu/bootloader/extlinux.scm
index 6b5ff298e7..d9b6d8bf8a 100644
--- a/gnu/bootloader/extlinux.scm
+++ b/gnu/bootloader/extlinux.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017 David Craven <david@craven.ch>
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2022 Reza Alizadeh Majd <r.majd@pantherx.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -38,6 +39,9 @@ corresponding to old generations of the system."
   (define all-entries
     (append entries (bootloader-configuration-menu-entries config)))
 
+  (define with-fdtdir?
+    (bootloader-configuration-device-tree-support? config))
+
   (define (menu-entry->gexp entry)
     (let ((label (menu-entry-label entry))
           (kernel (menu-entry-linux entry))
@@ -46,12 +50,16 @@ corresponding to old generations of the system."
       #~(format port "LABEL ~a
   MENU LABEL ~a
   KERNEL ~a
-  FDTDIR ~a/lib/dtbs
+  ~a
   INITRD ~a
   APPEND ~a
 ~%"
                 #$label #$label
-                #$kernel (dirname #$kernel) #$initrd
+                #$kernel
+                (if #$with-fdtdir?
+                    (string-append "FDTDIR " (dirname #$kernel) "/lib/dtbs")
+                    "")
+                #$initrd
                 (string-join (list #$@kernel-arguments)))))
 
   (define builder



reply via email to

[Prev in Thread] Current Thread [Next in Thread]