aboutsummaryrefslogtreecommitdiff
path: root/gnu/bootloader/depthcharge.scm
blob: 0a50374bd9bc71982eba2f702873b90fba32cace (about) (plain)
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
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
;;;
;;; 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 extlinux)
  #:use-module (gnu bootloader)
  #:use-module (gnu packages bootloaders)
  #:use-module (guix gexp)
  #:use-module (guix utils)
  #:use-module (ice-9 match)
  #:export (depthcharge-bootloader))

(define (signed-kernel kernel kernel-arguments initrd)
  (define builder
    (with-imported-modules '((guix build utils))
      #~(begin
          (use-modules (guix build utils)
                       (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 #$kernel "zImage")
          (chmod "zImage" #o755)
          (copy-file (string-append (dirname #$kernel) "/lib/dtbs/"
                                    "rk3288-veyron-speedy.dtb")
                     "rk3288-veyron-speedy.dtb")
          (chmod "rk3288-veyron-speedy.dtb" #o644)
          (copy-file #$initrd "initrd")
          (chmod "initrd" #o644)

          (invoke (string-append #$u-boot-tools "/bin/mkimage")
                  "-D" "-I dts -O dtb -p 2048"
		  "-f" "auto"
                  "-A" "arm"
                  "-O" "linux"
                  "-T" "kernel"
                  "-C" "None"
                  "-d" "zImage"
                  "-a" "0"
                  "-b" "rk3288-veyron-speedy.dtb"
                  "-i" "initrd"
	          "image.itb")
          (call-with-output-file "bootloader.bin"
            (lambda (port)
              (put-bytevector port (make-bytevector 512 0))))
          (with-output-to-file "kernel-arguments"
	    (lambda ()
	      (display (string-join (list #$@kernel-arguments)))))
          (invoke (string-append #$vboot-utils "/bin/vbutil_kernel")
                  "--pack" #$output
                  "--version" "1"
                  "--vmlinuz" "image.itb"
		  "--arch" "arm"
		  "--keyblock" (string-append #$vboot-utils
                                              "/share/vboot-utils/devkeys/"
                                              "kernel.keyblock")
		  "--signprivate" (string-append #$vboot-utils
                                                 "/share/vboot-utils/devkeys/"
                                                 "kernel_data_key.vbprivk")
                  "--config" "kernel-arguments"
                  "--bootloader" "bootloader.bin"))))
  (computed-file "vmlinux.kpart" builder))

(define* (depthcharge-configuration-file config entries
                                         #: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
   (name 'depthcharge)
   (package #f)
   (installer install-depthcharge)
   (configuration-file "/boot/depthcharge/vmlinux.kpart")
   (configuration-file-generator depthcharge-configuration-file)))
g only on supported systems.Ludovic Courtès This lets us build Mate on i686-linux. * gnu/packages/mate.scm (mate)[inputs]: Add GNOME-KEYRING conditionally. 2022-11-22gnu: gnome-keyring: Mark as 64-bit-only.Ludovic Courtès * gnu/packages/gnome.scm (gnome-keyring)[supported-systems]: New field. 2022-11-22gnu: mate: Remove input labels.Ludovic Courtès * gnu/packages/mate.scm (mate)[inputs]: Remove labels. 2022-11-22gnu: zbackup: Build with protobuf@3.6.Marius Bakke * gnu/packages/backup.scm (zbackup)[inputs]: Change from PROTOBUF to PROTOBUF-3.6. 2022-11-22gnu: perl-conf-libconfig: Update to 0.101.Marius Bakke * gnu/packages/perl.scm (perl-conf-libconfig): Update to 0.101. 2022-11-22gnu: slurm-monitor: Update to 0.4.4.Marius Bakke * gnu/packages/networking.scm (slurm-monitor): Update to 0.4.4. [build-system]: Change to MESON-BUILD-SYSTEM. [native-inputs]: Add PKG-CONFIG. 2022-11-22gnu: remake: Update to 4.3-1.6.Marius Bakke * gnu/packages/debug.scm (remake): Update to 4.3-1.6. 2022-11-22gnu: python-py3dns: Fix build failure.Marius Bakke * gnu/packages/python-xyz.scm (python-py3dns)[arguments]: Remove sanity check. 2022-11-22gnu: python-parallel: Add missing input.Marius Bakke * gnu/packages/python-xyz.scm (python-parallel)[propagated-inputs]: Add PYTHON-SIX. 2022-11-22gnu: Remove python-enum34.Marius Bakke This compatibility package fails to build and has no users in Guix. * gnu/packages/python-xyz.scm (python-enum34): Remove variable. 2022-11-22gnu: python-rnc2rng: Update to 2.6.6.Marius Bakke * gnu/packages/python-xyz.scm (python-rnc2rng): Update to 2.6.6. 2022-11-22gnu: python-bigfloat: Update to 0.4.0.Marius Bakke * gnu/packages/python-xyz.scm (python-bigfloat): Update to 0.4.0. [propagated-inputs]: Add PYTHON-SIX. 2022-11-22gnu: python-socksipychain: Add missing input.Marius Bakke * gnu/packages/python-xyz.scm (python-socksipychain)[propagated-inputs]: Add PYTHON-SIX. 2022-11-22gnu: nickle: Update to 2.90.Marius Bakke * gnu/packages/nickle.scm (nickle): Update to 2.90. 2022-11-22gnu: neatmail: Fix build.Marius Bakke * gnu/packages/mail.scm (neatmail)[arguments]: Fix quoting issue. 2022-11-22gnu: libwindowswm: Add missing input.Marius Bakke * gnu/packages/xorg.scm (libwindowswm)[inputs]: Add WINDOWSWMPROTO. 2022-11-22gnu: libsbsms: Fix build.Marius Bakke * gnu/packages/audio.scm (libsbsms)[arguments]: Adjust path to ar-lib. 2022-11-22gnu: Remove libbson.Marius Bakke This package fails to build and has been deprecated since 2018: https://github.com/mongodb/libbson * gnu/packages/serialization.scm (libbson): Remove variable. 2022-11-22gnu: ifstatus: Update to 2.0.0.Marius Bakke * gnu/packages/networking.scm (ifstatus): Update to 2.0.0. [source](uri): Adjust. [source](modules, snippet): Remove. 2022-11-22gnu: ecl: Remove 16.1.3.Marius Bakke This package fails to build and has no users in Guix. * gnu/packages/sagemath.scm (ecl-16): Remove variable. * gnu/packages/patches/ecl-16-format-directive-limit.patch, gnu/packages/patches/ecl-16-ignore-stderr-write-error.patch, gnu/packages/patches/ecl-16-libffi.patch: Delete files. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. 2022-11-22gnu: dune-alugrid: Fix build failure.Marius Bakke * gnu/packages/maths.scm (dune-alugrid)[arguments]: Provide the INPUTS key in build-tests phase. 2022-11-22gnu: kmail: Build with gpgme@1.18.Marius Bakke * gnu/packages/kde-pim.scm (kmail)[inputs]: Change from GPGME and QGPGME to GPGME-1.18 and QGPGME-1.18. 2022-11-22gnu: kleopatra: Build with gpgme@1.18.Marius Bakke * gnu/packages/kde-pim.scm (kleopatra)[inputs]: Change from GPGME and QGPGME to GPGME-1.18 and QGPGME-1.18. 2022-11-22gnu: gpgme: Add 1.18.0.Marius Bakke * gnu/packages/gnupg.scm (gpgme-1.18, qgpgme-1.18): New variables. 2022-11-22gnu: ashuffle: Update to 3.13.4.Marius Bakke * gnu/packages/mpd.scm (ashuffle): Update to 3.13.4. [inputs]: Add ABSEIL-CPP-CXXSTD17, GOOGLETEST, and YAML-CPP. [arguments]: New field. 2022-11-22gnu: protobuf@3.5: Inherit from protobuf@3.6.Marius Bakke * gnu/packages/protobuf.scm (protobuf-3.5): Change inheritance, so it gets the correct build system and phases. 2022-11-22gnu: arpack-ng: Remove 3.3.0.Marius Bakke This package fails to build and has no users in Guix. * gnu/packages/maths.scm (arpack-ng-3.3.0): Remove variable. 2022-11-22gnu: Remove acme-client.Marius Bakke This package does not build and has been unmaintained since 2018: https://github.com/kristapsdz/acme-client-portable/commit/ba153daacb62d8a24fef6d6a5a737d2eff607509 * gnu/packages/tls.scm (acme-client): Remove variable. 2022-11-21gnu: Add texlive-mathdots.Yarl Baudig * gnu/packages/tex.scm (texlive-mathdots): New variable. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> 2022-11-21gnu: emacs-ob-restclient: Update to 0.02-3.1b021ce.Michael Rohleder * gnu/packages/emacs-xyz.scm (emacs-ob-restclient): Update to 0.02-3.1b021ce. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> 2022-11-21gnu: emacs-restclient: Update to 0-4.1fb5706.Michael Rohleder * gnu/packages/emacs-xyz.scm (emacs-restclient): Update to 0-4.1fb5706. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> 2022-11-21gnu: wob: Update to 0.14.2.Nicolas Goaziou * gnu/packages/xdisorg.scm (wob): Update to 0.14.2. [inputs]: Add LIBINIH. 2022-11-21gnu: emacs-pg: Update to 0.19.Nicolas Goaziou * gnu/packages/emacs-xyz.scm (emacs-pg): Update to 0.19.