| 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 | (define-module (gnu packages bootloaders)
|
| 45 | #:use-module (gnu packages)
|
| 46 | #:use-module (gnu packages assembly)
|
| 47 | #:use-module (gnu packages autotools)
|
| 48 | #:use-module (gnu packages base)
|
| 49 | #:use-module (gnu packages disk)
|
| 50 | #:use-module (gnu packages bison)
|
| 51 | #:use-module (gnu packages build-tools)
|
| 52 | #:use-module (gnu packages cdrom)
|
| 53 | #:use-module (gnu packages check)
|
| 54 | #:use-module (gnu packages compression)
|
| 55 | #:use-module (gnu packages cross-base)
|
| 56 | #:use-module (gnu packages disk)
|
| 57 | #:use-module (gnu packages firmware)
|
| 58 | #:use-module (gnu packages compiler-tools)
|
| 59 | #:use-module (gnu packages fontutils)
|
| 60 | #:use-module (gnu packages gcc)
|
| 61 | #:use-module (gnu packages gettext)
|
| 62 | #:use-module (gnu packages guile)
|
| 63 | #:use-module (gnu packages efi)
|
| 64 | #:use-module (gnu packages linux)
|
| 65 | #:use-module (gnu packages llvm)
|
| 66 | #:use-module (gnu packages man)
|
| 67 | #:use-module (gnu packages mtools)
|
| 68 | #:use-module (gnu packages ncurses)
|
| 69 | #:use-module (gnu packages package-management)
|
| 70 | #:use-module (gnu packages perl)
|
| 71 | #:use-module (gnu packages pkg-config)
|
| 72 | #:use-module (gnu packages python)
|
| 73 | #:use-module (gnu packages python-build)
|
| 74 | #:use-module (gnu packages python-crypto)
|
| 75 | #:use-module (gnu packages texinfo)
|
| 76 | #:use-module (gnu packages tls)
|
| 77 | #:use-module (gnu packages sdl)
|
| 78 | #:use-module (gnu packages sphinx)
|
| 79 | #:use-module (gnu packages serialization)
|
| 80 | #:use-module (gnu packages swig)
|
| 81 | #:use-module (gnu packages valgrind)
|
| 82 | #:use-module (gnu packages version-control)
|
| 83 | #:use-module (gnu packages virtualization)
|
| 84 | #:use-module (gnu packages xorg)
|
| 85 | #:use-module (gnu packages python-build)
|
| 86 | #:use-module (gnu packages python-web)
|
| 87 | #:use-module (gnu packages python-xyz)
|
| 88 | #:use-module (guix build-system gnu)
|
| 89 | #:use-module (guix build-system meson)
|
| 90 | #:use-module (guix build-system pyproject)
|
| 91 | #:use-module (guix build-system trivial)
|
| 92 | #:use-module (guix deprecation)
|
| 93 | #:use-module (guix download)
|
| 94 | #:use-module (guix gexp)
|
| 95 | #:use-module (guix git-download)
|
| 96 | #:use-module ((guix licenses) #:prefix license:)
|
| 97 | #:use-module (guix packages)
|
| 98 | #:use-module (guix utils)
|
| 99 | #:use-module (srfi srfi-1)
|
| 100 | #:use-module (srfi srfi-26)
|
| 101 | #:use-module (ice-9 optargs)
|
| 102 | #:use-module (ice-9 match)
|
| 103 | #:use-module (ice-9 regex))
|
| 104 |
|
| 105 | (define unifont
|
| 106 | |
| 107 | |
| 108 | (origin
|
| 109 | (method url-fetch)
|
| 110 | (uri
|
| 111 | "http://unifoundry.com/pub/unifont-7.0.06/font-builds/unifont-7.0.06.bdf.gz")
|
| 112 | (sha256
|
| 113 | (base32
|
| 114 | "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys"))))
|
| 115 |
|
| 116 | (define*-public (make-grub platform)
|
| 117 | (package
|
| 118 | (name (string-append "grub-" platform))
|
| 119 | (version "2.14")
|
| 120 | (source (origin
|
| 121 | (method url-fetch)
|
| 122 | (uri (string-append "mirror://gnu/grub/grub-" version ".tar.xz"))
|
| 123 | (sha256
|
| 124 | (base32
|
| 125 | "0hvd8i3ib6nwymfmvd6dia6axrn4xmrlsrg2r3c3i22vadrkr3dw"))
|
| 126 | (patches (search-patches
|
| 127 | "grub-efi-fat-serial-number.patch"
|
| 128 | "grub-setup-root.patch"))
|
| 129 | (modules '((guix build utils)))
|
| 130 | (snippet
|
| 131 | #~(begin
|
| 132 | |
| 133 | (call-with-output-file "grub-core/extra_deps.lst"
|
| 134 | (lambda (port)
|
| 135 | (display "depends bli part_gpt\n" port)))
|
| 136 |
|
| 137 | |
| 138 | |
| 139 | (substitute* (find-files "tests" "\\.in$")
|
| 140 | (("exit 99") "exit 77"))))))
|
| 141 | (build-system gnu-build-system)
|
| 142 | (arguments
|
| 143 | (list #:configure-flags
|
| 144 | |
| 145 | |
| 146 | |
| 147 | #~(append
|
| 148 | (list "PYTHON=true"
|
| 149 | (string-append "--with-platform=" #$platform))
|
| 150 | |
| 151 | (if #$(and=> (%current-target-system)
|
| 152 | target-ppc64le?)
|
| 153 | (list "TARGET_CC=powerpc64le-linux-gnu-clang"
|
| 154 | "CFLAGS=-Wno-error")
|
| 155 | '())
|
| 156 | (if #$(and (target-ppc64le? (%current-system))
|
| 157 | (not (%current-target-system)))
|
| 158 | (list "CC=clang" "CFLAGS=-Wno-error")
|
| 159 | '()))
|
| 160 |
|
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | #:make-flags
|
| 166 | #~(list "TARGET_IMG_BASE_LDOPT=-Wl,-Ttext")
|
| 167 |
|
| 168 | |
| 169 | #:strip-flags
|
| 170 | #~(list "--strip-debug" "--enable-deterministic-archives")
|
| 171 |
|
| 172 | #:phases
|
| 173 | #~(modify-phases %standard-phases
|
| 174 | (add-after 'unpack 'patch-stuff
|
| 175 | (lambda* (#:key native-inputs inputs #:allow-other-keys)
|
| 176 | (substitute* "grub-core/Makefile.in"
|
| 177 | (("/bin/sh") (which "sh")))
|
| 178 |
|
| 179 | |
| 180 | |
| 181 | |
| 182 | (let ((mdadm (false-if-exception
|
| 183 | (search-input-file inputs "/sbin/mdadm"))))
|
| 184 | (when mdadm
|
| 185 | (substitute* "grub-core/osdep/linux/getroot.c"
|
| 186 | (("argv\\[0\\] = \"mdadm\"")
|
| 187 | (string-append "argv[0] = \"" mdadm "\"")))))
|
| 188 |
|
| 189 | |
| 190 | (copy-file #+unifont "unifont.bdf.gz")
|
| 191 | (system* "gunzip" "unifont.bdf.gz")
|
| 192 |
|
| 193 | |
| 194 | (substitute* "util/grub-kbdcomp.in"
|
| 195 | (("^ckbcomp ")
|
| 196 | (string-append
|
| 197 | (search-input-file inputs "/bin/ckbcomp")
|
| 198 | " ")))))
|
| 199 | (add-after 'unpack 'set-freetype-variables
|
| 200 | |
| 201 | |
| 202 | |
| 203 | (lambda* (#:key native-inputs #:allow-other-keys)
|
| 204 | (when (assoc-ref native-inputs "freetype")
|
| 205 | (let ((freetype (assoc-ref native-inputs "freetype")))
|
| 206 | (setenv "BUILD_FREETYPE_LIBS"
|
| 207 | (string-append "-L" freetype
|
| 208 | "/lib -lfreetype"))
|
| 209 | (setenv "BUILD_FREETYPE_CFLAGS"
|
| 210 | (string-append "-I" freetype
|
| 211 | "/include/freetype2"))))))
|
| 212 | (add-before 'check 'disable-flaky-test
|
| 213 | (lambda _
|
| 214 | |
| 215 | |
| 216 | (substitute* "Makefile.in"
|
| 217 | (("grub_cmd_date grub_cmd_set_date grub_cmd_sleep")
|
| 218 | "grub_cmd_date grub_cmd_sleep"))))
|
| 219 | (add-before 'check 'skip-tests
|
| 220 | (lambda _
|
| 221 | (substitute* "Makefile.in"
|
| 222 | |
| 223 | |
| 224 | ((" grub_cmd_date ") " ")
|
| 225 | ((" pseries_test ") " "))))
|
| 226 | (add-before 'check 'disable-pixel-perfect-test
|
| 227 | (lambda _
|
| 228 | |
| 229 | |
| 230 | (substitute* "Makefile.in"
|
| 231 | (("test_unset grub_func_test")
|
| 232 | "test_unset")))))))
|
| 233 | (inputs
|
| 234 | (append (list gettext-minimal freetype ncurses libtasn1
|
| 235 |
|
| 236 | |
| 237 | |
| 238 | console-setup)
|
| 239 |
|
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | (if (target-ppc64le?)
|
| 246 | (list clang-13)
|
| 247 | '())
|
| 248 |
|
| 249 | |
| 250 | |
| 251 | (if (member (or (%current-target-system)
|
| 252 | (%current-system))
|
| 253 | (package-supported-systems lvm2))
|
| 254 | (list lvm2)
|
| 255 | '())
|
| 256 |
|
| 257 | |
| 258 | |
| 259 | |
| 260 | (if (member (or (%current-target-system)
|
| 261 | (%current-system))
|
| 262 | (package-supported-systems mdadm))
|
| 263 | (list mdadm)
|
| 264 | '())
|
| 265 |
|
| 266 | |
| 267 | |
| 268 | |
| 269 | (if (member (or (%current-target-system)
|
| 270 | (%current-system))
|
| 271 | (package-supported-systems fuse))
|
| 272 | (list fuse)
|
| 273 | '())))
|
| 274 | (native-inputs
|
| 275 | (append (list pkg-config
|
| 276 | bison
|
| 277 | flex
|
| 278 | texinfo
|
| 279 | help2man
|
| 280 | freetype |
| 281 |
|
| 282 | |
| 283 | parted
|
| 284 | xorriso)
|
| 285 |
|
| 286 | |
| 287 | |
| 288 | (if (member (%current-system) (package-supported-systems qemu-minimal))
|
| 289 | (list qemu-minimal)
|
| 290 | '())))
|
| 291 | (home-page "https://www.gnu.org/software/grub/")
|
| 292 | (synopsis "GRand Unified Boot loader")
|
| 293 | (description
|
| 294 | "GRUB is a multiboot bootloader. It is used for initially loading the
|
| 295 | kernel of an operating system and then transferring control to it. The kernel
|
| 296 | then goes on to load the rest of the operating system. As a multiboot
|
| 297 | bootloader, GRUB handles the presence of multiple operating systems installed
|
| 298 | on the same computer; upon booting the computer, the user is presented with a
|
| 299 | menu to select one of the installed operating systems.")
|
| 300 | (license license:gpl3+)
|
| 301 | (properties '((cpe-name . "grub2")))))
|
| 302 |
|
| 303 | (define-public grub-pc
|
| 304 | (package
|
| 305 | (inherit (make-grub "pc"))
|
| 306 | (supported-systems '("i686-linux" "x86_64-linux"
|
| 307 | "i586-gnu" "x86_64-gnu"))))
|
| 308 |
|
| 309 | (define-public grub grub-pc)
|
| 310 |
|
| 311 | (define-public grub-minimal
|
| 312 | (package
|
| 313 | (inherit grub-pc)
|
| 314 | (name "grub-minimal")
|
| 315 | (inputs
|
| 316 | (modify-inputs inputs
|
| 317 | (delete "lvm2" "mdadm" "fuse" "console-setup")))
|
| 318 | (native-inputs
|
| 319 | (modify-inputs native-inputs
|
| 320 | (delete "help2man" "texinfo" "parted" "qemu" "qemu-minimal" "xorriso")))
|
| 321 | (arguments
|
| 322 | (substitute-keyword-arguments arguments
|
| 323 | ((#:tests? _ #t) #f)
|
| 324 | ((#:phases phases #~%standard-phases)
|
| 325 | #~(modify-phases #$phases
|
| 326 | (replace 'patch-stuff
|
| 327 | (lambda* (#:key native-inputs inputs #:allow-other-keys)
|
| 328 | (substitute* "grub-core/Makefile.in"
|
| 329 | (("/bin/sh")
|
| 330 | (which "sh")))
|
| 331 |
|
| 332 | |
| 333 | (copy-file #+unifont "unifont.bdf.gz")
|
| 334 | (system* "gunzip" "unifont.bdf.gz")))))))))
|
| 335 |
|
| 336 | (define-public grub-coreboot
|
| 337 | (let ((base (make-grub "coreboot")))
|
| 338 | (package
|
| 339 | (inherit base)
|
| 340 | (synopsis "GRand Unified Boot loader (Coreboot payload version)")
|
| 341 | (arguments
|
| 342 | (substitute-keyword-arguments arguments
|
| 343 | ((#:phases phases #~%standard-phases)
|
| 344 | #~(modify-phases #$phases
|
| 345 | (add-before 'check 'disable-broken-tests
|
| 346 | (lambda _
|
| 347 | (setenv "DISABLE_HARD_ERRORS" "1")
|
| 348 | (setenv "XFAIL_TESTS"
|
| 349 | (string-join
|
| 350 | |
| 351 | |
| 352 | |
| 353 | |
| 354 | |
| 355 | |
| 356 | (list "pata_test"
|
| 357 | "ahci_test"
|
| 358 | "uhci_test"
|
| 359 | "ehci_test"
|
| 360 | "example_grub_script_test"
|
| 361 | "ohci_test"
|
| 362 | "grub_script_eval"
|
| 363 | "grub_script_echo1"
|
| 364 | "grub_script_test"
|
| 365 | "grub_script_leading_whitespace"
|
| 366 | "grub_script_echo_keywords"
|
| 367 | "grub_script_vars1"
|
| 368 | "grub_script_for1"
|
| 369 | "grub_script_while1"
|
| 370 | "grub_script_if"
|
| 371 | "grub_script_comments"
|
| 372 | "grub_script_functions"
|
| 373 | "grub_script_continue"
|
| 374 | "grub_script_break"
|
| 375 | "grub_script_shift"
|
| 376 | "grub_script_blockarg"
|
| 377 | "grub_script_return"
|
| 378 | "grub_script_setparams"
|
| 379 | "grub_cmd_date"
|
| 380 | "grub_cmd_set_date"
|
| 381 | "grub_cmd_sleep"
|
| 382 | "grub_cmd_regexp"
|
| 383 | "grub_cmd_test"
|
| 384 | "grub_script_not"
|
| 385 | "grub_cmd_echo"
|
| 386 | "grub_script_expansion"
|
| 387 | "grub_script_gettext"
|
| 388 | "grub_script_escape_comma"
|
| 389 | "help_test"
|
| 390 | "grub_script_strcmp"
|
| 391 | "test_sha512sum"
|
| 392 | "grub_cmd_tr"
|
| 393 | "test_unset"
|
| 394 | "file_filter_test"
|
| 395 | "asn1_test")
|
| 396 | " "))))))))
|
| 397 | (supported-systems '("i686-linux" "x86_64-linux")))))
|
| 398 |
|
| 399 | (define-public grub-efi
|
| 400 | (let ((base (make-grub "efi")))
|
| 401 | (package
|
| 402 | (inherit base)
|
| 403 | (synopsis "GRand Unified Boot loader (UEFI version)")
|
| 404 | (inputs
|
| 405 | (modify-inputs inputs
|
| 406 | (prepend efibootmgr mtools)))
|
| 407 | (native-inputs
|
| 408 | (cond ((or (target-x86-64?)
|
| 409 | (target-x86-32?)
|
| 410 | (target-aarch64?)
|
| 411 | (target-arm32?))
|
| 412 | |
| 413 | (modify-inputs native-inputs
|
| 414 | (prepend
|
| 415 | (cond ((target-x86-64?) ovmf-x86-64)
|
| 416 | ((target-x86-32?) ovmf-i686)
|
| 417 | ((target-aarch64?) ovmf-aarch64)
|
| 418 | ((target-arm32?) ovmf-arm)
|
| 419 | (else pkg-config)))))
|
| 420 | (else
|
| 421 | |
| 422 | |
| 423 | (modify-inputs native-inputs
|
| 424 | (delete "parted" "qemu-minimal" "xorriso")))))
|
| 425 | (arguments
|
| 426 | (substitute-keyword-arguments arguments
|
| 427 | ((#:tests? _ #f) (and (not (%current-target-system))
|
| 428 | (this-package-native-input "qemu-minimal")))
|
| 429 | ((#:configure-flags flags #~'())
|
| 430 | #~(cons* #$@(if (string-prefix? "x86_64"
|
| 431 | (or (%current-target-system)
|
| 432 | (%current-system)))
|
| 433 | #~("--enable-stack-protector") |
| 434 | #~())
|
| 435 | #$flags))
|
| 436 | ((#:phases phases)
|
| 437 | #~(modify-phases #$phases
|
| 438 | #$@(if (this-package-native-input "qemu-minimal")
|
| 439 | #~((add-after 'patch-stuff 'patch-ovmf-path
|
| 440 | (lambda* (#:key native-inputs inputs #:allow-other-keys)
|
| 441 | (let ((arch #$(cond ((target-x86-64?) "x64")
|
| 442 | ((target-x86-32?) "ia32")
|
| 443 | ((target-aarch64?) "aarch64")
|
| 444 | ((target-arm32?) "arm")
|
| 445 | (else ""))))
|
| 446 | (substitute* "tests/util/grub-shell.in"
|
| 447 | (("\\$\\{srcdir\\}/OVMF(32)?\\.fd")
|
| 448 | (search-input-file
|
| 449 | (or native-inputs inputs)
|
| 450 | (string-append
|
| 451 | "/share/firmware/ovmf_" arch ".bin")))
|
| 452 | (("/usr/share/qemu/OVMF(32)?\\.fd")
|
| 453 | (search-input-file
|
| 454 | (or native-inputs inputs)
|
| 455 | (string-append
|
| 456 | "/share/firmware/ovmf_" arch ".bin")))
|
| 457 | (("\\$\\{srcdir\\}/AAVMF(32)?\\.fd")
|
| 458 | (search-input-file
|
| 459 | (or native-inputs inputs)
|
| 460 | (string-append
|
| 461 | "/share/firmware/ovmf_" arch ".bin")))
|
| 462 | (("/usr/share/qemu-efi-aarch64/QEMU_EFI\\.fd")
|
| 463 | (search-input-file
|
| 464 | (or native-inputs inputs)
|
| 465 | (string-append
|
| 466 | "/share/firmware/ovmf_" arch ".bin")))
|
| 467 | (("/usr/share/AAVMF/AAVMF(32)?\\.fd")
|
| 468 | (search-input-file
|
| 469 | (or native-inputs inputs)
|
| 470 | (string-append
|
| 471 | "/share/firmware/ovmf_" arch ".bin"))))))))
|
| 472 | #~())
|
| 473 | (add-after 'patch-stuff 'use-absolute-efibootmgr-path
|
| 474 | (lambda* (#:key inputs #:allow-other-keys)
|
| 475 | (substitute* "grub-core/osdep/unix/platform.c"
|
| 476 | (("efibootmgr")
|
| 477 | (search-input-file inputs "/sbin/efibootmgr")))))
|
| 478 | (add-after 'patch-stuff 'use-absolute-mtools-path
|
| 479 | (lambda* (#:key inputs #:allow-other-keys)
|
| 480 | (substitute* "util/grub-mkrescue.c"
|
| 481 | (("\"mformat\"")
|
| 482 | (string-append "\""
|
| 483 | (search-input-file inputs "/bin/mformat")
|
| 484 | "\"")))
|
| 485 | (substitute* "util/grub-mkrescue.c"
|
| 486 | (("\"mcopy\"")
|
| 487 | (string-append "\""
|
| 488 | (search-input-file inputs "/bin/mcopy")
|
| 489 | "\"")))))))))
|
| 490 | |
| 491 | (supported-systems '("i686-linux" "x86_64-linux"
|
| 492 | "i586-gnu" "x86_64-gnu"
|
| 493 | "armhf-linux" "aarch64-linux" "riscv64-linux")))))
|
| 494 |
|
| 495 | (define-public grub-efi32
|
| 496 | (package
|
| 497 | (inherit grub-efi)
|
| 498 | (name "grub-efi32")
|
| 499 | (synopsis "GRand Unified Boot loader (UEFI 32bit version)")
|
| 500 | (arguments
|
| 501 | (substitute-keyword-arguments arguments
|
| 502 | ((#:configure-flags flags #~'())
|
| 503 | #~(cons* #$@(cond ((target-x86?)
|
| 504 | #~("--target=i386"))
|
| 505 | ((target-aarch64?)
|
| 506 | #~("--target=arm"
|
| 507 | (string-append "TARGET_CC="
|
| 508 | #$(cc-for-target
|
| 509 | "arm-linux-gnueabihf"))))
|
| 510 | ((target-arm?)
|
| 511 | #~("--target=arm"))
|
| 512 | (else #~()))
|
| 513 | #$flags))
|
| 514 | ((#:phases phases)
|
| 515 | #~(modify-phases #$phases
|
| 516 | #$@(if (or (target-x86?)
|
| 517 | (target-arm?))
|
| 518 | #~((replace 'patch-ovmf-path
|
| 519 | (lambda* (#:key native-inputs inputs #:allow-other-keys)
|
| 520 | (let ((arch #$(cond ((target-x86?) "ia32")
|
| 521 | ((target-arm?) "arm")
|
| 522 | (else ""))))
|
| 523 | (substitute* "tests/util/grub-shell.in"
|
| 524 | (("\\$\\{srcdir\\}/OVMF(32)?\\.fd")
|
| 525 | (search-input-file
|
| 526 | (or native-inputs inputs)
|
| 527 | (string-append
|
| 528 | "/share/firmware/ovmf_" arch ".bin")))
|
| 529 | (("/usr/share/qemu/OVMF(32)?\\.fd")
|
| 530 | (search-input-file
|
| 531 | (or native-inputs inputs)
|
| 532 | (string-append
|
| 533 | "/share/firmware/ovmf_" arch ".bin")))
|
| 534 | (("\\$\\{srcdir\\}/AAVMF(32)?\\.fd")
|
| 535 | (search-input-file
|
| 536 | (or native-inputs inputs)
|
| 537 | (string-append
|
| 538 | "/share/firmware/ovmf_" arch ".bin")))
|
| 539 | (("/usr/share/qemu-efi-aarch64/QEMU_EFI\\.fd")
|
| 540 | (search-input-file
|
| 541 | (or native-inputs inputs)
|
| 542 | (string-append
|
| 543 | "/share/firmware/ovmf_" arch ".bin")))
|
| 544 | (("/usr/share/AAVMF/AAVMF(32)?\\.fd")
|
| 545 | (search-input-file
|
| 546 | (or native-inputs inputs)
|
| 547 | (string-append
|
| 548 | "/share/firmware/ovmf_" arch ".bin")))
|
| 549 | (("/usr/share/ovmf-arm/QEMU_EFI\\.fd")
|
| 550 | (search-input-file
|
| 551 | (or native-inputs inputs)
|
| 552 | (string-append
|
| 553 | "/share/firmware/ovmf_" arch ".bin"))))))))
|
| 554 | #~())))))
|
| 555 | (native-inputs
|
| 556 | (cond
|
| 557 | ((target-x86-64?)
|
| 558 | (modify-inputs native-inputs
|
| 559 | (replace "ovmf-x86-64" ovmf-i686)))
|
| 560 | ((target-aarch64?)
|
| 561 | (modify-inputs native-inputs
|
| 562 | (prepend
|
| 563 | (cross-gcc "arm-linux-gnueabihf")
|
| 564 | (cross-binutils "arm-linux-gnueabihf"))
|
| 565 | (replace "ovmf-aarch64" ovmf-arm)))
|
| 566 | (else (package-native-inputs grub-efi))))))
|
| 567 |
|
| 568 | (define-public grub-emu
|
| 569 | (package
|
| 570 | (inherit (make-grub "emu"))
|
| 571 | (synopsis "GRand Unified Boot loader (Emu version)")))
|
| 572 |
|
| 573 | (define-public grub-ieee1275
|
| 574 | (package
|
| 575 | (inherit (make-grub "ieee1275"))
|
| 576 | (synopsis "GRand Unified Boot loader (ieee1275 version)")
|
| 577 | (supported-systems '("powerpc-linux" "powerpc64le-linux"))))
|
| 578 |
|
| 579 | (define-public grub-qemu
|
| 580 | (package
|
| 581 | (inherit (make-grub "qemu"))
|
| 582 | (synopsis "GRand Unified Boot loader (qemu version)")
|
| 583 | (supported-systems '("i686-linux" "x86_64-linux"
|
| 584 | "i586-gnu" "x86_64-gnu"))))
|
| 585 |
|
| 586 | (define-public grub-uboot
|
| 587 | (let ((base (make-grub "uboot")))
|
| 588 | (package
|
| 589 | (inherit base)
|
| 590 | (arguments
|
| 591 | (substitute-keyword-arguments arguments
|
| 592 | |
| 593 | ((#:tests? _ #t) #f)))
|
| 594 | (synopsis "GRand Unified Boot loader (u-boot version)")
|
| 595 | (supported-systems '("armhf-linux")))))
|
| 596 |
|
| 597 | |
| 598 | |
| 599 | |
| 600 | |
| 601 | |
| 602 | (define-public grub-hybrid
|
| 603 | (package
|
| 604 | (inherit grub-efi)
|
| 605 | (name "grub-hybrid")
|
| 606 | (synopsis "GRand Unified Boot loader (hybrid version)")
|
| 607 | (inputs
|
| 608 | (modify-inputs inputs
|
| 609 | (prepend grub)))
|
| 610 | (arguments
|
| 611 | (substitute-keyword-arguments arguments
|
| 612 | ((#:modules modules `((guix build utils)
|
| 613 | (guix build gnu-build-system)))
|
| 614 | `((ice-9 ftw) ,@modules))
|
| 615 | ((#:phases phases)
|
| 616 | #~(modify-phases #$phases
|
| 617 | (add-after 'install 'install-non-efi
|
| 618 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 619 | (let ((input-dir (search-input-directory inputs "/lib/grub"))
|
| 620 | (output-dir (string-append (assoc-ref outputs "out")
|
| 621 | "/lib/grub")))
|
| 622 | (for-each (lambda (basename)
|
| 623 | (unless (or (string-prefix? "." basename)
|
| 624 | (file-exists? (string-append
|
| 625 | output-dir "/"
|
| 626 | basename)))
|
| 627 | (symlink (string-append input-dir "/"
|
| 628 | basename)
|
| 629 | (string-append output-dir "/"
|
| 630 | basename))))
|
| 631 | (scandir input-dir)))))))))))
|
| 632 |
|
| 633 | (define-public (make-grub-efi-netboot name subdir)
|
| 634 | "Make a grub-efi-netboot package named NAME, which will be able to boot over
|
| 635 | network via TFTP by accessing its files in the SUBDIR of a TFTP root directory.
|
| 636 | This package is also able to boot from local storage devices.
|
| 637 |
|
| 638 | A bootloader-installer basically needs to copy the package content into the
|
| 639 | bootloader-target directory, which will usually be the TFTP root, as
|
| 640 | 'grub-mknetdir' will be invoked already during the package creation.
|
| 641 |
|
| 642 | Alternatively the bootloader-target directory can be a mounted EFI System
|
| 643 | Partition (ESP), or a similar partition with a FAT file system, for booting
|
| 644 | from local storage devices.
|
| 645 |
|
| 646 | The name of the GRUB EFI binary will conform to the UEFI specification for
|
| 647 | removable media. Depending on the system it will be e.g. bootx64.efi or
|
| 648 | bootaa64.efi below SUBDIR.
|
| 649 |
|
| 650 | The SUBDIR argument needs to be set to \"efi/boot\" to create a package which
|
| 651 | conforms to the UEFI specification for removable media.
|
| 652 |
|
| 653 | The SUBDIR argument defaults to \"efi/Guix\", as it is also the case for
|
| 654 | 'grub-efi-bootloader'."
|
| 655 | (package
|
| 656 | (name name)
|
| 657 | (version (package-version grub-efi))
|
| 658 | |
| 659 | (source #f)
|
| 660 | (build-system trivial-build-system)
|
| 661 | (arguments
|
| 662 | (let* ((system (string-split (nix-system->gnu-triplet
|
| 663 | (or (%current-target-system)
|
| 664 | (%current-system)))
|
| 665 | #\-))
|
| 666 | (arch (first system))
|
| 667 | (boot-efi
|
| 668 | (match system
|
| 669 | |
| 670 | |
| 671 | (("i686" _ ...) "/bootia32.efi")
|
| 672 | (("x86_64" _ ...) "/bootx64.efi")
|
| 673 | (("arm" _ ...) "/bootarm.efi")
|
| 674 | (("aarch64" _ ...) "/bootaa64.efi")
|
| 675 | (("riscv" _ ...) "/bootriscv32.efi")
|
| 676 | (("riscv64" _ ...) "/bootriscv64.efi")
|
| 677 | |
| 678 | |
| 679 | |
| 680 | ((_ ...) #f)))
|
| 681 | (core-efi (string-append
|
| 682 | |
| 683 | |
| 684 | (match arch
|
| 685 | ("i686" "i386")
|
| 686 | ("aarch64" "arm64")
|
| 687 | ("riscv" "riscv32")
|
| 688 | (_ arch))
|
| 689 | "-efi/core.efi")))
|
| 690 | (list
|
| 691 | #:modules '((guix build utils))
|
| 692 | #:builder
|
| 693 | #~(begin
|
| 694 | (use-modules (guix build utils))
|
| 695 | (let* ((bootloader #$(this-package-input "grub-efi"))
|
| 696 | (net-dir #$output)
|
| 697 | (sub-dir (string-append net-dir "/" #$subdir "/"))
|
| 698 | (boot-efi (string-append sub-dir #$boot-efi))
|
| 699 | (core-efi (string-append sub-dir #$core-efi)))
|
| 700 | |
| 701 | |
| 702 | (setenv "GRUB_ENABLE_CRYPTODISK" "y")
|
| 703 | (invoke/quiet (string-append bootloader "/bin/grub-mknetdir")
|
| 704 | (string-append "--net-directory=" net-dir)
|
| 705 | (string-append "--subdir=" #$subdir)
|
| 706 | |
| 707 | |
| 708 | |
| 709 | (string-append "--modules=part_msdos part_gpt fat"))
|
| 710 | |
| 711 | (false-if-exception (delete-file boot-efi))
|
| 712 | (rename-file core-efi boot-efi))))))
|
| 713 | (inputs (list grub-efi))
|
| 714 | (synopsis (package-synopsis grub-efi))
|
| 715 | (description (package-description grub-efi))
|
| 716 | (home-page (package-home-page grub-efi))
|
| 717 | (license (package-license grub-efi))))
|
| 718 |
|
| 719 | (define-public syslinux
|
| 720 | (let ((commit "b4cc12b9db2c6f5df7aa90bb2b8b4d62b22e01ee")
|
| 721 | (revision "21")) |
| 722 | (package
|
| 723 | (name "syslinux")
|
| 724 | (version (git-version "6.04-pre1" revision commit))
|
| 725 | (source
|
| 726 | (origin
|
| 727 | (method git-fetch)
|
| 728 | (uri (git-reference
|
| 729 | (url "https://git.zytor.com/syslinux/syslinux")
|
| 730 | (commit commit)))
|
| 731 | (file-name (git-file-name name version))
|
| 732 | (sha256
|
| 733 | (base32
|
| 734 | "1vdqbipmx6bqhb7lsq6fwfv6hbdwyx29w43pfcgcrqc45l4hl22c"))
|
| 735 | (patches
|
| 736 | (search-patches "syslinux-gcc10.patch"
|
| 737 | "syslinux-strip-gnu-property.patch"))))
|
| 738 | (build-system gnu-build-system)
|
| 739 | (native-inputs
|
| 740 | (list coreutils
|
| 741 | nasm
|
| 742 | perl
|
| 743 | python))
|
| 744 | (inputs
|
| 745 | (list `(,util-linux "lib")
|
| 746 | mtools))
|
| 747 | (arguments
|
| 748 | (list
|
| 749 | #:make-flags
|
| 750 | #~(list (string-append "BINDIR=" #$output "/bin")
|
| 751 | (string-append "SBINDIR=" #$output "/sbin")
|
| 752 | (string-append "LIBDIR=" #$output "/lib")
|
| 753 | (string-append "INCDIR=" #$output "/include")
|
| 754 | (string-append "DATADIR=" #$output "/share")
|
| 755 | (string-append "MANDIR=" #$output "/share/man")
|
| 756 | "PERL=perl"
|
| 757 | "PYTHON=python3"
|
| 758 | "bios")
|
| 759 | #:strip-flags
|
| 760 | #~(list "--enable-deterministic-archives"
|
| 761 | "--strip-debug")
|
| 762 | #:phases
|
| 763 | #~(modify-phases %standard-phases
|
| 764 | (add-after 'unpack 'patch-files
|
| 765 | (lambda* (#:key inputs native-inputs #:allow-other-keys)
|
| 766 | (substitute* "tests/unittest/include/unittest/unittest.h"
|
| 767 | |
| 768 | (("^(#include <)/usr/include/" all keep) keep))
|
| 769 | (substitute* "Makefile"
|
| 770 | (("/bin/pwd") "pwd"))
|
| 771 | (substitute* (find-files "." "\\.c$")
|
| 772 | (("mcopy")
|
| 773 | (search-input-file inputs "bin/mcopy"))
|
| 774 | (("mattrib")
|
| 775 | (search-input-file inputs "bin/mattrib")))))
|
| 776 | (delete 'configure)
|
| 777 | (replace 'check
|
| 778 | (lambda* (#:key tests? parallel-tests? #:allow-other-keys)
|
| 779 | (when tests?
|
| 780 | |
| 781 | |
| 782 | (apply invoke "make" "unittest"
|
| 783 | (append (if parallel-tests?
|
| 784 | (list "-j" (number->string (parallel-job-count)))
|
| 785 | (list))
|
| 786 | (list (string-append "CC=" #$(cc-for-target)))))))))))
|
| 787 | (home-page "https://wiki.syslinux.org/wiki/index.php?title=The_Syslinux_Project")
|
| 788 | (synopsis "Lightweight Linux bootloader")
|
| 789 | (description "Syslinux is a lightweight Linux bootloader.")
|
| 790 | (license (list license:gpl2+
|
| 791 | license:bsd-3 |
| 792 | license:bsd-4 |
| 793 | license:expat
|
| 794 | license:isc
|
| 795 | license:zlib))
|
| 796 | |
| 797 | (supported-systems (list "i686-linux" "x86_64-linux")))))
|
| 798 |
|
| 799 | (define-public dtc
|
| 800 | (package
|
| 801 | (name "dtc")
|
| 802 | (version "1.8.1")
|
| 803 | (source (origin
|
| 804 | (method url-fetch)
|
| 805 | (uri (string-append
|
| 806 | "mirror://kernel.org/software/utils/dtc/"
|
| 807 | "dtc-" version ".tar.gz"))
|
| 808 | (sha256
|
| 809 | (base32
|
| 810 | "1c5wy7mcnhwwj1x5s5ajvc6i1xfgl9nycibz3v4mgsccfk75qkj5"))))
|
| 811 | (build-system meson-build-system)
|
| 812 | (arguments
|
| 813 | (list
|
| 814 | #:modules '((guix build meson-build-system)
|
| 815 | (guix build utils)
|
| 816 | (srfi srfi-26))
|
| 817 | #:phases
|
| 818 | #~(modify-phases %standard-phases
|
| 819 | (add-after 'unpack 'preparations
|
| 820 | (lambda _
|
| 821 | |
| 822 | (setenv "DESTDIR" "/")
|
| 823 |
|
| 824 | |
| 825 | (setenv "CC" "gcc")
|
| 826 |
|
| 827 | |
| 828 | (setenv "LDFLAGS"
|
| 829 | (string-append "-Wl,-rpath=" #$output "/lib"))))
|
| 830 | (add-after 'unpack 'install-doc
|
| 831 | (lambda _
|
| 832 | (with-directory-excursion "Documentation"
|
| 833 | (for-each (cut install-file <> (string-append
|
| 834 | #$output "/share/doc/dtc/"))
|
| 835 | '("dts-format.txt"
|
| 836 | "dt-object-internal.txt"
|
| 837 | "manual.txt")))))
|
| 838 | (add-after 'unpack 'patch-pkg-config
|
| 839 | (lambda _
|
| 840 | (substitute* '("tests/run_tests.sh")
|
| 841 | (("pkg-config")
|
| 842 | #$(pkg-config-for-target))))))))
|
| 843 | (native-inputs
|
| 844 | (append
|
| 845 | (list bison
|
| 846 | flex
|
| 847 | libyaml
|
| 848 | ninja
|
| 849 | pkg-config
|
| 850 | python
|
| 851 | python-setuptools-scm
|
| 852 | swig-4.0
|
| 853 | which)
|
| 854 | (if (member (%current-system) (package-supported-systems valgrind/pinned))
|
| 855 | (list valgrind/pinned)
|
| 856 | '())))
|
| 857 | (inputs
|
| 858 | (list python))
|
| 859 | (home-page "https://www.devicetree.org")
|
| 860 | (synopsis "Compiles device tree source files")
|
| 861 | (description "@command{dtc} compiles
|
| 862 | @uref{http://elinux.org/Device_Tree_Usage, device tree source files} to device
|
| 863 | tree binary files. These are board description files used by Linux and BSD.")
|
| 864 | (license license:gpl2+)))
|
| 865 |
|
| 866 | (define-public python-libfdt
|
| 867 | (package
|
| 868 | (name "python-libfdt")
|
| 869 | (version (package-version dtc))
|
| 870 | (source (package-source dtc))
|
| 871 | (build-system pyproject-build-system)
|
| 872 | (arguments
|
| 873 | |
| 874 | (list
|
| 875 | #:tests? #f))
|
| 876 | (native-inputs
|
| 877 | (list dtc
|
| 878 | python-meson
|
| 879 | python-setuptools
|
| 880 | python-setuptools-scm
|
| 881 | swig))
|
| 882 | (home-page "https://www.devicetree.org/")
|
| 883 | (synopsis "python bindings for libfdt")
|
| 884 | (description
|
| 885 | "This package provides python bindings for @{libfdt}, a utility
|
| 886 | library for reading and manipulating the Linux Kernel Device Tree binary format.")
|
| 887 | (license (list license:gpl2+ license:bsd-2))))
|
| 888 |
|
| 889 | (define-public dtschema
|
| 890 | (package
|
| 891 | (name "dtschema")
|
| 892 | (version "2026.06")
|
| 893 | (source
|
| 894 | (origin
|
| 895 | (method git-fetch)
|
| 896 | (uri (git-reference
|
| 897 | (url "https://github.com/devicetree-org/dt-schema")
|
| 898 | (commit (string-append "v" version))))
|
| 899 | (file-name (git-file-name name version))
|
| 900 | (sha256
|
| 901 | (base32 "0ikklbdpwpz7g3y7x9602gp4y3crqxb62n38r9cpi3w3dm8r2i0p"))))
|
| 902 | (build-system pyproject-build-system)
|
| 903 | (arguments
|
| 904 | (list
|
| 905 | #:test-backend
|
| 906 | #~'custom
|
| 907 | #:test-flags
|
| 908 | #~(list "test/test-dt-validate.py")
|
| 909 | #:phases
|
| 910 | #~(modify-phases %standard-phases
|
| 911 | (add-before 'build 'patch-requirements
|
| 912 | (lambda _
|
| 913 | (substitute* "pyproject.toml"
|
| 914 | (("pylibfdt")
|
| 915 | "libfdt")))))))
|
| 916 | (inputs
|
| 917 | (list python-jsonschema
|
| 918 | python-libfdt
|
| 919 | python-rfc3987
|
| 920 | python-ruamel.yaml))
|
| 921 | (native-inputs
|
| 922 | (list dtc
|
| 923 | python-pytest
|
| 924 | python-setuptools
|
| 925 | python-setuptools-scm))
|
| 926 | (home-page "https://www.devicetree.org/")
|
| 927 | (synopsis "Tooling for devicetree validation using YAML and jsonschema")
|
| 928 | (description
|
| 929 | "This package contains tools and schema data for Devicetree schema validation
|
| 930 | using the json-schema vocabulary.")
|
| 931 | (license license:bsd-2)))
|
| 932 |
|
| 933 | |
| 934 | |
| 935 | |
| 936 | |
| 937 | |
| 938 | |
| 939 | |
| 940 | |
| 941 | |
| 942 | (define u-boot
|
| 943 | (package
|
| 944 | (name "u-boot")
|
| 945 | (version "2026.07")
|
| 946 | (source
|
| 947 | (origin
|
| 948 | (method git-fetch)
|
| 949 | (uri (git-reference
|
| 950 | (url "https://source.denx.de/u-boot/u-boot.git")
|
| 951 | (commit (string-append "v" version))))
|
| 952 | (file-name (git-file-name name version))
|
| 953 | (sha256
|
| 954 | (base32 "1y7syd9j6mp6pn16n3d9wzrh4aksip4r0rnkzkdqy3hpz29apsj7"))
|
| 955 | (patches (search-patches "u-boot-allow-disabling-openssl.patch"))
|
| 956 | (snippet
|
| 957 | |
| 958 | #~(begin
|
| 959 | (use-modules (guix build utils))
|
| 960 | (for-each delete-file
|
| 961 | '("Licenses/r8a779x_usb3.txt"
|
| 962 | "drivers/usb/host/xhci-rcar-r8a779x_usb3_v3.h"
|
| 963 | "arch/mips/mach-octeon/include/mach/cvmx-pki-cluster.h"))
|
| 964 | (for-each delete-file
|
| 965 | (find-files "arch/x86/dts/microcode/" "\\.dtsi$"))))))
|
| 966 | (build-system gnu-build-system)
|
| 967 | (native-inputs
|
| 968 | (list bison
|
| 969 | dtc
|
| 970 | gnutls
|
| 971 | flex
|
| 972 | lz4
|
| 973 | ncurses/tinfo
|
| 974 | perl
|
| 975 | pkg-config |
| 976 | python
|
| 977 | python-pyelftools
|
| 978 | python-setuptools
|
| 979 | python-wheel
|
| 980 | swig-4.0
|
| 981 | (list util-linux "lib")))
|
| 982 | (home-page "https://www.denx.de/wiki/U-Boot/")
|
| 983 | (synopsis "ARM bootloader")
|
| 984 | (description "U-Boot is a bootloader used mostly for ARM boards. It
|
| 985 | also initializes the boards (RAM etc).")
|
| 986 | (license license:gpl2+)))
|
| 987 |
|
| 988 | |
| 989 | |
| 990 | (define-public u-boot-documentation
|
| 991 | (package
|
| 992 | (inherit u-boot)
|
| 993 | (name "u-boot-documentation")
|
| 994 | (arguments
|
| 995 | (list
|
| 996 | #:make-flags #~(list "HOSTCC=gcc"
|
| 997 | |
| 998 | "SPHINXOPTS=")
|
| 999 | #:tests? #f
|
| 1000 | #:phases #~(modify-phases %standard-phases
|
| 1001 | (delete 'configure)
|
| 1002 | (replace 'build
|
| 1003 | (lambda* (#:key make-flags #:allow-other-keys)
|
| 1004 | (apply invoke "make" "infodocs" make-flags)))
|
| 1005 | (replace 'install
|
| 1006 | (lambda* (#:key make-flags #:allow-other-keys)
|
| 1007 | (let* ((info-dir (string-append #$output "/share/info"))
|
| 1008 | (info (string-append info-dir
|
| 1009 | "/DasUBoot.info.gz")))
|
| 1010 | (with-directory-excursion "doc/output"
|
| 1011 | (apply invoke "make" "-C" "texinfo" "install-info"
|
| 1012 | (string-append "infodir=" info-dir)
|
| 1013 | make-flags))))))))
|
| 1014 | (native-inputs
|
| 1015 | (modify-inputs native-inputs
|
| 1016 | (append fontconfig
|
| 1017 | python-six
|
| 1018 | python-sphinx
|
| 1019 | python-sphinx-prompt
|
| 1020 | |
| 1021 | python-sphinx-reredirects
|
| 1022 | texinfo
|
| 1023 | which)))
|
| 1024 | (synopsis "U-Boot documentation")
|
| 1025 | (description "This package provides the documentation for U-Boot, as an
|
| 1026 | Info manual.")))
|
| 1027 |
|
| 1028 | (define-public u-boot-tools
|
| 1029 | (package
|
| 1030 | (inherit u-boot)
|
| 1031 | (name "u-boot-tools")
|
| 1032 | (native-inputs
|
| 1033 | (if (string-match "^x86_64-linux" (%current-system))
|
| 1034 | (modify-inputs native-inputs
|
| 1035 | (prepend python-filelock
|
| 1036 | python-pycryptodomex
|
| 1037 | python-pytest
|
| 1038 | python-pytest-xdist))
|
| 1039 | (modify-inputs native-inputs
|
| 1040 | (prepend python-filelock
|
| 1041 | python-pycryptodomex))))
|
| 1042 | (inputs (list gnutls ncurses/tinfo))
|
| 1043 | (arguments
|
| 1044 | `(#:make-flags '("HOSTCC=gcc"
|
| 1045 | ,@(if (%current-target-system)
|
| 1046 | (list "CROSS_BUILD_TOOLS=y"
|
| 1047 | (string-append
|
| 1048 | "CROSS_COMPILE="
|
| 1049 | (%current-target-system)
|
| 1050 | "-"))
|
| 1051 | '()))
|
| 1052 | #:test-target "tcheck"
|
| 1053 | #:phases
|
| 1054 | (modify-phases %standard-phases
|
| 1055 | (add-after 'unpack 'patch
|
| 1056 | (lambda* (#:key inputs #:allow-other-keys)
|
| 1057 | (substitute* "Makefile"
|
| 1058 | (("/bin/pwd") (which "pwd"))
|
| 1059 | (("/bin/false") (which "false")))
|
| 1060 | (substitute* "tools/dtoc/fdt_util.py"
|
| 1061 | (("'cc'") "'gcc'"))
|
| 1062 | (substitute* "test/run"
|
| 1063 | |
| 1064 | (("#!/bin/bash") "#!/bin/bash -x")
|
| 1065 | |
| 1066 | (("\\./tools/patman/patman") (which "true"))
|
| 1067 | |
| 1068 | (("run_test \"binman\"") "# run_test \"binman\"")
|
| 1069 | |
| 1070 | (("run_test \"sandbox_noinst\"")
|
| 1071 | "# run_test \"sandbox_noinst\"")
|
| 1072 | (("run_test \"sandbox_vpl\"")
|
| 1073 | "# run_test \"sandbox_vpl\"")
|
| 1074 | |
| 1075 | (("run_test \"(\\w+) code coverage\"" all)
|
| 1076 | (string-append "# " all))
|
| 1077 | |
| 1078 | (("\\./tools/buildman/buildman") (which "true")))
|
| 1079 | (substitute* "test/py/tests/test_sandbox_exit.py"
|
| 1080 | (("def test_ctrl_c")
|
| 1081 | "@pytest.mark.skip(reason='Guix has problems with SIGINT')
|
| 1082 | def test_ctrl_c"))
|
| 1083 | |
| 1084 | |
| 1085 | (substitute* "test/image/test-imagetools.sh"
|
| 1086 | (("BASEDIR=sandbox") "BASEDIR=."))
|
| 1087 | (for-each (lambda (file)
|
| 1088 | (substitute* file
|
| 1089 | |
| 1090 | |
| 1091 | |
| 1092 | |
| 1093 | (("CONFIG_FIT=y")
|
| 1094 | "CONFIG_FIT=y
|
| 1095 | CONFIG_FIT_SIGNATURE=n
|
| 1096 | CONFIG_UT_LIB_ASN1=n
|
| 1097 | CONFIG_TOOLS_LIBCRYPTO=n
|
| 1098 | CONFIG_TOOLS_KWBIMAGE=n")
|
| 1099 | |
| 1100 | |
| 1101 | (("CONFIG_SANDBOX_VPL=y")
|
| 1102 | "CONFIG_SANDBOX_VPL=y
|
| 1103 | CONFIG_FIT_SIGNATURE=n
|
| 1104 | CONFIG_VPL_FIT_SIGNATURE=n
|
| 1105 | CONFIG_TOOLS_LIBCRYPTO=n
|
| 1106 | CONFIG_TOOLS_KWBIMAGE=n")
|
| 1107 | |
| 1108 | |
| 1109 | (("CONFIG_SOUND=y") "CONFIG_SOUND=n")))
|
| 1110 | (find-files "configs" "sandbox_.*defconfig$|tools-only_defconfig"))))
|
| 1111 | (replace 'configure
|
| 1112 | (lambda* (#:key make-flags #:allow-other-keys)
|
| 1113 | (apply invoke "make" "tools-only_defconfig" make-flags)))
|
| 1114 | (replace 'build
|
| 1115 | (lambda* (#:key inputs make-flags #:allow-other-keys)
|
| 1116 | (apply invoke "make" "tools-all" make-flags)))
|
| 1117 | (replace 'install
|
| 1118 | (lambda* (#:key outputs #:allow-other-keys)
|
| 1119 | (let* ((out (assoc-ref outputs "out"))
|
| 1120 | (bin (string-append out "/bin")))
|
| 1121 | (for-each (lambda (name)
|
| 1122 | (install-file name bin))
|
| 1123 | '("tools/netconsole"
|
| 1124 | "tools/jtagconsole"
|
| 1125 | "tools/gen_eth_addr"
|
| 1126 | "tools/gen_ethaddr_crc"
|
| 1127 | "tools/img2srec"
|
| 1128 | "tools/mkenvimage"
|
| 1129 | "tools/dumpimage"
|
| 1130 | "tools/mkimage"
|
| 1131 | "tools/kwboot"
|
| 1132 | "tools/proftool"
|
| 1133 | "tools/fdtgrep"
|
| 1134 | "tools/env/fw_printenv"
|
| 1135 | "tools/sunxi-spl-image-builder")))))
|
| 1136 | (delete 'check)
|
| 1137 | (add-after 'install 'check
|
| 1138 | (lambda* (#:key make-flags test-target tests? #:allow-other-keys)
|
| 1139 | (when tests?
|
| 1140 | (invoke "test/image/test-imagetools.sh"))))
|
| 1141 | |
| 1142 | |
| 1143 | ,@(if (string-match "^x86_64-linux" (%current-system))
|
| 1144 | '((add-after 'check 'check-x86
|
| 1145 | (lambda* (#:key make-flags test-target tests? #:allow-other-keys)
|
| 1146 | (when tests?
|
| 1147 | (begin
|
| 1148 | (apply invoke "make" "mrproper" make-flags)
|
| 1149 | (setenv "SDL_VIDEODRIVER" "dummy")
|
| 1150 | (setenv "PAGER" "cat")
|
| 1151 | (apply invoke "make" test-target make-flags))))))
|
| 1152 | '()))))
|
| 1153 | (description (string-append
|
| 1154 | (package-description u-boot)
|
| 1155 | " This package provides board-independent tools "
|
| 1156 | "of U-Boot."))))
|
| 1157 |
|
| 1158 | (define-public python-u-boot-pylib
|
| 1159 | (package
|
| 1160 | (inherit u-boot)
|
| 1161 | (name "python-u-boot-pylib")
|
| 1162 | (build-system pyproject-build-system)
|
| 1163 | (arguments
|
| 1164 | (list
|
| 1165 | #:phases
|
| 1166 | #~(modify-phases %standard-phases
|
| 1167 | (add-after 'unpack 'chdir
|
| 1168 | (lambda _
|
| 1169 | (chdir "tools/u_boot_pylib")))
|
| 1170 | (replace 'check
|
| 1171 | (lambda* (#:key tests? #:allow-other-keys)
|
| 1172 | (when tests?
|
| 1173 | (invoke "./u_boot_pylib")))))))
|
| 1174 | (native-inputs (list python-setuptools))
|
| 1175 | (synopsis "U-Boot Python library")
|
| 1176 | (description "This package provides common Python code used by some of the
|
| 1177 | commands part of the U-Boot project, such as Patman.")))
|
| 1178 |
|
| 1179 | |
| 1180 | (define-deprecated/public-alias patman
|
| 1181 | (@ (gnu packages version-control) patman))
|
| 1182 |
|
| 1183 | (define*-public (make-u-boot-package board triplet
|
| 1184 | #:key
|
| 1185 | defconfig
|
| 1186 | configs
|
| 1187 | name-suffix
|
| 1188 | append-description
|
| 1189 | (u-boot u-boot))
|
| 1190 | "Return a U-Boot package for BOARD cross-compiled for TRIPLET with the
|
| 1191 | optional DEFCONFIG file and optional configuration changes from CONFIGS.
|
| 1192 | TRIPLET may also be set to #f to disable cross-compilation. NAME-SUFFIX is
|
| 1193 | appended to the package name, while APPEND-DESCRIPTION is appended to the
|
| 1194 | package description. U-BOOT can be used when a fork or a different version of
|
| 1195 | U-Boot must be used."
|
| 1196 | (let ((native-build? (lambda ()
|
| 1197 | (or (not triplet) |
| 1198 | (string=? (%current-system)
|
| 1199 | (gnu-triplet->nix-system triplet))))))
|
| 1200 | (package
|
| 1201 | (inherit u-boot)
|
| 1202 | (name (string-append (downstream-package-name "u-boot-" board)
|
| 1203 | (or name-suffix "")))
|
| 1204 | (description (if append-description
|
| 1205 | (string-append (package-description u-boot)
|
| 1206 | "\n\n" append-description)
|
| 1207 | (package-description u-boot)))
|
| 1208 | (build-system gnu-build-system)
|
| 1209 | (arguments
|
| 1210 | (substitute-keyword-arguments arguments
|
| 1211 | ((#:target _ #f)
|
| 1212 | (and (not (native-build?)) triplet))
|
| 1213 | ((#:modules modules '())
|
| 1214 | `((ice-9 ftw)
|
| 1215 | (srfi srfi-1)
|
| 1216 | (guix build gnu-build-system)
|
| 1217 | (guix build kconfig)
|
| 1218 | (guix build utils)
|
| 1219 | ,@modules))
|
| 1220 | ((#:imported-modules imported-modules '())
|
| 1221 | `((guix build kconfig)
|
| 1222 | ,@%default-gnu-imported-modules
|
| 1223 | ,@imported-modules))
|
| 1224 | ((#:test-target _ "test")
|
| 1225 | "test")
|
| 1226 | ((#:make-flags make-flags '())
|
| 1227 | #~(list "HOSTCC=gcc"
|
| 1228 | "KBUILD_VERBOSE=1"
|
| 1229 | #$@(if (not (native-build?))
|
| 1230 | (list (string-append "CROSS_COMPILE=" triplet "-"))
|
| 1231 | '())
|
| 1232 | #$@make-flags))
|
| 1233 | ((#:phases phases '%standard-phases)
|
| 1234 | #~(modify-phases #$phases
|
| 1235 | (replace 'configure
|
| 1236 | (lambda* (#:key make-flags #:allow-other-keys)
|
| 1237 | (let* ((config-name (string-append #$board "_defconfig"))
|
| 1238 | (config-file (string-append "configs/" config-name))
|
| 1239 | (defconfig #$defconfig)
|
| 1240 | (configs '#$configs))
|
| 1241 | (when defconfig
|
| 1242 | |
| 1243 | |
| 1244 | (copy-file defconfig config-file))
|
| 1245 | (if (file-exists? config-file)
|
| 1246 | (begin
|
| 1247 | (when configs
|
| 1248 | (modify-defconfig config-file configs))
|
| 1249 | (apply invoke "make" `(,@make-flags ,config-name))
|
| 1250 | (verify-config ".config" config-file))
|
| 1251 | (begin
|
| 1252 | (display "invalid board name; valid board names are:"
|
| 1253 | (current-error-port))
|
| 1254 | (let ((suffix-len (string-length "_defconfig"))
|
| 1255 | (entries (scandir "configs")))
|
| 1256 | (for-each (lambda (file-name)
|
| 1257 | (when (string-suffix? "_defconfig"
|
| 1258 | file-name)
|
| 1259 | (format (current-error-port)
|
| 1260 | "- ~A\n"
|
| 1261 | (string-drop-right
|
| 1262 | file-name suffix-len))))
|
| 1263 | (sort entries string-ci<)))
|
| 1264 | (error "invalid boardname ~s" #$board))))))
|
| 1265 | (add-after 'configure 'disable-tools-libcrypto
|
| 1266 | |
| 1267 | |
| 1268 | (lambda _
|
| 1269 | (substitute* ".config"
|
| 1270 | (("CONFIG_TOOLS_LIBCRYPTO=.*$")
|
| 1271 | "CONFIG_TOOLS_LIBCRYPTO=n
|
| 1272 | CONFIG_TOOLS_KWBIMAGE=n"))))
|
| 1273 | (replace 'install
|
| 1274 | (lambda _
|
| 1275 | (let ((libexec (string-append #$output "/libexec"))
|
| 1276 | (uboot-files
|
| 1277 | (append
|
| 1278 | (remove
|
| 1279 | |
| 1280 | |
| 1281 | |
| 1282 | |
| 1283 | |
| 1284 | (lambda (name)
|
| 1285 | (string-suffix?
|
| 1286 | "sunxi-spl-with-ecc.bin"
|
| 1287 | name))
|
| 1288 | (find-files "."
|
| 1289 | ".*\\.(bin|efi|img|imx|spl|itb|dtb|rksd)$"))
|
| 1290 | (find-files "." "^(MLO|SPL)$"))))
|
| 1291 | (mkdir-p libexec)
|
| 1292 | (install-file ".config" libexec)
|
| 1293 | |
| 1294 | (install-file "u-boot" libexec)
|
| 1295 | (for-each
|
| 1296 | (lambda (file)
|
| 1297 | (let ((target-file (string-append libexec "/" file)))
|
| 1298 | (mkdir-p (dirname target-file))
|
| 1299 | (copy-file file target-file)))
|
| 1300 | uboot-files)))))))))))
|
| 1301 |
|
| 1302 | (define* (make-u-boot-rockchip-package board soc #:optional configs)
|
| 1303 | "Return the U-Boot package for BOARD with AAarch64 Rockchip SOC
|
| 1304 | (System on Chip)."
|
| 1305 | (let* ((board (string-append board "-" (symbol->string soc)))
|
| 1306 | (base (make-u-boot-package board "aarch64-linux-gnu"
|
| 1307 | #:configs configs)))
|
| 1308 | (package
|
| 1309 | (inherit base)
|
| 1310 | (arguments
|
| 1311 | (substitute-keyword-arguments arguments
|
| 1312 | ((#:phases phases)
|
| 1313 | #~(modify-phases #$phases
|
| 1314 | (add-after 'unpack 'set-environment
|
| 1315 | (lambda* (#:key inputs #:allow-other-keys)
|
| 1316 | (setenv "BL31" (search-input-file inputs "/bl31.elf"))))))))
|
| 1317 | (inputs (modify-inputs inputs
|
| 1318 | (append (match soc
|
| 1319 | ('rk3588 arm-trusted-firmware-rk3588)
|
| 1320 | ('rk3399 arm-trusted-firmware-rk3399)
|
| 1321 | ('rk3328 arm-trusted-firmware-rk3328))))))))
|
| 1322 |
|
| 1323 | (define-public u-boot-am335x-boneblack
|
| 1324 | (let ((base (make-u-boot-package
|
| 1325 | "am335x_evm" "arm-linux-gnueabihf"
|
| 1326 | |
| 1327 | |
| 1328 | |
| 1329 | #:configs '("CONFIG_OF_LIST=\"am335x-evm am335x-boneblack\"")
|
| 1330 | #:append-description
|
| 1331 | "This U-Boot is built for the BeagleBone Black, which was
|
| 1332 | removed upstream, adjusted from the am335x_evm build with several device trees
|
| 1333 | removed so that it fits within common partitioning schemes.")))
|
| 1334 | (package
|
| 1335 | (inherit base)
|
| 1336 | |
| 1337 | |
| 1338 | |
| 1339 | (name "u-boot-am335x-boneblack"))))
|
| 1340 |
|
| 1341 | (define-public u-boot-am335x-evm
|
| 1342 | (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf"))
|
| 1343 |
|
| 1344 | (define*-public (make-u-boot-sunxi64-package board triplet scp-firmware
|
| 1345 | #:key defconfig configs)
|
| 1346 | (let ((base (make-u-boot-package
|
| 1347 | board triplet #:defconfig defconfig #:configs configs)))
|
| 1348 | (package
|
| 1349 | (inherit base)
|
| 1350 | (arguments
|
| 1351 | (substitute-keyword-arguments arguments
|
| 1352 | ((#:phases phases)
|
| 1353 | #~(modify-phases #$phases
|
| 1354 | (add-after 'unpack 'set-environment
|
| 1355 | (lambda* (#:key native-inputs inputs #:allow-other-keys)
|
| 1356 | (setenv "SCP" (search-input-file
|
| 1357 | (or native-inputs inputs) "libexec/scp.bin"))
|
| 1358 | (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
|
| 1359 | (native-inputs
|
| 1360 | (modify-inputs native-inputs
|
| 1361 | (append (force scp-firmware))))
|
| 1362 | (inputs
|
| 1363 | (modify-inputs inputs
|
| 1364 | (append arm-trusted-firmware-sun50i-a64))))))
|
| 1365 |
|
| 1366 | (define-public u-boot-orangepi-zero2w
|
| 1367 | (let ((base (make-u-boot-package
|
| 1368 | "orangepi_zero2w" "aarch64-linux-gnu")))
|
| 1369 | (package
|
| 1370 | (inherit base)
|
| 1371 | (arguments
|
| 1372 | (substitute-keyword-arguments arguments
|
| 1373 | ((#:phases phases)
|
| 1374 | #~(modify-phases #$phases
|
| 1375 | (add-after 'unpack 'set-environment
|
| 1376 | (lambda* (#:key native-inputs inputs #:allow-other-keys)
|
| 1377 | (setenv "SCP" "/dev/null")
|
| 1378 | (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
|
| 1379 | (inputs
|
| 1380 | (modify-inputs inputs
|
| 1381 | |
| 1382 | (append arm-trusted-firmware-sun50i-h616))))))
|
| 1383 |
|
| 1384 | (define-public u-boot-pine64-plus
|
| 1385 | (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"
|
| 1386 | (delay crust-pine64-plus)))
|
| 1387 |
|
| 1388 | (define-public u-boot-pine64-lts
|
| 1389 | (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu"
|
| 1390 | (delay crust-pine64-plus)))
|
| 1391 |
|
| 1392 | (define-public u-boot-pinebook
|
| 1393 | (make-u-boot-sunxi64-package
|
| 1394 | "pinebook" "aarch64-linux-gnu" (delay crust-pinebook)
|
| 1395 | |
| 1396 | |
| 1397 | #:configs '("CONFIG_VIDEO_BPP32=y")))
|
| 1398 |
|
| 1399 | (define-public u-boot-bananapi-m2-ultra
|
| 1400 | (make-u-boot-package "Bananapi_M2_Ultra" "arm-linux-gnueabihf"))
|
| 1401 |
|
| 1402 | (define-public u-boot-a20-olinuxino-lime
|
| 1403 | (make-u-boot-package "A20-OLinuXino-Lime" "arm-linux-gnueabihf"))
|
| 1404 |
|
| 1405 | (define-public u-boot-a20-olinuxino-lime2
|
| 1406 | (make-u-boot-package "A20-OLinuXino-Lime2" "arm-linux-gnueabihf"))
|
| 1407 |
|
| 1408 | (define-public u-boot-a20-olinuxino-micro
|
| 1409 | (make-u-boot-package "A20-OLinuXino_MICRO" "arm-linux-gnueabihf"))
|
| 1410 |
|
| 1411 | (define-public u-boot-wandboard
|
| 1412 | (make-u-boot-package "wandboard" "arm-linux-gnueabihf"))
|
| 1413 |
|
| 1414 | (define-public u-boot-mx6cuboxi
|
| 1415 | (make-u-boot-package "mx6cuboxi" "arm-linux-gnueabihf"))
|
| 1416 |
|
| 1417 | (define-public u-boot-novena
|
| 1418 | (make-u-boot-package
|
| 1419 | "novena" "arm-linux-gnueabihf"
|
| 1420 | |
| 1421 | |
| 1422 | #:configs '("# CONFIG_SPL_FS_FAT is not set")
|
| 1423 | #:append-description "This U-Boot is built for Novena. Be advised that this
|
| 1424 | version, contrary to Novena upstream, does not load u-boot.img from the first
|
| 1425 | partition."))
|
| 1426 |
|
| 1427 | (define-public u-boot-orangepi-r1-plus-lts-rk3328
|
| 1428 | (make-u-boot-rockchip-package "orangepi-r1-plus-lts" 'rk3328))
|
| 1429 |
|
| 1430 | (define-public u-boot-cubieboard
|
| 1431 | (make-u-boot-package "Cubieboard" "arm-linux-gnueabihf"))
|
| 1432 |
|
| 1433 | (define-public u-boot-cubietruck
|
| 1434 | (make-u-boot-package "Cubietruck" "arm-linux-gnueabihf"))
|
| 1435 |
|
| 1436 | (define-public u-boot-puma-rk3399
|
| 1437 | (make-u-boot-rockchip-package "puma" 'rk3399))
|
| 1438 |
|
| 1439 | (define-public u-boot-qemu-arm
|
| 1440 | (make-u-boot-package "qemu_arm" "arm-linux-gnueabihf"
|
| 1441 | |
| 1442 | |
| 1443 | |
| 1444 | |
| 1445 | #:configs '("# CONFIG_FIT_SIGNATURE is not set")))
|
| 1446 |
|
| 1447 | (define-public u-boot-qemu-arm64
|
| 1448 | (make-u-boot-package "qemu_arm64" "aarch64-linux-gnu"
|
| 1449 | |
| 1450 | |
| 1451 | |
| 1452 | |
| 1453 | #:configs '("# CONFIG_FIT_SIGNATURE is not set")))
|
| 1454 |
|
| 1455 | (define-public u-boot-qemu-riscv64
|
| 1456 | (make-u-boot-package "qemu-riscv64" "riscv64-linux-gnu"))
|
| 1457 |
|
| 1458 | (define-public u-boot-qemu-riscv64-smode
|
| 1459 | (make-u-boot-package "qemu-riscv64_smode" "riscv64-linux-gnu"))
|
| 1460 |
|
| 1461 | (define-public u-boot-sandbox
|
| 1462 | (define base
|
| 1463 | (make-u-boot-package
|
| 1464 | "sandbox" #f |
| 1465 | |
| 1466 | |
| 1467 | #:configs (map (cut string-append "# CONFIG_" <> " is not set")
|
| 1468 | '("FIT_CIPHER" "MBEDTLS_LIB" "HKDF_MBEDTLS"))
|
| 1469 | #:append-description
|
| 1470 | "The sandbox configuration of U-Boot provides a @command{u-boot}
|
| 1471 | command that runs as a normal user space application. It can be used to
|
| 1472 | test the functionality of U-Boot interactively without having to deploy
|
| 1473 | to an actual target device. @xref{Sandbox<6>,,,u-boot, The U-Boot
|
| 1474 | Documentation} for more information (for example by running @samp{info
|
| 1475 | \"(u-boot) Sandbox<6>\"})."))
|
| 1476 | (package
|
| 1477 | (inherit base)
|
| 1478 | (arguments
|
| 1479 | (substitute-keyword-arguments arguments
|
| 1480 | ((#:phases phases '%standard-phases)
|
| 1481 | #~(modify-phases #$phases
|
| 1482 | (add-after 'install 'symlink-u-boot-command
|
| 1483 | (lambda* (#:key outputs #:allow-other-keys)
|
| 1484 | |
| 1485 | (mkdir (string-append #$output "/bin"))
|
| 1486 | (symlink (search-input-file outputs "libexec/u-boot")
|
| 1487 | (string-append #$output "/bin/u-boot"))))))))
|
| 1488 | |
| 1489 | (inputs (modify-inputs inputs
|
| 1490 | (append efitools sdl2)))))
|
| 1491 |
|
| 1492 | (define-public u-boot-sifive-unleashed
|
| 1493 | (let ((base (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu")))
|
| 1494 | (package
|
| 1495 | (inherit base)
|
| 1496 | (arguments
|
| 1497 | (substitute-keyword-arguments arguments
|
| 1498 | ((#:phases phases)
|
| 1499 | #~(modify-phases #$phases
|
| 1500 | (add-after 'unpack 'set-environment
|
| 1501 | (lambda* (#:key inputs #:allow-other-keys)
|
| 1502 | (setenv "OPENSBI" (search-input-file inputs
|
| 1503 | "fw_dynamic.bin"))))))))
|
| 1504 | (inputs
|
| 1505 | (modify-inputs inputs
|
| 1506 | (append opensbi-generic))))))
|
| 1507 |
|
| 1508 | (define-public u-boot-sifive-unmatched
|
| 1509 | (let ((base (make-u-boot-package "sifive_unmatched" "riscv64-linux-gnu")))
|
| 1510 | (package
|
| 1511 | (inherit base)
|
| 1512 | (arguments
|
| 1513 | (substitute-keyword-arguments arguments
|
| 1514 | ((#:phases phases)
|
| 1515 | #~(modify-phases #$phases
|
| 1516 | (add-after 'unpack 'set-environment
|
| 1517 | (lambda* (#:key inputs #:allow-other-keys)
|
| 1518 | (setenv "OPENSBI" (search-input-file inputs
|
| 1519 | "fw_dynamic.bin"))))))))
|
| 1520 | (inputs
|
| 1521 | (modify-inputs inputs
|
| 1522 | (append opensbi-generic))))))
|
| 1523 |
|
| 1524 | (define-public u-boot-starfive-visionfive2
|
| 1525 | (let ((base (make-u-boot-package
|
| 1526 | "starfive_visionfive2" "riscv64-linux-gnu"
|
| 1527 | |
| 1528 | |
| 1529 | #:configs '("CONFIG_SYS_CBSIZE=1024"
|
| 1530 | "CONFIG_WGET_HTTPS")))) |
| 1531 | (package
|
| 1532 | (inherit base)
|
| 1533 | (arguments
|
| 1534 | (substitute-keyword-arguments arguments
|
| 1535 | ((#:phases phases)
|
| 1536 | #~(modify-phases #$phases
|
| 1537 | (add-after 'unpack 'set-environment
|
| 1538 | (lambda* (#:key inputs #:allow-other-keys)
|
| 1539 | (setenv "OPENSBI" (search-input-file inputs
|
| 1540 | "fw_dynamic.bin"))))
|
| 1541 | (add-after 'install 'install-u-boot-spl.bin.normal.out
|
| 1542 | (lambda _
|
| 1543 | (install-file "spl/u-boot-spl.bin.normal.out"
|
| 1544 | (string-append #$output
|
| 1545 | "/libexec/spl"))))))))
|
| 1546 | (inputs
|
| 1547 | (modify-inputs inputs
|
| 1548 | (append opensbi-for-visionfive2))))))
|
| 1549 |
|
| 1550 | (define-public u-boot-rock64-rk3328
|
| 1551 | (make-u-boot-rockchip-package "rock64" 'rk3328))
|
| 1552 |
|
| 1553 | (define-public u-boot-firefly-rk3399
|
| 1554 | (make-u-boot-rockchip-package "firefly" 'rk3399))
|
| 1555 |
|
| 1556 | (define-public u-boot-rock-4c-plus-rk3399
|
| 1557 | (make-u-boot-rockchip-package "rock-4c-plus" 'rk3399))
|
| 1558 |
|
| 1559 | (define-public u-boot-rockpro64-rk3399
|
| 1560 | (let ((base (make-u-boot-rockchip-package
|
| 1561 | "rockpro64" 'rk3399
|
| 1562 | '("CONFIG_USB=y"
|
| 1563 | "CONFIG_AHCI=y"
|
| 1564 | "CONFIG_AHCI_PCI=y"
|
| 1565 | "CONFIG_SATA=y"
|
| 1566 | "CONFIG_SATA_SIL=y"
|
| 1567 | "CONFIG_SCSI=y"
|
| 1568 | "CONFIG_SCSI_AHCI=y"
|
| 1569 | |
| 1570 | |
| 1571 | "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
|
| 1572 | (package
|
| 1573 | (inherit base))))
|
| 1574 |
|
| 1575 | (define-public u-boot-pinebook-pro-rk3399
|
| 1576 | (make-u-boot-rockchip-package "pinebook-pro" 'rk3399))
|
| 1577 |
|
| 1578 | (define-public u-boot-nanopi-r4s-rk3399
|
| 1579 | (make-u-boot-rockchip-package "nanopi-r4s" 'rk3399))
|
| 1580 |
|
| 1581 | (define*-public (make-u-boot-bin-package u-boot-package
|
| 1582 | #:key
|
| 1583 | (u-boot-bin "u-boot.bin"))
|
| 1584 | "Return a package with a single U-BOOT-BIN file from the U-BOOT-PACKAGE.
|
| 1585 | The package name will be that of the U-BOOT package suffixed with \"-bin\"."
|
| 1586 | (package
|
| 1587 | (name (string-append (package-name u-boot-package) "-bin"))
|
| 1588 | (version (package-version u-boot-package))
|
| 1589 | (source #f)
|
| 1590 | (build-system trivial-build-system)
|
| 1591 | (arguments
|
| 1592 | (list
|
| 1593 | #:builder
|
| 1594 | (with-imported-modules '((guix build utils))
|
| 1595 | #~(begin
|
| 1596 | (use-modules (guix build utils))
|
| 1597 | (mkdir #$output)
|
| 1598 | (symlink (search-input-file %build-inputs
|
| 1599 | (string-append "libexec/" #$u-boot-bin))
|
| 1600 | (string-append #$output "/" #$u-boot-bin))))))
|
| 1601 | (inputs (list u-boot-package))
|
| 1602 | (home-page (package-home-page u-boot-package))
|
| 1603 | (synopsis (package-synopsis u-boot-package))
|
| 1604 | (description (string-append
|
| 1605 | (package-description u-boot-package)
|
| 1606 | "\n\n"
|
| 1607 | (format #f
|
| 1608 | "This package only contains the file ~a."
|
| 1609 | u-boot-bin)))
|
| 1610 | (license (package-license u-boot-package))))
|
| 1611 |
|
| 1612 | (define-public %u-boot-rpi-efi-configs
|
| 1613 | '("CONFIG_OF_EMBED"
|
| 1614 | "CONFIG_OF_BOARD=y"))
|
| 1615 |
|
| 1616 | (define %u-boot-rpi-description-32-bit
|
| 1617 | "This is a 32-bit build of U-Boot.")
|
| 1618 |
|
| 1619 | (define %u-boot-rpi-description-64-bit
|
| 1620 | "This is a common 64-bit build of U-Boot for all 64-bit capable Raspberry Pi
|
| 1621 | variants.")
|
| 1622 |
|
| 1623 | (define %u-boot-rpi-efi-description
|
| 1624 | "It allows network booting and uses the device-tree from the firmware,
|
| 1625 | allowing the usage of overlays. It can act as an EFI firmware for the
|
| 1626 | grub-efi-netboot-removable-bootloader.")
|
| 1627 |
|
| 1628 | (define %u-boot-rpi-efi-description-32-bit
|
| 1629 | (string-append %u-boot-rpi-efi-description " "
|
| 1630 | %u-boot-rpi-description-32-bit))
|
| 1631 |
|
| 1632 | (define-public u-boot-rpi-2
|
| 1633 | (make-u-boot-package "rpi_2" "arm-linux-gnueabihf"
|
| 1634 | #:append-description %u-boot-rpi-description-32-bit))
|
| 1635 |
|
| 1636 | (define-public u-boot-rpi-3-32b
|
| 1637 | (make-u-boot-package "rpi_3_32b" "arm-linux-gnueabihf"
|
| 1638 | #:append-description %u-boot-rpi-description-32-bit))
|
| 1639 |
|
| 1640 | (define-public u-boot-rpi-4-32b
|
| 1641 | (make-u-boot-package "rpi_4_32b" "arm-linux-gnueabihf"
|
| 1642 | #:append-description %u-boot-rpi-description-32-bit))
|
| 1643 |
|
| 1644 | (define-public u-boot-rpi-arm64
|
| 1645 | (make-u-boot-package "rpi_arm64" "aarch64-linux-gnu"
|
| 1646 | #:configs '("CONFIG_WGET_HTTPS") |
| 1647 | #:append-description %u-boot-rpi-description-64-bit))
|
| 1648 |
|
| 1649 | (define-public u-boot-rpi-2-efi
|
| 1650 | (make-u-boot-package "rpi_2" "arm-linux-gnueabihf"
|
| 1651 | #:name-suffix "-efi"
|
| 1652 | #:configs %u-boot-rpi-efi-configs
|
| 1653 | #:append-description %u-boot-rpi-efi-description-32-bit))
|
| 1654 |
|
| 1655 | (define-public u-boot-rpi-3-32b-efi
|
| 1656 | (make-u-boot-package "rpi_3_32b" "arm-linux-gnueabihf"
|
| 1657 | #:name-suffix "-efi"
|
| 1658 | #:configs %u-boot-rpi-efi-configs
|
| 1659 | #:append-description %u-boot-rpi-efi-description-32-bit))
|
| 1660 |
|
| 1661 | (define-public u-boot-rpi-4-32b-efi
|
| 1662 | (make-u-boot-package "rpi_4_32b" "arm-linux-gnueabihf"
|
| 1663 | #:name-suffix "-efi"
|
| 1664 | #:configs %u-boot-rpi-efi-configs
|
| 1665 | #:append-description %u-boot-rpi-efi-description-32-bit))
|
| 1666 |
|
| 1667 | (define-public u-boot-rpi-arm64-efi
|
| 1668 | (make-u-boot-package "rpi_arm64" "aarch64-linux-gnu"
|
| 1669 | #:name-suffix "-efi"
|
| 1670 | #:configs (cons "CONFIG_WGET_HTTPS" |
| 1671 | %u-boot-rpi-efi-configs)
|
| 1672 | #:append-description (string-append
|
| 1673 | %u-boot-rpi-efi-description " "
|
| 1674 | %u-boot-rpi-description-64-bit)))
|
| 1675 |
|
| 1676 | (define-public u-boot-rpi-2-bin (make-u-boot-bin-package u-boot-rpi-2))
|
| 1677 |
|
| 1678 | (define-public u-boot-rpi-3_32b-bin (make-u-boot-bin-package u-boot-rpi-3-32b))
|
| 1679 |
|
| 1680 | (define-public u-boot-rpi-4_32b-bin (make-u-boot-bin-package u-boot-rpi-4-32b))
|
| 1681 |
|
| 1682 | (define-public u-boot-rpi-arm64-bin (make-u-boot-bin-package u-boot-rpi-arm64))
|
| 1683 |
|
| 1684 | (define-public u-boot-rpi-2-efi-bin (make-u-boot-bin-package u-boot-rpi-2-efi))
|
| 1685 |
|
| 1686 | (define-public u-boot-rpi-3-32b-efi-bin
|
| 1687 | (make-u-boot-bin-package u-boot-rpi-3-32b-efi))
|
| 1688 |
|
| 1689 | (define-public u-boot-rpi-4-32b-efi-bin
|
| 1690 | (make-u-boot-bin-package u-boot-rpi-4-32b-efi))
|
| 1691 |
|
| 1692 | (define-public u-boot-rpi-arm64-efi-bin
|
| 1693 | (make-u-boot-bin-package u-boot-rpi-arm64-efi))
|
| 1694 |
|
| 1695 | (define u-boot-ts-mx6
|
| 1696 | |
| 1697 | |
| 1698 | (let ((revision "0")
|
| 1699 | (commit "08809160fbc60d6e949fa9d37d9a41aab8fef742"))
|
| 1700 | (package
|
| 1701 | (inherit u-boot)
|
| 1702 | (name "u-boot-ts-mx6")
|
| 1703 | (version (git-version "2015.04_3" revision commit))
|
| 1704 | (source (origin
|
| 1705 | (method git-fetch)
|
| 1706 | (uri (git-reference
|
| 1707 | (url "https://github.com/embeddedTS/u-boot-imx")
|
| 1708 | (commit commit)))
|
| 1709 | (file-name (git-file-name "u-boot-imx-ts" version))
|
| 1710 | (sha256
|
| 1711 | (base32
|
| 1712 | "01mja33351hkcs59rmfvppqlxqw4rh9gng7a7hx2cfspqwh2y6kr"))))
|
| 1713 | (arguments
|
| 1714 | (substitute-keyword-arguments arguments
|
| 1715 | ((#:phases phases '%standard-phases)
|
| 1716 | #~(modify-phases #$phases
|
| 1717 | (add-after 'unpack 'patch-u-boot
|
| 1718 | (lambda _
|
| 1719 | (substitute* (find-files "include/configs" "^ts[0-9]{4}\\.h$")
|
| 1720 | |
| 1721 | (("/boot/uImage")
|
| 1722 | "/boot/zImage")
|
| 1723 | (("uimage")
|
| 1724 | "zimage")
|
| 1725 | (("bootm \\$\\{loadaddr}")
|
| 1726 | "bootz ${loadaddr}")
|
| 1727 | |
| 1728 | (("ts7970-revf.dtb")
|
| 1729 | "ts7970.dtb")
|
| 1730 | |
| 1731 | |
| 1732 | |
| 1733 | |
| 1734 |
|
| 1735 | |
| 1736 | |
| 1737 | (("CONFIG_BOOTCOMMAND")
|
| 1738 | "CONFIG_BOOTCOMMAND_DISABLED")
|
| 1739 | (("CONFIG_BOOTDELAY")
|
| 1740 | "CONFIG_BOOTDELAY_DISABLED")
|
| 1741 | |
| 1742 | (("#define CONFIG_EXTRA_ENV_SETTINGS.*" anchor)
|
| 1743 | (string-append "\
|
| 1744 | #include <config_distro_defaults.h>
|
| 1745 |
|
| 1746 | #define MEM_LAYOUT_ENV_SETTINGS \\
|
| 1747 | \t\"bootm_size=0x10000000\\0\" \\
|
| 1748 | \t\"kernel_addr_r=0x10800000\\0\" \\
|
| 1749 | \t\"fdt_addr_r=0x18000000\\0\" \\
|
| 1750 | \t\"scriptaddr=0x18100000\\0\" \\
|
| 1751 | \t\"pxefile_addr_r=0x18200000\\0\" \\
|
| 1752 | \t\"ramdisk_addr_r=0x18300000\\0\"
|
| 1753 |
|
| 1754 | #define BOOT_TARGET_DEVICES(func) \\
|
| 1755 | \tfunc(MMC, mmc, 0) \\
|
| 1756 | \tfunc(MMC, mmc, 1) \\
|
| 1757 | \tfunc(SATA, sata, 0) \\
|
| 1758 | \tfunc(USB, usb, 0) \\
|
| 1759 | \tfunc(PXE, pxe, na) \\
|
| 1760 | \tfunc(DHCP, dhcp, na)
|
| 1761 |
|
| 1762 | #include <config_distro_bootcmd.h>
|
| 1763 |
|
| 1764 | " anchor
|
| 1765 |
|
| 1766 | |
| 1767 | |
| 1768 | |
| 1769 | "\
|
| 1770 | \t\"fdtfile=DEFAULT_FDT_FILE\\0\" \\
|
| 1771 | \tMEM_LAYOUT_ENV_SETTINGS \\
|
| 1772 | \tBOOTENV \\\n")))))
|
| 1773 | (add-after 'unpack 'patch-for-reproducibility
|
| 1774 | (lambda _
|
| 1775 | |
| 1776 | |
| 1777 | (substitute* "Makefile"
|
| 1778 | (("U_BOOT_DATE \"%b %d %C%y\"")
|
| 1779 | "U_BOOT_DATE \"Jan 01 1969\"")
|
| 1780 | (("U_BOOT_TIME \"%T\"")
|
| 1781 | "U_BOOT_TIME \"00:00:00\""))))
|
| 1782 | (add-before 'build 'adjust-for-current-gcc
|
| 1783 | (lambda _
|
| 1784 | (let ((gcc-major-version #$(version-major
|
| 1785 | (package-version gcc))))
|
| 1786 | (copy-file "include/linux/compiler-gcc6.h"
|
| 1787 | (string-append "include/linux/compiler-gcc"
|
| 1788 | gcc-major-version ".h")))
|
| 1789 | (substitute* "arch/arm/Makefile"
|
| 1790 | (("march=armv5")
|
| 1791 | "march=armv5te"))))
|
| 1792 | (add-after 'install 'build+install-tools
|
| 1793 | (lambda* (#:key make-flags #:allow-other-keys)
|
| 1794 | (apply invoke "make" "tools-all" make-flags)
|
| 1795 | (install-file "tools/env/fw_printenv"
|
| 1796 | (string-append #$output "/bin"))
|
| 1797 | (symlink (string-append #$output "/bin/fw_printenv")
|
| 1798 | (string-append #$output "/bin/fw_setenv"))))))))
|
| 1799 | (native-inputs
|
| 1800 | (modify-inputs native-inputs
|
| 1801 | (delete "dtc")))))) |
| 1802 |
|
| 1803 | |
| 1804 | |
| 1805 | |
| 1806 | |
| 1807 | (define-public u-boot-ts7970-q-2g-1000mhz-c
|
| 1808 | (let ((base
|
| 1809 | (make-u-boot-package "ts7970-q-2g-1000mhz-c" "arm-linux-gnueabihf"
|
| 1810 | #:u-boot u-boot-ts-mx6
|
| 1811 | #:append-description
|
| 1812 | "This U-Boot variant is for the Technologic
|
| 1813 | Systems TS-7970 revision C board, which includes a quad core Freescale i.MX6
|
| 1814 | CPU and 2 GiB of RAM clocked at 1000MHz. The binary U-Boot image to flash is
|
| 1815 | the @file{libexec/u-boot.imx} file. It can be used with the @file{zImage} and
|
| 1816 | the @file{imx6q-ts7970.dtb} files provided by the
|
| 1817 | @code{linux-libre-arm-generic} image.
|
| 1818 |
|
| 1819 | To flash this bootloader, write it to an SD card, then using the U-Boot serial
|
| 1820 | console:
|
| 1821 | @example
|
| 1822 | mmc dev 0
|
| 1823 | load mmc 0:1 ${loadaddr} /boot/u-boot.imx
|
| 1824 | sf probe
|
| 1825 | sf erase 0 0x80000
|
| 1826 | sf write ${loadaddr} 0x400 $filesize
|
| 1827 | @end example
|
| 1828 |
|
| 1829 | The factory values of U-Boot must also be reset so that it boots using a
|
| 1830 | zImage instead of the default uImage:
|
| 1831 | @example
|
| 1832 | run clearenv
|
| 1833 | reset
|
| 1834 | @end example
|
| 1835 |
|
| 1836 | For more information, refer to
|
| 1837 | @url{https://docs.embeddedts.com/TS-7970#Update_U-Boot}.")))
|
| 1838 | (package
|
| 1839 | (inherit base)
|
| 1840 | (arguments
|
| 1841 | (substitute-keyword-arguments arguments
|
| 1842 | ((#:phases phases '%standard-phases)
|
| 1843 | #~(modify-phases #$phases
|
| 1844 | (add-after 'patch-u-boot 'set-default-fdt-file
|
| 1845 | (lambda _
|
| 1846 | (substitute* "include/configs/ts7970.h"
|
| 1847 | (("DEFAULT_FDT_FILE")
|
| 1848 | "imx6q-ts7970.dtb")))))))))))
|
| 1849 |
|
| 1850 | (define-public os-prober
|
| 1851 | (package
|
| 1852 | (name "os-prober")
|
| 1853 | (version "1.84")
|
| 1854 | (source
|
| 1855 | (origin
|
| 1856 | (method git-fetch)
|
| 1857 | (uri (git-reference
|
| 1858 | (url "https://salsa.debian.org/installer-team/os-prober.git")
|
| 1859 | (commit version)))
|
| 1860 | (file-name (git-file-name name version))
|
| 1861 | (sha256
|
| 1862 | (base32 "1bji3w6nbqaz8zqrbmy8b1j5dph9xn7bdh1cd2z8ia1q125i6mgp"))))
|
| 1863 | (build-system gnu-build-system)
|
| 1864 | (arguments
|
| 1865 | (list
|
| 1866 | #:tests? #f |
| 1867 | #:modules '((guix build gnu-build-system)
|
| 1868 | (guix build utils)
|
| 1869 | (ice-9 regex) |
| 1870 | (srfi srfi-26)) |
| 1871 | #:make-flags
|
| 1872 | #~(list (string-append "CC=" #$(cc-for-target)))
|
| 1873 | #:phases
|
| 1874 | #~(modify-phases %standard-phases
|
| 1875 | (replace 'configure
|
| 1876 | (lambda _
|
| 1877 | (substitute* (find-files ".")
|
| 1878 | (("/usr") #$output))
|
| 1879 | (substitute* (find-files "." "50mounted-tests$")
|
| 1880 | (("mkdir") "mkdir -p -v"))))
|
| 1881 | (replace 'install
|
| 1882 | (lambda _
|
| 1883 | (define (find-files-non-recursive directory)
|
| 1884 | (find-files directory
|
| 1885 | (lambda (file stat)
|
| 1886 | (string-match (string-append "^" directory "/[^/]*$")
|
| 1887 | file))
|
| 1888 | #:directories? #t))
|
| 1889 |
|
| 1890 | (let ((bin (string-append #$output "/bin"))
|
| 1891 | (lib (string-append #$output "/lib"))
|
| 1892 | (share (string-append #$output "/share")))
|
| 1893 | (for-each (cut install-file <> bin)
|
| 1894 | (list "linux-boot-prober" "os-prober"))
|
| 1895 | (install-file "newns" (string-append lib "/os-prober"))
|
| 1896 | (install-file "common.sh" (string-append share "/os-prober"))
|
| 1897 | (install-file "os-probes/mounted/powerpc/20macosx"
|
| 1898 | (string-append lib "/os-probes/mounted"))
|
| 1899 | (for-each
|
| 1900 | (lambda (directory)
|
| 1901 | (for-each
|
| 1902 | (lambda (file)
|
| 1903 | (let ((destination (string-append lib "/" directory
|
| 1904 | "/" (basename file))))
|
| 1905 | (mkdir-p (dirname destination))
|
| 1906 | (copy-recursively file destination)))
|
| 1907 | (append (find-files-non-recursive (string-append directory "/common"))
|
| 1908 | (find-files-non-recursive (string-append directory "/x86")))))
|
| 1909 | (list "linux-boot-probes"
|
| 1910 | "linux-boot-probes/mounted"
|
| 1911 | "os-probes"
|
| 1912 | "os-probes/init"
|
| 1913 | "os-probes/mounted"))))))))
|
| 1914 | (home-page "https://joeyh.name/code/os-prober/")
|
| 1915 | (synopsis "Detect other operating systems")
|
| 1916 | (description "os-prober probes disks on the system for other operating
|
| 1917 | systems so that they can be added to the bootloader. It also works out how to
|
| 1918 | boot existing GNU/Linux systems and detects what distribution is installed in
|
| 1919 | order to add a suitable bootloader menu entry.")
|
| 1920 | (license license:gpl2+)))
|
| 1921 |
|
| 1922 | (define-public ipxe
|
| 1923 | |
| 1924 | |
| 1925 | |
| 1926 | |
| 1927 | |
| 1928 | (let ((timestamp "1756877872")
|
| 1929 | (commit "969ce2c559a6841a949a1b73a3967b1889e0c999")
|
| 1930 | (revision "4"))
|
| 1931 | (package
|
| 1932 | (name "ipxe")
|
| 1933 | (version (git-version "1.21.1" revision commit))
|
| 1934 | (source (origin
|
| 1935 | (method git-fetch)
|
| 1936 | (uri (git-reference
|
| 1937 | (url "https://github.com/ipxe/ipxe")
|
| 1938 | (commit commit)))
|
| 1939 | (file-name (git-file-name name version))
|
| 1940 | (sha256
|
| 1941 | (base32
|
| 1942 | "0ijgc9w0az2zb5w5zlzfxjqizhx8fxc2rgq47wgbpka0ssindlvb"))))
|
| 1943 | (build-system gnu-build-system)
|
| 1944 | (arguments
|
| 1945 | (list
|
| 1946 | #:modules `((guix build utils)
|
| 1947 | (guix build gnu-build-system)
|
| 1948 | (guix base32)
|
| 1949 | (ice-9 string-fun)
|
| 1950 | (ice-9 regex)
|
| 1951 | (rnrs bytevectors))
|
| 1952 | #:imported-modules `((guix base32)
|
| 1953 | ,@%default-gnu-imported-modules)
|
| 1954 | #:make-flags
|
| 1955 | |
| 1956 | |
| 1957 | |
| 1958 | |
| 1959 | |
| 1960 | #~(let ((build-id
|
| 1961 | (lambda (out)
|
| 1962 | (let* ((nix-store (string-append
|
| 1963 | (or (getenv "NIX_STORE") "/gnu/store")
|
| 1964 | "/"))
|
| 1965 | (filename
|
| 1966 | (string-replace-substring out nix-store ""))
|
| 1967 | (hash (match:substring (string-match "[0-9a-z]{32}"
|
| 1968 | filename)))
|
| 1969 | (bv (nix-base32-string->bytevector hash)))
|
| 1970 | (format #f "0x~x"
|
| 1971 | (bytevector-u32-ref bv 0 (endianness big))))))
|
| 1972 | (syslinux #$(this-package-native-input "syslinux")))
|
| 1973 | (list "ECHO_E_BIN_ECHO=echo"
|
| 1974 | "ECHO_E_BIN_ECHO_E=echo -e"
|
| 1975 |
|
| 1976 | |
| 1977 | (string-append "BUILD_ID_CMD=echo -n " (build-id #$output))
|
| 1978 | (string-append "BUILD_TIMESTAMP=" #$timestamp)
|
| 1979 | "everything"))
|
| 1980 | #:phases
|
| 1981 | #~(modify-phases %standard-phases
|
| 1982 | (add-after 'unpack 'enter-source-directory
|
| 1983 | (lambda _ (chdir "src")))
|
| 1984 | (add-after 'enter-source-directory 'set-version
|
| 1985 | (lambda _
|
| 1986 | |
| 1987 | |
| 1988 | (substitute* "Makefile"
|
| 1989 | (("^VERSION[[:blank:]]+=.*")
|
| 1990 | (string-append "VERSION = " #$(package-version this-package)
|
| 1991 | "-guix\n")))))
|
| 1992 | (add-after 'enter-source-directory 'set-options
|
| 1993 | (lambda _
|
| 1994 | (substitute* "config/general.h"
|
| 1995 | (("^//(#define PING_CMD.*)" _ uncommented) uncommented)
|
| 1996 | (("^//(#define IMAGE_TRUST_CMD.*)" _ uncommented)
|
| 1997 | uncommented)
|
| 1998 | (("^#undef.*(DOWNLOAD_PROTO_HTTPS.*)" _ option)
|
| 1999 | (string-append "#define " option))
|
| 2000 | (("^#undef.*(DOWNLOAD_PROTO_NFS.*)" _ option)
|
| 2001 | (string-append "#define " option)))))
|
| 2002 | |
| 2003 | (add-after 'enter-source-directory 'skip-i386-tap-linux
|
| 2004 | (lambda _
|
| 2005 | (substitute* "Makefile"
|
| 2006 | (("bin-i386-linux/tap.linux") "")
|
| 2007 | (("bin-i386-linux/tests.linux") ""))))
|
| 2008 | #$@(if (target-x86?)
|
| 2009 | #~((add-after 'enter-source-directory 'set-syslinux-path
|
| 2010 | |
| 2011 | |
| 2012 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2013 | (substitute* "util/genfsimg"
|
| 2014 | (("\t/usr/lib/syslinux " all)
|
| 2015 | (string-append
|
| 2016 | "\t" #$(this-package-native-input "syslinux")
|
| 2017 | "/share/syslinux \\\n"
|
| 2018 | all))))))
|
| 2019 | #~())
|
| 2020 | #$@(if (target-x86-32?)
|
| 2021 | |
| 2022 | |
| 2023 | #~((add-after 'enter-source-directory 'fix-x86-align
|
| 2024 | (lambda _
|
| 2025 | (setenv "HOST_EFI_CFLAGS" "-malign-double"))))
|
| 2026 | #~())
|
| 2027 | (delete 'configure) |
| 2028 | (replace 'install
|
| 2029 | (lambda _
|
| 2030 | (let* ((ipxe (string-append #$output "/lib/ipxe"))
|
| 2031 | (exts-re
|
| 2032 | "\\.(efi|efirom|iso|kkpxe|kpxe|lkrn|mrom|pxe|rom|usb)$")
|
| 2033 | (dirs '("bin" "bin-i386-linux" "bin-x86_64-pcbios"
|
| 2034 | "bin-x86_64-efi" "bin-x86_64-linux" "bin-i386-efi"))
|
| 2035 | (files (apply append
|
| 2036 | (map (lambda (dir)
|
| 2037 | (find-files dir exts-re)) dirs))))
|
| 2038 | (for-each (lambda (file)
|
| 2039 | (let* ((subdir (dirname file))
|
| 2040 | (fn (basename file))
|
| 2041 | (tgtsubdir (cond
|
| 2042 | ((string=? "bin" subdir) "")
|
| 2043 | ((string-prefix? "bin-" subdir)
|
| 2044 | (string-drop subdir 4)))))
|
| 2045 | (install-file file
|
| 2046 | (string-append ipxe "/" tgtsubdir))))
|
| 2047 | files))))
|
| 2048 | (add-after 'install 'leave-source-directory
|
| 2049 | (lambda _ (chdir ".."))))
|
| 2050 | #:tests? #f)) |
| 2051 | (native-inputs
|
| 2052 | (append (if (target-x86?)
|
| 2053 | |
| 2054 | (list syslinux)
|
| 2055 | '())
|
| 2056 | (list perl xorriso)))
|
| 2057 | (home-page "https://ipxe.org")
|
| 2058 | (synopsis "PXE-compliant network boot firmware")
|
| 2059 | (description "iPXE is a network boot firmware. It provides a full PXE
|
| 2060 | implementation enhanced with additional features such as booting from: a web
|
| 2061 | server via HTTP, an iSCSI SAN, a Fibre Channel SAN via FCoE, an AoE SAN, a
|
| 2062 | wireless network, a wide-area network, an Infiniband network. It
|
| 2063 | controls the boot process with a script. You can use iPXE to replace the
|
| 2064 | existing PXE ROM on your network card, or you can chainload into iPXE to obtain
|
| 2065 | the features of iPXE without the hassle of reflashing.")
|
| 2066 | (license license:gpl2+))))
|
| 2067 |
|
| 2068 | (define-public ipxe-qemu
|
| 2069 | (package/inherit ipxe
|
| 2070 | (name "ipxe-qemu")
|
| 2071 | (native-inputs
|
| 2072 | |
| 2073 | (if (target-x86-64?)
|
| 2074 | (modify-inputs native-inputs
|
| 2075 | (prepend edk2-tools))
|
| 2076 | (if (target-64bit?)
|
| 2077 | (modify-inputs native-inputs
|
| 2078 | (prepend edk2-tools
|
| 2079 | (cross-gcc "x86_64-linux-gnu")
|
| 2080 | (cross-binutils "x86_64-linux-gnu")))
|
| 2081 | |
| 2082 | (let ((binutils-64-bit-bfd
|
| 2083 | (package/inherit
|
| 2084 | binutils
|
| 2085 | (name "binutils-64-bit-bfd")
|
| 2086 | (arguments
|
| 2087 | (substitute-keyword-arguments arguments
|
| 2088 | ((#:configure-flags flags ''())
|
| 2089 | #~(cons* "--enable-64-bit-bfd" #$flags)))))))
|
| 2090 | (modify-inputs native-inputs
|
| 2091 | (prepend edk2-tools
|
| 2092 | (make-ld-wrapper "ld-wrapper-64-bit-bfd"
|
| 2093 | #:binutils binutils)
|
| 2094 | binutils-64-bit-bfd
|
| 2095 | (cross-gcc "x86_64-linux-gnu")
|
| 2096 | (cross-binutils "x86_64-linux-gnu")))))))
|
| 2097 | (arguments
|
| 2098 | (let ((roms
|
| 2099 | |
| 2100 | |
| 2101 | '(("e1000" . ("8086" . "100e"))
|
| 2102 | ("e1000e" . ("8086" . "10d3"))
|
| 2103 | ("eepro100" . ("8086" . "1209"))
|
| 2104 | ("ne2k_pci" . ("1050" . "0940"))
|
| 2105 | ("pcnet" . ("1022" . "2000"))
|
| 2106 | ("rtl8139" . ("10ec" . "8139"))
|
| 2107 | ("virtio" . ("1af4" . "1000"))
|
| 2108 | ("vmxnet3" . ("15ad" . "07b0")))))
|
| 2109 | (substitute-keyword-arguments arguments
|
| 2110 | ((#:modules modules)
|
| 2111 | `((ice-9 match) ,@modules))
|
| 2112 | ((#:make-flags flags)
|
| 2113 | #~(append (delete "everything" #$flags)
|
| 2114 | '("CONFIG=qemu"
|
| 2115 | #$@(if (target-x86-64?)
|
| 2116 | '()
|
| 2117 | '("CROSS_COMPILE=x86_64-linux-gnu-")))
|
| 2118 | (map (match-lambda
|
| 2119 | ((_ . (vid . did))
|
| 2120 | (string-append "bin/" vid did ".rom")))
|
| 2121 | '#$roms)
|
| 2122 | (map (match-lambda
|
| 2123 | ((_ . (vid . did))
|
| 2124 | (string-append "bin-x86_64-efi/"
|
| 2125 | vid did ".efidrv")))
|
| 2126 | '#$roms)))
|
| 2127 | ((#:phases phases)
|
| 2128 | #~(modify-phases #$phases
|
| 2129 | (replace 'install
|
| 2130 | (lambda _
|
| 2131 | (let ((firmware (string-append #$output "/share/qemu")))
|
| 2132 | (mkdir-p firmware)
|
| 2133 | (for-each
|
| 2134 | (match-lambda
|
| 2135 | ((name . (vid . did))
|
| 2136 | (let ((rom (string-append "bin/" vid did ".rom")))
|
| 2137 | (copy-file rom
|
| 2138 | (string-append firmware
|
| 2139 | "/pxe-" name ".rom"))
|
| 2140 | (invoke "EfiRom"
|
| 2141 | "-b" rom
|
| 2142 | "-l" "0x02"
|
| 2143 | "-f" (string-append "0x" vid)
|
| 2144 | "-i" (string-append "0x" did)
|
| 2145 | "-ec" (string-append "bin-x86_64-efi/"
|
| 2146 | vid did ".efidrv")
|
| 2147 | "-o" (string-append firmware
|
| 2148 | "/efi-" name ".rom")))))
|
| 2149 | '#$roms)))))))))))
|
| 2150 |
|
| 2151 | (define-public refind
|
| 2152 | (package
|
| 2153 | (name "refind")
|
| 2154 | (version "0.14.2")
|
| 2155 | (source (origin
|
| 2156 | (method url-fetch)
|
| 2157 | (uri (string-append "mirror://sourceforge/refind/" version
|
| 2158 | "/refind-src-" version ".tar.gz"))
|
| 2159 | (sha256
|
| 2160 | (base32
|
| 2161 | "1w682p0j59apjcy26xzzhv70fyd8nqjs47i8cz2qcsx71pl3rngp"))
|
| 2162 | (snippet
|
| 2163 | #~(begin
|
| 2164 | (use-modules (guix build utils))
|
| 2165 | (delete-file-recursively
|
| 2166 | "refind/tools_x64/gptsync_x64.efi")))))
|
| 2167 | (build-system gnu-build-system)
|
| 2168 | (outputs '("out" "doc"))
|
| 2169 | (native-inputs
|
| 2170 | (list binutils))
|
| 2171 | (inputs
|
| 2172 | (list gnu-efi-3))
|
| 2173 | (arguments
|
| 2174 | (list #:tests? #f |
| 2175 | #:make-flags
|
| 2176 | #~(list |
| 2177 | |
| 2178 | |
| 2179 | |
| 2180 | "OMIT_SBAT=1"
|
| 2181 | (string-append "AR=" #$(ar-for-target))
|
| 2182 | (string-append "CC=" #$(cc-for-target))
|
| 2183 | (string-append "LD=" #$(ld-for-target))
|
| 2184 | (string-append "EFIINC=" (assoc-ref %build-inputs "gnu-efi")
|
| 2185 | "/include/efi")
|
| 2186 | (string-append "GNUEFILIB=" (assoc-ref %build-inputs "gnu-efi")
|
| 2187 | "/lib")
|
| 2188 | (string-append "EFILIB=" (assoc-ref %build-inputs "gnu-efi")
|
| 2189 | "/lib")
|
| 2190 | (string-append "EFICRT0=" (assoc-ref %build-inputs "gnu-efi")
|
| 2191 | "/lib")
|
| 2192 | (string-append "OBJCOPY=" (assoc-ref %build-inputs "binutils")
|
| 2193 | "/bin/objcopy"))
|
| 2194 | #:phases
|
| 2195 | #~(modify-phases %standard-phases
|
| 2196 | (delete 'configure)
|
| 2197 | (add-after 'build 'build-fs
|
| 2198 | (lambda* (#:key inputs make-flags #:allow-other-keys)
|
| 2199 | (apply invoke "make" "fs" make-flags)))
|
| 2200 | (replace 'install
|
| 2201 | (lambda* (#:key outputs #:allow-other-keys)
|
| 2202 | (let* ((out-sbin (string-append #$output "/sbin"))
|
| 2203 | (out-share
|
| 2204 | (string-append #$output "/share/refind-"
|
| 2205 | #$version))
|
| 2206 | (out-share-refind
|
| 2207 | (string-append out-share "/refind")))
|
| 2208 | (mkdir-p out-share)
|
| 2209 | (copy-recursively "banners"
|
| 2210 | (string-append out-share "/banners"))
|
| 2211 | (copy-recursively "fonts"
|
| 2212 | (string-append out-share "/fonts"))
|
| 2213 | (for-each (lambda (name)
|
| 2214 | (copy-recursively name
|
| 2215 | (string-append
|
| 2216 | out-share-refind "/"
|
| 2217 | name)))
|
| 2218 | (find-files "." "^drivers_" #:directories? #t))
|
| 2219 | (copy-recursively "icons"
|
| 2220 | (string-append out-share-refind "/icons"))
|
| 2221 | |
| 2222 | (install-file "mkrlconf" out-sbin)
|
| 2223 | (install-file "mvrefind" out-sbin)
|
| 2224 | (install-file "refind-sb-healthcheck" out-sbin)
|
| 2225 | (install-file "refind-install" out-share)
|
| 2226 | (install-file "refind-mkdefault" out-sbin)
|
| 2227 | (install-file "refind.conf-sample" out-share-refind)
|
| 2228 | (for-each
|
| 2229 | (lambda (name)
|
| 2230 | (install-file name
|
| 2231 | (string-append #$output "/share/man/man8")))
|
| 2232 | (find-files "docs/man" "[.]8$"))
|
| 2233 | (for-each (lambda (f)
|
| 2234 | (install-file f out-share-refind))
|
| 2235 | (find-files "refind" "refind.*\\.efi$")))))
|
| 2236 | (add-after 'install 'install-doc
|
| 2237 | (lambda* (#:key outputs #:allow-other-keys)
|
| 2238 | (let* ((out-doc
|
| 2239 | (string-append #$output:doc "/share/doc/refind-"
|
| 2240 | #$version)))
|
| 2241 | (copy-recursively "docs/refind"
|
| 2242 | (string-append out-doc "/refind"))
|
| 2243 | (copy-recursively "docs/Styles"
|
| 2244 | (string-append out-doc "/Styles"))))))))
|
| 2245 | (synopsis "rEFInd boot manager")
|
| 2246 | (description "This package provides a boot manager that is an EFI
|
| 2247 | program.")
|
| 2248 | (home-page "https://www.rodsbooks.com/refind/")
|
| 2249 | (license license:gpl3+)))
|