unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob c3ab6f32759804b12e8fe82cb8f5d6d2a3ef86bf 4620 bytes (raw)
name: gnu/bootloader/extlinux.scm 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
 
;;; 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>
;;; Copyright © 2024 Lilah Tascheter <lilah@lunabee.space>
;;;
;;; 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 (gnu system boot)
  #:use-module (guix gexp)
  #:use-module (guix deprecation)
  #:use-module (guix records)
  #:use-module (guix utils)
  #:export (install-extlinux-config ; for u-boot
            extlinux-bootloader
            extlinux-gpt-bootloader
            extlinux-bootloader-gpt))

\f
;;;
;;; Config procedures.
;;;

(define* (install-extlinux-config #:key bootloader-config
                                        current-boot-alternative
                                        old-boot-alternatives
                                  #:allow-other-keys)
  "Installer for the extlinux configuration file, meant to be shared by all
bootloaders that use the format to specify boot options."
  (match-record bootloader-config <bootloader-configuration>
    (targets menu-entries device-tree-support? timeout)
    (define (menu-entry->gexp entry)
      (match-record entry <menu-entry> (label linux linux-arguments initrd)
        (let* ((normkern (normalize-file entry linux))
               (fdt #~(string-append "FDTDIR" (dirname #$normkern) "/lib/dtbs")))
          #~(format port "LABEL ~a
  MENU LABEL ~a
  KERNEL ~a
  ~a
  INITRD ~a
  APPEND ~a
~%"                 #$label #$label #$normkern
                    #$(if device-tree-support? fdt "")
                    #$(normalize-file entry initrd)
                    (string-join (list #$@linux-arguments))))))

    (let ((ents (cons (boot-alternative->menu-entry current-boot-alternative)
                  (append menu-entries
                    (map boot-alternative->menu-entry old-boot-alternatives)))))
      (with-targets targets
        (('extlinux => (path :path))
         #~(begin (mkdir-p #$path)
             (call-with-output-file #$path
               (lambda (port)
                 (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~%"      ;; timeout is expressed in tenths of a second
                   #$(if (> timeout 0) 1 0) #$(* 10 timeout))
                 #$@(map menu-entry->gexp ents)))))))))

\f
;;;
;;; Install procedure.
;;;

(define (install-extlinux mbr)
  (lambda* (#:key bootloader-config #:allow-other-keys . args)
    (with-targets (bootloader-configuration-targets bootloader-config)
      (('extlinux => (path :path))
       #~(begin
           #$(apply install-extlinux-config args)
           (copy-recursively #$(file-append syslinux "/share/syslinux") #$path)
           (invoke/quiet #+(file-append syslinux "/sbin/extlinux")
                         "--install" #$path)))
      (('disk => (disk :device))
       #~(write-file-on-device #$(file-append syslinux "/share/syslinux/" mbr)
                               440 #$disk 0)))))


\f
;;;
;;; Bootloader definitions.
;;;

(define extlinux-bootloader
  (bootloader
    (name 'extlinux)
    (default-targets (list (bootloader-target
                             (type 'install)
                             (offset 'root)
                             (path "boot"))
                           (bootloader-target
                             (type 'extlinux)
                             (offset 'install)
                             (path "extlinux"))))
    (installer (install-extlinux "mbr.bin"))))

(define extlinux-gpt-bootloader
  (bootloader
    (inherit extlinux-bootloader)
    (installer (install-extlinux "gptmbr.bin"))))

(define-deprecated/alias extlinux-bootloader-gpt extlinux-gpt-bootloader)

debug log:

solving c3ab6f3275 ...
found c3ab6f3275 in https://yhetil.org/guix-patches/72fc11d9e6fe8b32a2afccd684371bacbb5a24b8.1722741997.git.lilah@lunabee.space/ ||
	https://yhetil.org/guix-patches/d0f0139cc4f40654de5e8c349eff4d5f59948c44.1722794774.git.lilah@lunabee.space/ ||
	https://yhetil.org/guix-patches/37d9ed7280f720a59d8659cb716502c5c2c8fa73.1722803521.git.lilah@lunabee.space/ ||
	https://yhetil.org/guix-patches/0425b46c66e8328ee6b2364d8fd827b2cb9c955f.1722912293.git.lilah@lunabee.space/ ||
	https://yhetil.org/guix-patches/618b1179224d966f44d8a7bd1461a31dfb3fd7da.1722989488.git.lilah@lunabee.space/
found d9b6d8bf8a in https://git.savannah.gnu.org/cgit/guix.git
preparing index
index prepared:
100644 d9b6d8bf8a20de089d435500ac49a073e67f034f	gnu/bootloader/extlinux.scm

applying [1/1] https://yhetil.org/guix-patches/72fc11d9e6fe8b32a2afccd684371bacbb5a24b8.1722741997.git.lilah@lunabee.space/
diff --git a/gnu/bootloader/extlinux.scm b/gnu/bootloader/extlinux.scm
index d9b6d8bf8a..c3ab6f3275 100644

Checking patch gnu/bootloader/extlinux.scm...
Applied patch gnu/bootloader/extlinux.scm cleanly.

skipping https://yhetil.org/guix-patches/d0f0139cc4f40654de5e8c349eff4d5f59948c44.1722794774.git.lilah@lunabee.space/ for c3ab6f3275
skipping https://yhetil.org/guix-patches/37d9ed7280f720a59d8659cb716502c5c2c8fa73.1722803521.git.lilah@lunabee.space/ for c3ab6f3275
skipping https://yhetil.org/guix-patches/0425b46c66e8328ee6b2364d8fd827b2cb9c955f.1722912293.git.lilah@lunabee.space/ for c3ab6f3275
skipping https://yhetil.org/guix-patches/618b1179224d966f44d8a7bd1461a31dfb3fd7da.1722989488.git.lilah@lunabee.space/ for c3ab6f3275
index at:
100644 c3ab6f32759804b12e8fe82cb8f5d6d2a3ef86bf	gnu/bootloader/extlinux.scm

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).