me
/
guix
Archived
1
0
Fork 0

gnu: bootloader: Add U-Boot packages for Raspberry Pi models.

* gnu/packages/bootloader.scm (make-u-boot-package): Add keyword
parameters 'name-suffix' and 'append-description'.
(make-u-boot-bin-package): New procedure
(%u-boot-rpi-efi-configs): New variable.
(%u-boot-rpi-description-32-bit, %u-boot-rpi-description-64-bit,
%u-boot-rpi-efi-description, %u-boot-rpi-efi-description-32-bit):
New variables.
(u-boot-rpi-2-efi, u-boot-rpi-2-bin, u-boot-rpi-2-efi-bin})
(u-boot-rpi-3-32b-efi, u-boot-rpi-3-32b-bin, u-boot-rpi-3-32b-efi-bin)
(u-boot-rpi-4-32b-efi, u-boot-rpi-4-32b-bin, u-boot-rpi-4-32b-efi-bin)
(u-boot-rpi-arm64-efi, u-boot-rpi-arm64-bin)
u-boot-rpi-arm64-efi-bin): New packages.
(u-boot-tools): Reuse the description of u-boot.
(u-boot-am335x-boneblack, u-boot-am335x-evm)
(u-boot-nintendo-nes-classic-edition, u-boot-novena): Make use of new keyword
parameters of make-u-boot-package.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
master
Stefan 2022-12-01 12:15:31 -05:00 committed by Maxim Cournoyer
parent a9acbf919a
commit c2c1dfdf57
No known key found for this signature in database
GPG Key ID: 1260E46482E63562
1 changed files with 159 additions and 45 deletions

View File

