mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
f171385ab4
* gnu/bootloader/depthcharge (install-depthcharge): Add procedure. (signed-kernel, depthcharge-configuration-file): Remove procedures. (depthcharge-veyron-speedy-bootloader): Update depthcharge-bootloader. (depthcharge-bootloader): Deprecate variable. * doc/guix.texi (Bootloader Configuration): Document bootloader. Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739
104 lines
4.5 KiB
Scheme
104 lines
4.5 KiB
Scheme
;;; 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)
|