aboutsummaryrefslogtreecommitdiff
;;; 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.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu bootloader extlinux)
  #:use-module (gnu bootloader)
  #:use-module (gnu packages bootloaders)
  #:use-module (guix gexp)
  #:use-module (guix utils)
  #:export (extlinux-bootloader
            extlinux-bootloader-gpt))

(define* (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 with-fdtdir?
    (bootloader-configuration-device-tree-support? 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
  ~a
  INITRD ~a
  APPEND ~a
~%"
                #$label #$label
                #$kernel
                (if #$with-fdtdir?
                    (string-append "FDTDIR " (dirname #$kernel) "/lib/dtbs")
                    "")
                #$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)))




;;;
;;; Install procedures.
;;;

(define (install-extlinux mbr)
  #~(lambda (bootloader device mount-point)
      (let ((extlinux (string-append bootloader "/sbin/extlinux"))
            (install-dir (string-append mount-point "/boot/extlinux"))
            (syslinux-dir (string-append bootloader "/share/syslinux")))
        (for-each (lambda (file)
                    (install-file file install-dir))
                  (find-files syslinux-dir "\\.c32$"))
        (invoke/quiet extlinux "--install" install-dir)
        (write-file-on-device (string-append syslinux-dir "/" #$mbr)
                              440 device 0))))

(define install-extlinux-mbr
  (install-extlinux "mbr.bin"))

(define install-extlinux-gpt
  (install-extlinux "gptmbr.bin"))



;;;
;;; Bootloader definitions.
;;;

(define extlinux-bootloader
  (bootloader
   (name 'extlinux)
   (package syslinux)
   (installer install-extlinux-mbr)
   (configuration-file "/boot/extlinux/extlinux.conf")
   (configuration-file-generator extlinux-configuration-file)))

(define extlinux-bootloader-gpt
  (bootloader
   (inherit extlinux-bootloader)
   (installer install-extlinux-gpt)))
es/geo.scm, gnu/packages/ghostscript.scm, gnu/packages/gl.scm, gnu/packages/glib.scm, gnu/packages/gnome.scm, gnu/packages/gnuzilla.scm, gnu/packages/graphics.scm, gnu/packages/gtk.scm, gnu/packages/guile.scm, gnu/packages/irc.scm, gnu/packages/java.scm, gnu/packages/kerberos.scm, gnu/packages/linux.scm, gnu/packages/lisp.scm, gnu/packages/lxde.scm, gnu/packages/machine-learning.scm, gnu/packages/mail.scm, gnu/packages/maths.scm, gnu/packages/messaging.scm, gnu/packages/monitoring.scm, gnu/packages/mp3.scm, gnu/packages/music.scm, gnu/packages/netpbm.scm, gnu/packages/networking.scm, gnu/packages/node.scm, gnu/packages/nvi.scm, gnu/packages/ocaml.scm, gnu/packages/pdf.scm, gnu/packages/perl.scm, gnu/packages/php.scm, gnu/packages/plotutils.scm, gnu/packages/pretty-print.scm, gnu/packages/profiling.scm, gnu/packages/pulseaudio.scm, gnu/packages/python-crypto.scm, gnu/packages/python.scm, gnu/packages/qt.scm, gnu/packages/robotics.scm, gnu/packages/sawfish.scm, gnu/packages/scanner.scm, gnu/packages/scheme.scm, gnu/packages/scribus.scm, gnu/packages/sdl.scm, gnu/packages/serialization.scm, gnu/packages/shells.scm, gnu/packages/slang.scm, gnu/packages/smalltalk.scm, gnu/packages/ssh.scm, gnu/packages/sync.scm, gnu/packages/syncthing.scm, gnu/packages/tbb.scm, gnu/packages/terminals.scm, gnu/packages/texinfo.scm, gnu/packages/text-editors.scm, gnu/packages/textutils.scm, gnu/packages/tls.scm, gnu/packages/unrtf.scm, gnu/packages/version-control.scm, gnu/packages/video.scm, gnu/packages/vpn.scm, gnu/packages/web.scm, gnu/packages/wm.scm, gnu/packages/wxwidgets.scm, gnu/packages/xdisorg.scm, gnu/packages/xorg.scm: In all snippets, report errors using exceptions, or else return #t. Mark H Weaver 2018-03-12gnu: node: Use more unbundled dependencies....* gnu/packages/node.scm (node)[inputs]: Add icu4c and nghttp2. [native-inputs]: Add pkg-config. [arguments]: Add configure flags for using system libraries. [source]: Remove bundled dependencies. Jelle Licht 2018-03-12gnu: node: Update to 9.8.0....* gnu/packages/node.scm (node): Update to 9.8.0. [arguments]: Remove 'doc-only' workaround. Re-enable fixed tests. Jelle Licht 2018-02-02gnu: node: Update to 9.4.0....* gnu/packages/node.scm (node): Update to 9.4.0. [arguments]: Remove all tests that depend on eslint being available. Remove reference to deleted test. Removed networking test. Jelle Licht 2017-12-25gnu: node: Update to 9.3.0....* gnu/packages/patches/node-test-http2-server-rst-stream.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. * gnu/packages/node.scm (node): Update to 9.3.0. [source]: Remove 'node-test-http2-server-rst-stream.patch'. [arguments]: Remove all tests that depend on eslint being available. Re-enable fixed test. Jelle Licht 2017-11-28gnu: node: Update to 8.9.1....* gnu/packages/node.scm (node): Update to 8.9.1. [source]: Apply 'node-test-http2-server-rst-stream.patch'. [arguments]: Skip 'doc-only' target in 'check', which attempts to use npm to retrieve 'js-yaml' package. Remove test/doctool/test-make-doc.js. Do not remove now-missing test case. Remove new test case that fails in containers due to networking. * gnu/packages/patches/node-test-http2-server-rst-stream.patch: New file. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Mike Gerwitz 2017-10-26gnu: node: Update to 8.7.0....* gnu/packages/node.scm (node): Update to 8.7.0. (node)[arguments]: Removed dgram mutlicast test. Removed dns test. Removed broken linter test workaround. Jelle Licht 2017-09-02gnu: node: Update to 8.4.0....* gnu/packages/patches/node-9077.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. * gnu/packages/node.scm (node): Update to 8.4.0. (node)[arguments]: Removed broken linter test. Removed dns test. Jelle Licht 2017-07-18gnu: node: Add search path specification for 'NODE_PATH'....* gnu/packages/node.scm (node)[native-search-paths]: New field. Jelle Licht 2017-06-29gnu: node: Update to 8.1.2....* gnu/packages/node.scm (node): Update to 8.1.2. (node)[arguments]: Disabled more tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Jelle Licht 2017-05-23gnu: node: Use unbundled dependencies....* gnu/packages/node.scm (node)[inputs]: Add c-ares and http-parser. [arguments]: Add configure flags for using system libraries. Signed-off-by: Marius Bakke <mbakke@fastmail.com> Jelle Licht 2017-05-23gnu: node: Update to 7.10.0....* gnu/packages/node.scm (node): Update to 7.10.0. (node)[arguments]: Disabled more tests. * gnu/packages/patches/node-9077.patch: Delete incompatible patch file. Recreate patch file from node pull request 9077. Signed-off-by: Marius Bakke <mbakke@fastmail.com> Jelle Licht 2017-04-17gnu: node: Actually set timeout to 1 h....* gnu/packages/node.scm (node)[properties]: Actually set timeout to 1 h. Danny Milosavljevic 2017-04-17gnu: node: Update to 7.8.0....* gnu/packages/node.scm (node): Update to 7.8.0. [properties]: Add timeout of 1 h. Jelle Licht