! nongnu: Add u-boot-rk3566-quartz64-downstream.

* nongnu/packages/bootloaders.scm (u-boot-rk3566-quartz64-downstream): New
variable.
This commit is contained in:
Petr Hodina 2022-08-27 16:36:41 +02:00
parent a566c120f0
commit 02e8212530

View File

@ -19,8 +19,13 @@
#:use-module (gnu bootloader)
#:use-module (gnu bootloader extlinux)
#:use-module (gnu packages)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages bootloaders)
#:use-module (gnu packages compression)
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages tls)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (ice-9 ftw)
@ -89,6 +94,89 @@
(copy-file ram-init-dl ram-init)
(copy-file bl31-dl bl31)))))))))))
(define-public u-boot-rk3566-quartz64-downstream
(let ((commit "7df3eae9f756665e01016a182d33ddf9dd244b1d")
(revision "1")
(base (make-u-boot-package "rk3566-quartz64" "aarch64-linux-gnu")))
(package
(inherit base)
(version "2017")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/JoshuaMulliken/u-boot-rockchip/archive/"
commit ".tar.gz"))
; (patches
; (parameterize
; ((%patch-path
; (map (lambda (directory)
; (string-append directory "/nongnu/packages/patches"))
; %load-path)))
; (search-patches ;"u-boot-dont-block-reads-above-32mb.patch"
; ;"u-boot-pyelftools.patch"
; "u-boot-pyelftools.patch")))
(sha256
(base32
"0dsi48ay06ciqcvlrbjwm90wvvs3wf65nbgjsc46wkkx9c6r1rj2"))))
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:phases phases)
#~(modify-phases #$phases
(add-after 'unpack 'download-rockchip-firmware
(lambda* _
(let* ((rkbin-dl #$(origin
(method url-fetch)
(uri
"https://github.com/JeffyCN/rockchip_mirrors/archive/refs/heads/rkbin.zip")
(file-name "rkbin.zip")
(sha256 (base32
"0wpli41046kppm873n5h410ljrvzjf219gzb7n0jc3qpghyl9cvw")))))
(invoke "unzip" "-q" rkbin-dl)
(rename-file "rockchip_mirrors-rkbin" "../rkbin")
; (patch-shebang "make.sh")
;(substitute* "scripts/fit.sh"
;(("./make.sh loader") "bash -x ./make.sh loader"))
;(substitute* "scripts/loader.sh"
;(("set -e") "set -e\nset -x"))
; (("boot_merger") "boot_merger --verbose"))
(substitute* "Makefile"
(("HOSTCC = cc") (string-append "HOSTCC = "
#$(cc-for-target))))
;(substitute* "make.sh"
;(("python") "python3")
;(("..SCRIPT_LOADER. --ini ..INI_LOADER.") "bash -x ${SCRIPT_LOADER} --ini
;${INI_LOADER}")
;(("..SCRIPT_FIT. ..ARG_LIST_FIT.") "bash -x ${SCRIPT_FIT} ${ARG_LIST_FIT}"))
;(("^make.*") "make HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- all\n"))
)))
(delete 'disable-tools-libcrypto)
(delete 'configure)
(replace 'build
(lambda* (#:key outputs inputs make-flags #:allow-other-keys)
; (setenv "PATH" (string-append (dirname (which "sed")) ":" (dirname
; (which "grep")) ":" (dirname (which "awk")) ":"
; ;#$(this-package-input "coreutils") "/bin" ":"
; #$coreutils "/bin" ":"
; (getenv "PATH")))
; (setenv "cc=" #$(cc-for-target))
; (setenv "CROSS_COMPILE" "aarch64-linux-gnu-")
(invoke "make" "clean")
(invoke "make" "mrproper")
(invoke "make" "V=1" ;(string-append "CC=" "gcc");#$(cc-for-target))
"rk3566-eink_defconfig")
(invoke "./make.sh")
(invoke "./make.sh" "trust")))
;(invoke "make" "HOSTCC=gcc" "CROSS_COMPILE=aarch64-linux-gnu-" "rk3566-quartz64_defconfig")))
(add-after 'build 'build-binaries
(lambda* (#:key outputs make-flags #:allow-other-keys)
;; Failing at
;; https://gitlab.com/pgwipeout/u-boot-rockchip/-/blob/quartz64/make.sh#L774
(invoke "bash" "-x" "./make.sh")
(invoke "./tools/resource_tool" "--pack" "arch/arm/dts/rk3566-quartz64.dtb")
))))))
(native-inputs `(("which" ,which) ("coreutils" ,coreutils) ("dtc" ,dtc)
("python-pyelftools" ,python-pyelftools) ("bash" ,bash-minimal) ("unzip" ,unzip) ,@(package-native-inputs base))))))
(define-public u-boot-rk3566-evb
(u-boot-rk3566 "evb-rk3566" '()))