mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
gnu: bootloader: depthcharge: Rewrite completely.
* 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
This commit is contained in:
parent
a95413d299
commit
f171385ab4
2 changed files with 81 additions and 79 deletions
|
@ -42251,6 +42251,12 @@ modules. In particular, @code{(gnu bootloader u-boot)} contains definitions
|
||||||
of bootloaders for a wide range of ARM and AArch64 systems, using the
|
of bootloaders for a wide range of ARM and AArch64 systems, using the
|
||||||
@uref{https://www.denx.de/wiki/U-Boot/, U-Boot bootloader}.
|
@uref{https://www.denx.de/wiki/U-Boot/, U-Boot bootloader}.
|
||||||
|
|
||||||
|
@itemize
|
||||||
|
@vindex depthcharge-veyron-speedy-bootloader
|
||||||
|
@item @code{depthcharge-veyron-speedy-bootloader}
|
||||||
|
For the Asus C201. Requires a @code{'part} target, denoting the partition to
|
||||||
|
install the kernel blob as a @code{device}, @code{label}, or @code{uuid}.
|
||||||
|
|
||||||
@vindex grub-bootloader
|
@vindex grub-bootloader
|
||||||
@code{grub-bootloader} allows you to boot in particular Intel-based machines
|
@code{grub-bootloader} allows you to boot in particular Intel-based machines
|
||||||
in ``legacy'' BIOS mode.
|
in ``legacy'' BIOS mode.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
|
;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
|
||||||
|
;;; Copyright © 2024 Lilah Tascheter <lilah@lunabee.space>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -17,92 +18,87 @@
|
||||||
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
(define-module (gnu bootloader depthcharge)
|
(define-module (gnu bootloader depthcharge)
|
||||||
#:use-module (gnu bootloader extlinux)
|
|
||||||
#:use-module (gnu bootloader)
|
#:use-module (gnu bootloader)
|
||||||
#:use-module (gnu packages bootloaders)
|
#:use-module (gnu packages bootloaders)
|
||||||
|
#:use-module (gnu system boot)
|
||||||
#:use-module (guix gexp)
|
#: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 (guix utils)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (srfi srfi-26)
|
||||||
#:export (depthcharge-bootloader))
|
#:use-module (srfi srfi-35)
|
||||||
|
#:export (depthcharge-veyron-speedy-bootloader
|
||||||
|
depthcharge-bootloader))
|
||||||
|
|
||||||
(define (signed-kernel kernel kernel-arguments initrd)
|
(define* (install-depthcharge arch dtb
|
||||||
(define builder
|
#:key bootloader-config current-boot-alternative
|
||||||
(with-imported-modules '((guix build utils))
|
#:allow-other-keys)
|
||||||
#~(begin
|
(when (not (null? (bootloader-configuration-menu-entries bootloader-config)))
|
||||||
(use-modules (guix build utils)
|
(raise (formatted-message
|
||||||
(ice-9 binary-ports)
|
(G_ "extra menu-entries are not supported for depthcharge!"))))
|
||||||
(rnrs bytevectors))
|
(with-targets (bootloader-configuration-targets bootloader-config)
|
||||||
(set-path-environment-variable "PATH" '("bin") (list #$dtc))
|
;; 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.
|
;; TODO: These files have to be writable, so we copy them.
|
||||||
;; This can probably be fixed by using a ".its" file, just
|
;; This can probably be fixed by using a ".its" file, just
|
||||||
;; be careful not to break initrd loading.
|
;; be careful not to break initrd loading.
|
||||||
(copy-file #$kernel "zImage")
|
(copy-file #$linux "zImage")
|
||||||
(chmod "zImage" #o755)
|
(chmod "zImage" #o755)
|
||||||
(copy-file (string-append (dirname #$kernel) "/lib/dtbs/"
|
(copy-file (string-append (dirname #$linux) "/lib/dtbs/" #$dtb)
|
||||||
"rk3288-veyron-speedy.dtb")
|
"dtb")
|
||||||
"rk3288-veyron-speedy.dtb")
|
(chmod "dtb" #o644)
|
||||||
(chmod "rk3288-veyron-speedy.dtb" #o644)
|
(copy-file #$initrd "initrd")
|
||||||
(copy-file #$initrd "initrd")
|
(chmod "initrd" #o644)
|
||||||
(chmod "initrd" #o644)
|
|
||||||
|
|
||||||
(invoke (string-append #$u-boot-tools "/bin/mkimage")
|
(invoke #+(file-append u-boot-tools "/bin/mkimage")
|
||||||
"-D" "-I dts -O dtb -p 2048"
|
"-D" "-I dts -O dtb -p 2048"
|
||||||
"-f" "auto"
|
"-f" "auto" ; format
|
||||||
"-A" "arm"
|
"-A" #$arch ; architecture
|
||||||
"-O" "linux"
|
"-O" "linux" ; os
|
||||||
"-T" "kernel"
|
"-T" "kernel" ; image type
|
||||||
"-C" "None"
|
"-C" "None" ; compression
|
||||||
"-d" "zImage"
|
"-d" "zImage" ; image data
|
||||||
"-a" "0"
|
"-a" "0" ; load address (hex)
|
||||||
"-b" "rk3288-veyron-speedy.dtb"
|
"-b" "dtb" ; dtb for device
|
||||||
"-i" "initrd"
|
"-i" "initrd" ; initrd
|
||||||
"image.itb")
|
"image.itb")
|
||||||
(call-with-output-file "bootloader.bin"
|
(call-with-output-file "bootloader.bin"
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
(put-bytevector port (make-bytevector 512 0))))
|
(put-bytevector port (make-bytevector 512 0))))
|
||||||
(with-output-to-file "kernel-arguments"
|
(call-with-output-file "kernel-arguments"
|
||||||
(lambda ()
|
(lambda (port)
|
||||||
(display (string-join (list #$@kernel-arguments)))))
|
(display (string-join (list #$@linux-arguments)) port)))
|
||||||
(invoke (string-append #$vboot-utils "/bin/vbutil_kernel")
|
(invoke #+(file-append vboot-utils "/bin/vbutil_kernel")
|
||||||
"--pack" #$output
|
"--version" "1"
|
||||||
"--version" "1"
|
"--vmlinuz" "image.itb"
|
||||||
"--vmlinuz" "image.itb"
|
"--arch" #$arch
|
||||||
"--arch" "arm"
|
"--keyblock"
|
||||||
"--keyblock" (string-append #$vboot-utils
|
#$(file-append vboot-utils
|
||||||
"/share/vboot-utils/devkeys/"
|
"/share/vboot-utils/devkeys/kernel.keyblock")
|
||||||
"kernel.keyblock")
|
"--signprivate"
|
||||||
"--signprivate" (string-append #$vboot-utils
|
#$(file-append vboot-utils
|
||||||
"/share/vboot-utils/devkeys/"
|
"/share/vboot-utils/devkeys/kernel_data_key.vbprivk")
|
||||||
"kernel_data_key.vbprivk")
|
"--config" "kernel-arguments"
|
||||||
"--config" "kernel-arguments"
|
"--pack" "vmlinux.kpart")
|
||||||
"--bootloader" "bootloader.bin"))))
|
(write-file-on-device "vmlinux.kpart"
|
||||||
(computed-file "vmlinux.kpart" builder))
|
(stat:size (stat "vmlinux.kpart"))
|
||||||
|
#$disk 0))))))
|
||||||
|
|
||||||
(define* (depthcharge-configuration-file config entries
|
(define depthcharge-veyron-speedy-bootloader
|
||||||
#:key
|
|
||||||
(system (%current-system))
|
|
||||||
(old-entries '())
|
|
||||||
#:allow-other-keys)
|
|
||||||
(match entries
|
|
||||||
((entry)
|
|
||||||
(let ((kernel (menu-entry-linux entry))
|
|
||||||
(kernel-arguments (menu-entry-linux-arguments entry))
|
|
||||||
(initrd (menu-entry-initrd entry)))
|
|
||||||
;; XXX: Make this a symlink.
|
|
||||||
(signed-kernel kernel kernel-arguments initrd)))
|
|
||||||
(_ (error "Too many bootloader menu entries!"))))
|
|
||||||
|
|
||||||
(define install-depthcharge
|
|
||||||
#~(lambda (bootloader device mount-point)
|
|
||||||
(let ((kpart (string-append mount-point
|
|
||||||
"/boot/depthcharge/vmlinux.kpart")))
|
|
||||||
(write-file-on-device kpart (stat:size (stat kpart)) device 0))))
|
|
||||||
|
|
||||||
(define depthcharge-bootloader
|
|
||||||
(bootloader
|
(bootloader
|
||||||
(name 'depthcharge)
|
(name 'depthcharge)
|
||||||
(package #f)
|
(installer (cute install-depthcharge "arm" "rk3288-veyron-speedy.dtb"
|
||||||
(installer install-depthcharge)
|
<...>))))
|
||||||
(configuration-file "/boot/depthcharge/vmlinux.kpart")
|
|
||||||
(configuration-file-generator depthcharge-configuration-file)))
|
(define-deprecated/alias depthcharge-bootloader
|
||||||
|
depthcharge-veyron-speedy-bootloader)
|
||||||
|
|
Loading…
Reference in a new issue