2017-06-11 06:58:38 -04:00
|
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
|
|
|
|
;;; Copyright © 2017 David Craven <david@craven.ch>
|
2019-12-14 11:37:23 -05:00
|
|
|
|
;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
|
2020-02-01 18:04:39 -05:00
|
|
|
|
;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
|
2020-04-20 21:21:07 -04:00
|
|
|
|
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2022-12-09 00:27:09 -05:00
|
|
|
|
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
2023-05-28 03:57:35 -04:00
|
|
|
|
;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
|
2017-06-11 06:58:38 -04:00
|
|
|
|
;;;
|
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
|
;;;
|
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
|
;;; your option) any later version.
|
|
|
|
|
;;;
|
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
|
;;;
|
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
(define-module (gnu bootloader u-boot)
|
|
|
|
|
#:use-module (gnu bootloader extlinux)
|
|
|
|
|
#:use-module (gnu bootloader)
|
|
|
|
|
#:use-module (gnu packages bootloaders)
|
|
|
|
|
#:use-module (guix gexp)
|
2017-12-12 10:41:56 -05:00
|
|
|
|
#:export (u-boot-bootloader
|
2018-01-22 16:35:06 -05:00
|
|
|
|
u-boot-a20-olinuxino-lime-bootloader
|
2018-01-20 14:46:00 -05:00
|
|
|
|
u-boot-a20-olinuxino-lime2-bootloader
|
2018-01-20 14:55:52 -05:00
|
|
|
|
u-boot-a20-olinuxino-micro-bootloader
|
2018-09-14 15:31:24 -04:00
|
|
|
|
u-boot-bananapi-m2-ultra-bootloader
|
2018-01-20 16:05:16 -05:00
|
|
|
|
u-boot-beaglebone-black-bootloader
|
2020-02-01 18:04:39 -05:00
|
|
|
|
u-boot-cubietruck-bootloader
|
2019-10-18 18:43:09 -04:00
|
|
|
|
u-boot-firefly-rk3399-bootloader
|
2018-05-07 10:32:02 -04:00
|
|
|
|
u-boot-mx6cuboxi-bootloader
|
2018-05-07 10:34:43 -04:00
|
|
|
|
u-boot-nintendo-nes-classic-edition-bootloader
|
2018-05-09 02:59:10 -04:00
|
|
|
|
u-boot-novena-bootloader
|
2018-05-17 18:16:09 -04:00
|
|
|
|
u-boot-pine64-plus-bootloader
|
2019-12-14 11:37:23 -05:00
|
|
|
|
u-boot-pine64-lts-bootloader
|
2018-11-20 19:32:16 -05:00
|
|
|
|
u-boot-pinebook-bootloader
|
2020-04-20 21:21:07 -04:00
|
|
|
|
u-boot-pinebook-pro-rk3399-bootloader
|
2018-05-29 00:10:15 -04:00
|
|
|
|
u-boot-puma-rk3399-bootloader
|
2019-10-18 16:14:08 -04:00
|
|
|
|
u-boot-rock64-rk3328-bootloader
|
2019-10-14 02:01:53 -04:00
|
|
|
|
u-boot-rockpro64-rk3399-bootloader
|
2023-05-28 03:57:35 -04:00
|
|
|
|
u-boot-sifive-unmatched-bootloader
|
2022-12-09 00:27:09 -05:00
|
|
|
|
u-boot-ts7970-q-2g-1000mhz-c-bootloader
|
2018-05-07 10:34:43 -04:00
|
|
|
|
u-boot-wandboard-bootloader))
|
2017-06-11 06:58:38 -04:00
|
|
|
|
|
|
|
|
|
(define install-u-boot
|
2020-10-05 04:58:55 -04:00
|
|
|
|
#~(lambda (bootloader root-index image)
|
2017-06-11 06:58:38 -04:00
|
|
|
|
(if bootloader
|
|
|
|
|
(error "Failed to install U-Boot"))))
|
|
|
|
|
|
2017-12-12 10:41:56 -05:00
|
|
|
|
(define install-beaglebone-black-u-boot
|
|
|
|
|
;; http://wiki.beyondlogic.org/index.php?title=BeagleBoneBlack_Upgrading_uBoot
|
|
|
|
|
;; This first stage bootloader called MLO (U-Boot SPL) is expected at
|
|
|
|
|
;; 0x20000 by BBB ROM code. The second stage bootloader will be loaded by
|
|
|
|
|
;; the MLO and is expected at 0x60000. Write both first stage ("MLO") and
|
|
|
|
|
;; second stage ("u-boot.img") images, read in BOOTLOADER directory, to the
|
|
|
|
|
;; specified DEVICE.
|
2020-10-05 04:58:55 -04:00
|
|
|
|
#~(lambda (bootloader root-index image)
|
2017-12-12 10:41:56 -05:00
|
|
|
|
(let ((mlo (string-append bootloader "/libexec/MLO"))
|
|
|
|
|
(u-boot (string-append bootloader "/libexec/u-boot.img")))
|
|
|
|
|
(write-file-on-device mlo (* 256 512)
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 256 512))
|
2017-12-12 10:41:56 -05:00
|
|
|
|
(write-file-on-device u-boot (* 1024 512)
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 768 512)))))
|
2017-12-12 10:41:56 -05:00
|
|
|
|
|
2018-01-18 18:25:13 -05:00
|
|
|
|
(define install-allwinner-u-boot
|
2020-10-05 04:58:55 -04:00
|
|
|
|
#~(lambda (bootloader root-index image)
|
2018-01-18 18:25:13 -05:00
|
|
|
|
(let ((u-boot (string-append bootloader
|
|
|
|
|
"/libexec/u-boot-sunxi-with-spl.bin")))
|
|
|
|
|
(write-file-on-device u-boot (stat:size (stat u-boot))
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 8 1024)))))
|
2018-01-18 18:25:13 -05:00
|
|
|
|
|
2018-05-17 18:16:09 -04:00
|
|
|
|
(define install-allwinner64-u-boot
|
2020-10-05 04:58:55 -04:00
|
|
|
|
#~(lambda (bootloader root-index image)
|
2021-05-30 00:17:41 -04:00
|
|
|
|
(let ((spl (string-append bootloader "/libexec/u-boot-sunxi-with-spl.bin"))
|
|
|
|
|
(u-boot (string-append bootloader "/libexec/u-boot-sunxi-with-spl.fit.itb")))
|
2018-05-17 18:16:09 -04:00
|
|
|
|
(write-file-on-device spl (stat:size (stat spl))
|
2021-05-30 00:17:41 -04:00
|
|
|
|
image (* 8 1024))
|
|
|
|
|
(write-file-on-device u-boot (stat:size (stat u-boot))
|
|
|
|
|
image (* 40 1024)))))
|
2018-05-17 18:16:09 -04:00
|
|
|
|
|
2018-05-07 10:32:02 -04:00
|
|
|
|
(define install-imx-u-boot
|
2020-10-05 04:58:55 -04:00
|
|
|
|
#~(lambda (bootloader root-index image)
|
2018-05-07 10:32:02 -04:00
|
|
|
|
(let ((spl (string-append bootloader "/libexec/SPL"))
|
|
|
|
|
(u-boot (string-append bootloader "/libexec/u-boot.img")))
|
|
|
|
|
(write-file-on-device spl (stat:size (stat spl))
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 1 1024))
|
2018-05-07 10:32:02 -04:00
|
|
|
|
(write-file-on-device u-boot (stat:size (stat u-boot))
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 69 1024)))))
|
2018-05-07 10:32:02 -04:00
|
|
|
|
|
2018-05-29 00:10:15 -04:00
|
|
|
|
(define install-puma-rk3399-u-boot
|
2020-10-05 04:58:55 -04:00
|
|
|
|
#~(lambda (bootloader root-index image)
|
2021-02-08 10:06:32 -05:00
|
|
|
|
(let ((spl (string-append bootloader "/libexec/idbloader.img"))
|
2018-05-29 00:10:15 -04:00
|
|
|
|
(u-boot (string-append bootloader "/libexec/u-boot.itb")))
|
|
|
|
|
(write-file-on-device spl (stat:size (stat spl))
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 64 512))
|
2018-05-29 00:10:15 -04:00
|
|
|
|
(write-file-on-device u-boot (stat:size (stat u-boot))
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 512 512)))))
|
2018-05-29 00:10:15 -04:00
|
|
|
|
|
2019-10-18 18:43:09 -04:00
|
|
|
|
(define install-firefly-rk3399-u-boot
|
2020-10-05 04:58:55 -04:00
|
|
|
|
#~(lambda (bootloader root-index image)
|
2019-10-18 18:43:09 -04:00
|
|
|
|
(let ((idb (string-append bootloader "/libexec/idbloader.img"))
|
|
|
|
|
(u-boot (string-append bootloader "/libexec/u-boot.itb")))
|
|
|
|
|
(write-file-on-device idb (stat:size (stat idb))
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 64 512))
|
2019-10-18 18:43:09 -04:00
|
|
|
|
(write-file-on-device u-boot (stat:size (stat u-boot))
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 16384 512)))))
|
2019-10-18 18:43:09 -04:00
|
|
|
|
|
2019-10-18 16:14:08 -04:00
|
|
|
|
(define install-rock64-rk3328-u-boot
|
2020-10-05 04:58:55 -04:00
|
|
|
|
#~(lambda (bootloader root-index image)
|
2019-10-18 16:14:08 -04:00
|
|
|
|
(let ((idb (string-append bootloader "/libexec/idbloader.img"))
|
|
|
|
|
(u-boot (string-append bootloader "/libexec/u-boot.itb")))
|
|
|
|
|
(write-file-on-device idb (stat:size (stat idb))
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 64 512))
|
2019-10-18 16:14:08 -04:00
|
|
|
|
(write-file-on-device u-boot (stat:size (stat u-boot))
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 16384 512)))))
|
2019-10-18 16:14:08 -04:00
|
|
|
|
|
2019-10-14 02:01:53 -04:00
|
|
|
|
(define install-rockpro64-rk3399-u-boot
|
2020-10-05 04:58:55 -04:00
|
|
|
|
#~(lambda (bootloader root-index image)
|
2019-10-14 02:01:53 -04:00
|
|
|
|
(let ((idb (string-append bootloader "/libexec/idbloader.img"))
|
|
|
|
|
(u-boot (string-append bootloader "/libexec/u-boot.itb")))
|
|
|
|
|
(write-file-on-device idb (stat:size (stat idb))
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 64 512))
|
2019-10-14 02:01:53 -04:00
|
|
|
|
(write-file-on-device u-boot (stat:size (stat u-boot))
|
2020-10-05 04:58:55 -04:00
|
|
|
|
image (* 16384 512)))))
|
2019-10-14 02:01:53 -04:00
|
|
|
|
|
2020-04-20 21:21:07 -04:00
|
|
|
|
(define install-pinebook-pro-rk3399-u-boot install-rockpro64-rk3399-u-boot)
|
|
|
|
|
|
2022-12-09 00:27:09 -05:00
|
|
|
|
(define install-u-boot-ts7970-q-2g-1000mhz-c-u-boot
|
|
|
|
|
#~(lambda (bootloader device mount-point)
|
|
|
|
|
(let ((u-boot.imx (string-append bootloader "/libexec/u-boot.imx"))
|
|
|
|
|
(install-dir (string-append mount-point "/boot")))
|
|
|
|
|
(install-file u-boot.imx install-dir))))
|
|
|
|
|
|
2023-05-28 03:57:35 -04:00
|
|
|
|
(define install-sifive-unmatched-u-boot
|
|
|
|
|
#~(lambda (bootloader root-index image)
|
|
|
|
|
(let ((spl (string-append bootloader "/libexec/spl/u-boot-spl.bin"))
|
|
|
|
|
(u-boot (string-append bootloader "/libexec/u-boot.itb")))
|
|
|
|
|
(write-file-on-device spl (stat:size (stat spl))
|
|
|
|
|
image (* 34 512))
|
|
|
|
|
(write-file-on-device u-boot (stat:size (stat u-boot))
|
|
|
|
|
image (* 2082 512)))))
|
|
|
|
|
|
2017-06-11 06:58:38 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Bootloader definitions.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define u-boot-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit extlinux-bootloader)
|
|
|
|
|
(name 'u-boot)
|
|
|
|
|
(package #f)
|
2020-10-05 04:58:55 -04:00
|
|
|
|
(installer #f)
|
|
|
|
|
(disk-image-installer install-u-boot)))
|
2017-12-12 10:41:56 -05:00
|
|
|
|
|
|
|
|
|
(define u-boot-beaglebone-black-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-bootloader)
|
2022-12-26 21:44:25 -05:00
|
|
|
|
(package u-boot-am335x-boneblack)
|
2020-10-05 04:58:55 -04:00
|
|
|
|
(disk-image-installer install-beaglebone-black-u-boot)))
|
2018-01-18 18:25:13 -05:00
|
|
|
|
|
|
|
|
|
(define u-boot-allwinner-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-bootloader)
|
2020-10-05 04:58:55 -04:00
|
|
|
|
(disk-image-installer install-allwinner-u-boot)))
|
2018-01-18 18:25:13 -05:00
|
|
|
|
|
2018-05-17 18:16:09 -04:00
|
|
|
|
(define u-boot-allwinner64-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-bootloader)
|
2020-10-05 04:58:55 -04:00
|
|
|
|
(disk-image-installer install-allwinner64-u-boot)))
|
2018-05-17 18:16:09 -04:00
|
|
|
|
|
2018-05-07 10:32:02 -04:00
|
|
|
|
(define u-boot-imx-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-bootloader)
|
2020-10-05 04:58:55 -04:00
|
|
|
|
(disk-image-installer install-imx-u-boot)))
|
2018-05-07 10:32:02 -04:00
|
|
|
|
|
2018-01-20 16:05:16 -05:00
|
|
|
|
(define u-boot-nintendo-nes-classic-edition-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-allwinner-bootloader)
|
|
|
|
|
(package u-boot-nintendo-nes-classic-edition)))
|
|
|
|
|
|
2018-01-22 16:35:06 -05:00
|
|
|
|
(define u-boot-a20-olinuxino-lime-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-allwinner-bootloader)
|
|
|
|
|
(package u-boot-a20-olinuxino-lime)))
|
|
|
|
|
|
2018-01-20 14:46:00 -05:00
|
|
|
|
(define u-boot-a20-olinuxino-lime2-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-allwinner-bootloader)
|
|
|
|
|
(package u-boot-a20-olinuxino-lime2)))
|
|
|
|
|
|
2018-01-20 14:55:52 -05:00
|
|
|
|
(define u-boot-a20-olinuxino-micro-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-allwinner-bootloader)
|
|
|
|
|
(package u-boot-a20-olinuxino-micro)))
|
|
|
|
|
|
2018-09-14 15:31:24 -04:00
|
|
|
|
(define u-boot-bananapi-m2-ultra-bootloader
|
2018-01-18 18:25:13 -05:00
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-allwinner-bootloader)
|
2018-09-14 15:31:24 -04:00
|
|
|
|
(package u-boot-bananapi-m2-ultra)))
|
2018-05-07 10:32:02 -04:00
|
|
|
|
|
2020-02-01 18:04:39 -05:00
|
|
|
|
(define u-boot-cubietruck-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-allwinner-bootloader)
|
|
|
|
|
(package u-boot-cubietruck)))
|
|
|
|
|
|
2019-10-18 18:43:09 -04:00
|
|
|
|
(define u-boot-firefly-rk3399-bootloader
|
|
|
|
|
;; SD and eMMC use the same format
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-bootloader)
|
|
|
|
|
(package u-boot-firefly-rk3399)
|
2020-10-05 04:58:55 -04:00
|
|
|
|
(disk-image-installer install-firefly-rk3399-u-boot)))
|
2019-10-18 18:43:09 -04:00
|
|
|
|
|
2018-05-07 10:32:02 -04:00
|
|
|
|
(define u-boot-mx6cuboxi-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-imx-bootloader)
|
|
|
|
|
(package u-boot-mx6cuboxi)))
|
2018-05-07 10:34:43 -04:00
|
|
|
|
|
|
|
|
|
(define u-boot-wandboard-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-imx-bootloader)
|
|
|
|
|
(package u-boot-wandboard)))
|
2018-05-09 02:59:10 -04:00
|
|
|
|
|
|
|
|
|
(define u-boot-novena-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-imx-bootloader)
|
|
|
|
|
(package u-boot-novena)))
|
2018-05-17 18:16:09 -04:00
|
|
|
|
|
|
|
|
|
(define u-boot-pine64-plus-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-allwinner64-bootloader)
|
|
|
|
|
(package u-boot-pine64-plus)))
|
2018-05-29 00:10:15 -04:00
|
|
|
|
|
2019-12-14 11:37:23 -05:00
|
|
|
|
(define u-boot-pine64-lts-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-allwinner-bootloader)
|
|
|
|
|
(package u-boot-pine64-lts)))
|
|
|
|
|
|
2018-11-20 19:32:16 -05:00
|
|
|
|
(define u-boot-pinebook-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-allwinner64-bootloader)
|
|
|
|
|
(package u-boot-pinebook)))
|
|
|
|
|
|
2018-05-29 00:10:15 -04:00
|
|
|
|
(define u-boot-puma-rk3399-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-bootloader)
|
|
|
|
|
(package u-boot-puma-rk3399)
|
2020-10-05 04:58:55 -04:00
|
|
|
|
(disk-image-installer install-puma-rk3399-u-boot)))
|
2019-10-14 02:01:53 -04:00
|
|
|
|
|
2019-10-18 16:14:08 -04:00
|
|
|
|
(define u-boot-rock64-rk3328-bootloader
|
|
|
|
|
;; SD and eMMC use the same format
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-bootloader)
|
|
|
|
|
(package u-boot-rock64-rk3328)
|
2020-10-05 04:58:55 -04:00
|
|
|
|
(disk-image-installer install-rock64-rk3328-u-boot)))
|
2019-10-18 16:14:08 -04:00
|
|
|
|
|
2019-10-14 02:01:53 -04:00
|
|
|
|
(define u-boot-rockpro64-rk3399-bootloader
|
|
|
|
|
;; SD and eMMC use the same format
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-bootloader)
|
|
|
|
|
(package u-boot-rockpro64-rk3399)
|
2020-10-05 04:58:55 -04:00
|
|
|
|
(disk-image-installer install-rockpro64-rk3399-u-boot)))
|
2020-04-20 21:21:07 -04:00
|
|
|
|
|
|
|
|
|
(define u-boot-pinebook-pro-rk3399-bootloader
|
|
|
|
|
;; SD and eMMC use the same format
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-bootloader)
|
|
|
|
|
(package u-boot-pinebook-pro-rk3399)
|
2020-10-05 04:58:55 -04:00
|
|
|
|
(disk-image-installer install-pinebook-pro-rk3399-u-boot)))
|
2022-12-09 00:27:09 -05:00
|
|
|
|
|
|
|
|
|
(define u-boot-ts7970-q-2g-1000mhz-c-bootloader
|
|
|
|
|
;; This bootloader doesn't really need to be installed, as it is read from
|
|
|
|
|
;; an SPI memory chip, not the SD card. It is copied to /boot/u-boot.imx
|
|
|
|
|
;; for convenience and should be manually flashed at the U-Boot prompt.
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-bootloader)
|
|
|
|
|
(package u-boot-ts7970-q-2g-1000mhz-c)
|
|
|
|
|
(installer install-u-boot-ts7970-q-2g-1000mhz-c-u-boot)
|
|
|
|
|
(disk-image-installer #f)))
|
2023-05-28 03:57:35 -04:00
|
|
|
|
|
|
|
|
|
(define u-boot-sifive-unmatched-bootloader
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit u-boot-bootloader)
|
|
|
|
|
(package u-boot-sifive-unmatched)
|
|
|
|
|
(disk-image-installer install-sifive-unmatched-u-boot)))
|