all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob b727874a40f92586019f5f17b45e72d7049f5f1d 4564 bytes (raw)
name: gnu/bootloader/depthcharge.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
 
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
;;; 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 depthcharge)
  #: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 diagnostics)
  #:use-module (guix i18n)
  #:use-module (guix records)
  #:use-module (guix utils)
  #:use-module (srfi srfi-26)
  #:use-module (srfi srfi-35)
  #:export (depthcharge-veyron-speedy-bootloader
            depthcharge-bootloader))

(define* (install-depthcharge arch dtb
                              #:key bootloader-config current-boot-alternative
                              #:allow-other-keys)
  (when (not (null? (bootloader-configuration-menu-entries bootloader-config)))
    (raise (formatted-message
             (G_ "extra menu-entries are not supported for depthcharge!"))))
  (with-targets (bootloader-configuration-targets bootloader-config)
    ;; use 'part instead of 'disk, cause we write an image directly into a
    ;; partition instead of the extra-partition disk space
    (('part => (disk :device))
     (match-menu-entry
       (boot-alternative->menu-entry current-boot-alternative)
       (linux linux-arguments initrd)
       #~(begin
           (use-modules (ice-9 binary-ports) (rnrs bytevectors))
           (set-path-environment-variable "PATH" '("bin") (list #$dtc))

           ;; TODO: These files have to be writable, so we copy them.
           ;; This can probably be fixed by using a ".its" file, just
           ;; be careful not to break initrd loading.
           (copy-file #$linux "zImage")
           (chmod "zImage" #o755)
           (copy-file (string-append (dirname #$linux) "/lib/dtbs/" #$dtb)
                      "dtb")
           (chmod "dtb" #o644)
           (copy-file #$initrd "initrd")
           (chmod "initrd" #o644)

           (invoke #+(file-append u-boot-tools "/bin/mkimage")
                     "-D" "-I dts -O dtb -p 2048"
                     "-f" "auto" ; format
                     "-A" #$arch ; architecture
                     "-O" "linux" ; os
                     "-T" "kernel" ; image type
                     "-C" "None" ; compression
                     "-d" "zImage" ; image data
                     "-a" "0" ; load address (hex)
                     "-b" "dtb" ; dtb for device
                     "-i" "initrd" ; initrd
                     "image.itb")
           (call-with-output-file "bootloader.bin"
             (lambda (port)
               (put-bytevector port (make-bytevector 512 0))))
           (call-with-output-file "kernel-arguments"
             (lambda (port)
               (display (string-join (list #$@linux-arguments)) port)))
           (invoke #+(file-append vboot-utils "/bin/vbutil_kernel")
                   "--version" "1"
                   "--vmlinuz" "image.itb"
                   "--arch" #$arch
                   "--keyblock"
                   #$(file-append vboot-utils
                       "/share/vboot-utils/devkeys/kernel.keyblock")
                   "--signprivate"
                   #$(file-append vboot-utils
                       "/share/vboot-utils/devkeys/kernel_data_key.vbprivk")
                   "--config" "kernel-arguments"
                   "--pack" "vmlinux.kpart")
           (write-file-on-device "vmlinux.kpart"
                                 (stat:size (stat "vmlinux.kpart"))
                                 #$disk 0))))))

(define depthcharge-veyron-speedy-bootloader
  (bootloader
   (name 'depthcharge)
   (installer (cute install-depthcharge "arm" "rk3288-veyron-speedy.dtb"
                    <...>))))

(define-deprecated/alias depthcharge-bootloader
  depthcharge-veyron-speedy-bootloader)

debug log:

solving b727874a40 ...
found b727874a40 in https://yhetil.org/guix/2e3abe65f5bc59efc50675ebb87f438a7a081325.1727201267.git.herman@rimm.ee/
found 0a50374bd9 in https://git.savannah.gnu.org/cgit/guix.git
preparing index
index prepared:
100644 0a50374bd9bc71982eba2f702873b90fba32cace	gnu/bootloader/depthcharge.scm

applying [1/1] https://yhetil.org/guix/2e3abe65f5bc59efc50675ebb87f438a7a081325.1727201267.git.herman@rimm.ee/
diff --git a/gnu/bootloader/depthcharge.scm b/gnu/bootloader/depthcharge.scm
index 0a50374bd9..b727874a40 100644

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

index at:
100644 b727874a40f92586019f5f17b45e72d7049f5f1d	gnu/bootloader/depthcharge.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.