@ -772,13 +772,21 @@ def test_ctrl_c"))
(setenv "PAGER" "cat") (setenv "PAGER" "cat")
(apply invoke "make" test-target make-flags)))) (apply invoke "make" test-target make-flags))))
'())))) '()))))
(description "U-Boot is a bootloader used mostly for ARM boards. It (description (string-append
also initializes the boards (RAM etc). This package provides its (package-description u-boot)
board-independent tools."))) " This package provides board-independent tools "
"of U-Boot."))))
(define*-public (make-u-boot-package board triplet #:key defconfig configs) (define*-public (make-u-boot-package board triplet
"Returns a u-boot package for BOARD cross-compiled for TRIPLET with the #:key
optional DEFCONFIG file and optional configuration changes from CONFIGS." defconfig
configs
name-suffix
append-description)
"Return a U-Boot package for BOARD cross-compiled for TRIPLET with the
optional DEFCONFIG file and optional configuration changes from CONFIGS.
NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
appended to the package description."
(let ((same-arch? (lambda () (let ((same-arch? (lambda ()
(string=? (%current-system) (string=? (%current-system)
(gnu-triplet->nix-system triplet))))) (gnu-triplet->nix-system triplet)))))
@ -786,7 +794,12 @@ optional DEFCONFIG file and optional configuration changes from CONFIGS."
(inherit u-boot) (inherit u-boot)
(name (string-append "u-boot-" (name (string-append "u-boot-"
(string-replace-substring (string-downcase board) (string-replace-substring (string-downcase board)
"_" "-"))) "_" "-")
(or name-suffix "")))
(description (if append-description
(string-append (package-description u-boot)
"\n\n" append-description)
(package-description u-boot)))
(native-inputs (native-inputs
`(,@(if (not (same-arch?)) `(,@(if (not (same-arch?))
`(("cross-gcc" ,(cross-gcc triplet)) `(("cross-gcc" ,(cross-gcc triplet))
@ -877,21 +890,16 @@ optional DEFCONFIG file and optional configuration changes from CONFIGS."
(make-u-boot-package "malta" "mips64el-linux-gnuabi64")) (make-u-boot-package "malta" "mips64el-linux-gnuabi64"))
(define-public u-boot-am335x-boneblack (define-public u-boot-am335x-boneblack
(let ((base (make-u-boot-package (make-u-boot-package
"am335x_evm" "arm-linux-gnueabihf" "am335x_evm" "arm-linux-gnueabihf"
;; Patch out other device trees to build an image small enough ;; Patch out other device trees to build an image small enough to fit
;; to fit within typical partitioning schemes where the first ;; within typical partitioning schemes where the first partition begins at
;; partition begins at sector 2048. ;; sector 2048.
#:configs '("CONFIG_OF_LIST=\"am335x-evm am335x-boneblack\"")))) #:configs '("CONFIG_OF_LIST=\"am335x-evm am335x-boneblack\"")
(package #:name-suffix "-boneblack"
(inherit base) #:append-description "This U-Boot is built for the BeagleBone Black, which
(name "u-boot-am335x-boneblack") was removed upstream, adjusted from the am335x_evm build with several device
(description "U-Boot is a bootloader used mostly for ARM boards. It trees removed so that it fits within common partitioning schemes."))
also initializes the boards (RAM etc).
This U-Boot is built for the BeagleBone Black, which was removed upstream,
adjusted from the am335x_evm build with several device trees removed so that
it fits within common partitioning schemes."))))
(define-public u-boot-am335x-evm (define-public u-boot-am335x-evm
(make-u-boot-package "am335x_evm" "arm-linux-gnueabihf")) (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf"))
@ -944,7 +952,14 @@ it fits within common partitioning schemes."))))
(define-public u-boot-nintendo-nes-classic-edition (define-public u-boot-nintendo-nes-classic-edition
(let ((base (make-u-boot-package "Nintendo_NES_Classic_Edition" (let ((base (make-u-boot-package "Nintendo_NES_Classic_Edition"
"arm-linux-gnueabihf"))) "arm-linux-gnueabihf"
#:append-description "This version is for
the Nintendo NES Classic Edition. It is assumed that you have added a serial
port to pins PB0 and PB1 as described on
@url{https://linux-sunxi.org/Nintendo_NES_Classic_Edition}.
In order to use FEL mode on the device, hold the Reset button on the
device while it's being turned on (and a while longer).")))
(package (package
(inherit base) (inherit base)
;; Starting with 2019.01, FEL doesn't work anymore on A33. ;; Starting with 2019.01, FEL doesn't work anymore on A33.
@ -959,15 +974,6 @@ it fits within common partitioning schemes."))))
"0znkwljfwwn4y7j20pzz4ilqw8znphrfxns0x1lwdzh3xbr96z3k")) "0znkwljfwwn4y7j20pzz4ilqw8znphrfxns0x1lwdzh3xbr96z3k"))
(patches (search-patches (patches (search-patches
"u-boot-nintendo-nes-serial.patch")))) "u-boot-nintendo-nes-serial.patch"))))
(description "U-Boot is a bootloader used mostly for ARM boards. It
also initializes the boards (RAM etc).
This version is for the Nintendo NES Classic Edition. It is assumed that
you have added a serial port to pins PB0 and PB1 as described on
@url{https://linux-sunxi.org/Nintendo_NES_Classic_Edition}.
In order to use FEL mode on the device, hold the Reset button on the
device while it's being turned on (and a while longer).")
(native-inputs (native-inputs
`(("python" ,python-2) `(("python" ,python-2)
,@(package-native-inputs base)))))) ,@(package-native-inputs base))))))
@ -979,18 +985,14 @@ device while it's being turned on (and a while longer).")
(make-u-boot-package "mx6cuboxi" "arm-linux-gnueabihf")) (make-u-boot-package "mx6cuboxi" "arm-linux-gnueabihf"))
(define-public u-boot-novena (define-public u-boot-novena
(let ((base (make-u-boot-package (make-u-boot-package
"novena" "arm-linux-gnueabihf" "novena" "arm-linux-gnueabihf"
;; Patch configuration to disable loading u-boot.img from FAT ;; Patch configuration to disable loading u-boot.img from FAT partition,
;; partition, allowing it to be installed at a device offset. ;; allowing it to be installed at a device offset.
#:configs '("# CONFIG_SPL_FS_FAT is not set")))) #:configs '("# CONFIG_SPL_FS_FAT is not set")
(package #:append-description "This U-Boot is built for Novena. Be advised that this
(inherit base) version, contrary to Novena upstream, does not load u-boot.img from the first
(description "U-Boot is a bootloader used mostly for ARM boards. It partition."))
also initializes the boards (RAM etc).
This U-Boot is built for Novena. Be advised that this version, contrary
to Novena upstream, does not load u-boot.img from the first partition."))))
(define-public u-boot-cubieboard (define-public u-boot-cubieboard
(make-u-boot-package "Cubieboard" "arm-linux-gnueabihf")) (make-u-boot-package "Cubieboard" "arm-linux-gnueabihf"))
@ -1143,6 +1145,118 @@ BOOT_TARGET_NVME(func) \\
`(("firmware" ,arm-trusted-firmware-rk3399) `(("firmware" ,arm-trusted-firmware-rk3399)
,@(package-native-inputs base)))))) ,@(package-native-inputs base))))))
(define*-public (make-u-boot-bin-package u-boot-package
#:key
(u-boot-bin "u-boot.bin"))
"Return a package with a single U-BOOT-BIN file from the U-BOOT-PACKAGE.
The package name will be that of the U-BOOT package suffixed with \"-bin\"."
(package
(name (string-append (package-name u-boot-package) "-bin"))
(version (package-version u-boot-package))
(source #f)
(build-system trivial-build-system)
(arguments
(list
#:builder
(with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils))
(mkdir #$output)
(symlink (search-input-file %build-inputs
(string-append "libexec/" #$u-boot-bin))
(string-append #$output "/" #$u-boot-bin))))))
(inputs (list u-boot-package))
(home-page (package-home-page u-boot-package))
(synopsis (package-synopsis u-boot-package))
(description (string-append
(package-description u-boot-package)
"\n\n"
(format #f
"This package only contains the file ~a."
u-boot-bin)))
(license (package-license u-boot-package))))
(define-public %u-boot-rpi-efi-configs
'("CONFIG_OF_EMBED"
"CONFIG_OF_BOARD=y"))
(define %u-boot-rpi-description-32-bit
"This is a 32-bit build of U-Boot.")
(define %u-boot-rpi-description-64-bit
"This is a common 64-bit build of U-Boot for all 64-bit capable Raspberry Pi
variants.")
(define %u-boot-rpi-efi-description
"It allows network booting and uses the device-tree from the firmware,
allowing the usage of overlays. It can act as an EFI firmware for the
grub-efi-netboot-removable-bootloader.")
(define %u-boot-rpi-efi-description-32-bit
(string-append %u-boot-rpi-efi-description " "
%u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-2
(make-u-boot-package "rpi_2" "arm-linux-gnueabihf"
#:append-description %u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-3-32b
(make-u-boot-package "rpi_3_32b" "arm-linux-gnueabihf"
#:append-description %u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-4-32b
(make-u-boot-package "rpi_4_32b" "arm-linux-gnueabihf"
#:append-description %u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-arm64
(make-u-boot-package "rpi_arm64" "aarch64-linux-gnu"
#:append-description %u-boot-rpi-description-64-bit))
(define-public u-boot-rpi-2-efi
(make-u-boot-package "rpi_2" "arm-linux-gnueabihf"
#:name-suffix "-efi"
#:configs %u-boot-rpi-efi-configs
#:append-description %u-boot-rpi-efi-description-32-bit))
(define-public u-boot-rpi-3-32b-efi
(make-u-boot-package "rpi_3_32b" "arm-linux-gnueabihf"
#:name-suffix "-efi"
#:configs %u-boot-rpi-efi-configs
#:append-description %u-boot-rpi-efi-description-32-bit))
(define-public u-boot-rpi-4-32b-efi
(make-u-boot-package "rpi_4_32b" "arm-linux-gnueabihf"
#:name-suffix "-efi"
#:configs %u-boot-rpi-efi-configs
#:append-description %u-boot-rpi-efi-description-32-bit))
(define-public u-boot-rpi-arm64-efi
(make-u-boot-package "rpi_arm64""aarch64-linux-gnu"
#:name-suffix "-efi"
#:configs %u-boot-rpi-efi-configs
#:append-description (string-append
%u-boot-rpi-efi-description " "
%u-boot-rpi-description-64-bit)))
(define-public u-boot-rpi-2-bin (make-u-boot-bin-package u-boot-rpi-2))
(define-public u-boot-rpi-3_32b-bin (make-u-boot-bin-package u-boot-rpi-3-32b))
(define-public u-boot-rpi-4_32b-bin (make-u-boot-bin-package u-boot-rpi-4-32b))
(define-public u-boot-rpi-arm64-bin (make-u-boot-bin-package u-boot-rpi-arm64))
(define-public u-boot-rpi-2-efi-bin (make-u-boot-bin-package u-boot-rpi-2-efi))
(define-public u-boot-rpi-3-32b-efi-bin
(make-u-boot-bin-package u-boot-rpi-3-32b-efi))
(define-public u-boot-rpi-4-32b-efi-bin
(make-u-boot-bin-package u-boot-rpi-4-32b-efi))
(define-public u-boot-rpi-arm64-efi-bin
(make-u-boot-bin-package u-boot-rpi-arm64-efi))
(define-public vboot-utils (define-public vboot-utils
(package (package
(name "vboot-utils") (name "vboot-utils")