nongnu: Add u-boot-rk3566-quartz64.
* nongnu/packages/bootloaders.scm (u-boot-rk3566-quartz64): New variable.
This commit is contained in:
parent
f10132da8c
commit
9a69c019a4
141
nongnu/packages/bootloaders.scm
Normal file
141
nongnu/packages/bootloaders.scm
Normal file
|
@ -0,0 +1,141 @@
|
|||
;;; Copyright © 2022 Petr Hodina <phodina@protonmail.com>
|
||||
;;;
|
||||
;;; This program 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.
|
||||
;;;
|
||||
;;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (nongnu packages bootloaders)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (gnu bootloader)
|
||||
#:use-module (gnu bootloader extlinux)
|
||||
#:use-module (gnu packages)
|
||||
#:use-module (gnu packages bootloaders)
|
||||
#:use-module (gnu packages python)
|
||||
#:use-module (guix download)
|
||||
#:use-module (guix git-download)
|
||||
#:use-module (ice-9 ftw)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (nonguix build-system binary)
|
||||
#:use-module ((nonguix licenses)
|
||||
#:prefix license:)
|
||||
#:export (u-boot-quartz64a-rk3566-bootloader
|
||||
u-boot-pinenote-rk3566-bootloader))
|
||||
|
||||
(define %u-boot-quartz64-nvme-configs
|
||||
'("CONFIG_CMD_NVME=y"
|
||||
"CONFIG_NVME=y"
|
||||
"CONFIG_PCI=y"
|
||||
"CONFIG_PCI_PNP=y"
|
||||
"CONFIG_PCIE_ROCKCHIP=y"
|
||||
"CONFIG_PHY=y"
|
||||
"CONFIG_PHY_ROCKCHIP_PCIE=y"))
|
||||
|
||||
(define (u-boot-rk3566 board configs)
|
||||
(let ((commit "ca383958b387a768c1a64f8a952eeb5e534d0766")
|
||||
(revision "1")
|
||||
(base (make-u-boot-package board "aarch64-linux-gnu"
|
||||
#:configs configs)))
|
||||
(package
|
||||
(inherit base)
|
||||
(version "2022.07")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
;; Using rebased version which is compatible with Guix disable
|
||||
;; OpenSSL patch
|
||||
(url "https://gitlab.com/phodina/u-boot-quartz64")
|
||||
(commit commit)))
|
||||
(patches
|
||||
(search-patches "u-boot-allow-disabling-openssl.patch"))
|
||||
(sha256
|
||||
(base32
|
||||
"0nq83nflmsimbxq6i91dcv5gbx1j4xz2y6dfmyaw8r1yiz4266s8"))))
|
||||
(arguments
|
||||
(substitute-keyword-arguments (package-arguments base)
|
||||
((#:phases phases)
|
||||
#~(modify-phases #$phases
|
||||
(add-after 'unpack 'download-rockchip-firmware
|
||||
(lambda* _
|
||||
(let* ((ram-init-dl #$(origin
|
||||
(method url-fetch)
|
||||
(uri
|
||||
"https://github.com/JeffyCN/rockchip_mirrors/raw/47404a141a1acb7555906b5e3b097b5f1045cc21/bin/rk35/rk3568_ddr_1560MHz_v1.11.bin")
|
||||
(file-name "ram_init.bin")
|
||||
(sha256 (base32
|
||||
"02rj8spdbq250wcrkkscmjz4jmwba8yfmv90kkbd5wspmk9bq0cj"))))
|
||||
(bl31-dl #$(origin
|
||||
(method url-fetch)
|
||||
(uri
|
||||
"https://github.com/JeffyCN/rockchip_mirrors/raw/6186debcac95553f6b311cee10669e12c9c9963d/bin/rk35/rk3568_bl31_v1.28.elf")
|
||||
(file-name "rk3568_bl31_v1.28.elf")
|
||||
(sha256 (base32
|
||||
"0ji53ggmmf9qwrvs06ashydvaw8d9w4byzsvypqy4imndxb1kgv7"))))
|
||||
(bl31
|
||||
"rk3568_bl31_v1.28.elf")
|
||||
(ram-init
|
||||
"ram_init.bin"))
|
||||
(setenv "BL31" "rk3568_bl31_v1.28.elf")
|
||||
(for-each make-file-writable (find-files "."))
|
||||
(copy-file ram-init-dl ram-init)
|
||||
(copy-file bl31-dl bl31)))))))))))
|
||||
|
||||
(define-public u-boot-rk3566-evb
|
||||
(u-boot-rk3566 "evb-rk3566" '()))
|
||||
|
||||
(define-public u-boot-rk3566-pinenote
|
||||
(u-boot-rk3566 "pinenote-rk3566" '()))
|
||||
|
||||
(define-public u-boot-rk3566-quartz64a
|
||||
(u-boot-rk3566 "quartz64-a-rk3566" %u-boot-quartz64-nvme-configs))
|
||||
|
||||
(define-public u-boot-rk3566-quartz64b
|
||||
(u-boot-rk3566 "quartz64-b-rk3566" '()))
|
||||
|
||||
(define-public u-boot-rk3566-soquartz
|
||||
(u-boot-rk3566 "soquartz-rk3566" '()))
|
||||
|
||||
(define install-u-boot
|
||||
#~(lambda (bootloader root-index image)
|
||||
(if bootloader
|
||||
(error "Failed to install U-Boot"))))
|
||||
|
||||
(define install-rk3566-u-boot
|
||||
#~(lambda (bootloader root-index image)
|
||||
(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))
|
||||
image (* 64 512))
|
||||
(write-file-on-device u-boot (stat:size (stat u-boot))
|
||||
image (* 16384 512)))))
|
||||
|
||||
(define u-boot-bootloader
|
||||
(bootloader
|
||||
(inherit extlinux-bootloader)
|
||||
(name 'u-boot)
|
||||
(package #f)
|
||||
(installer #f)
|
||||
(disk-image-installer install-u-boot)))
|
||||
|
||||
(define u-boot-quartz64a-rk3566-bootloader
|
||||
;; SD and eMMC use the same format
|
||||
(bootloader
|
||||
(inherit u-boot-bootloader)
|
||||
(package u-boot-rk3566-quartz64a)
|
||||
(disk-image-installer install-rk3566-u-boot)))
|
||||
|
||||
(define u-boot-pinenote-rk3566-bootloader
|
||||
;; SD and eMMC use the same format
|
||||
(bootloader
|
||||
(inherit u-boot-bootloader)
|
||||
(package u-boot-rk3566-pinenote)
|
||||
(disk-image-installer install-rk3566-u-boot)))
|
Loading…
Reference in New Issue
Block a user