Package: guix-patches;
Reported by: Vagrant Cascadian <vagrant <at> debian.org>
Date: Fri, 25 May 2018 22:31:02 UTC
Severity: normal
Tags: patch
Done: Danny Milosavljevic <dannym <at> scratchpost.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31599 in the body.
You can then email your comments to 31599 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
guix-patches <at> gnu.org
:bug#31599
; Package guix-patches
.
(Fri, 25 May 2018 22:31:02 GMT) Full text and rfc822 format available.Vagrant Cascadian <vagrant <at> debian.org>
:guix-patches <at> gnu.org
.
(Fri, 25 May 2018 22:31:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Vagrant Cascadian <vagrant <at> debian.org> To: guix-patches <at> gnu.org Subject: [PATCH] system: Add u-boot-puma-rk3399. Date: Fri, 25 May 2018 15:29:40 -0700
[Message part 1 (text/plain, inline)]
The attached patch enables u-boot for puma-rk3399. It enables a build of the vendor's arm-trusted-firmware/rk3399-cortex-m0, and the installation offsets to install the u-boot to microSD. Tested running on a puma-rk3399-haikou board running GuixSD! There is one glitch, which is that the fdtfile variable in u-boot (rockchip/rk3399-puma-ddr1600.dtb) does not match the device-tree present in linux-libre (rockchip/rk3399-puma-haikou.dtb), so the fdtfile u-boot variable needs to manually be set at boot to match linux-libre. This is likely to be fixed in future u-boot versions. Vagrant Cascadian (1): system: Add u-boot-puma-rk3399. gnu/bootloader/u-boot.scm | 16 +++++++++++ gnu/packages/bootloaders.scm | 36 ++++++++++++++++++++++++- gnu/packages/firmware.scm | 64 ++++++++++++++++++++++++++++++++++++++++++++ gnu/system/install.scm | 6 +++++ 4 files changed, 121 insertions(+), 1 deletion(-) -- 2.11.0
[0001-system-Add-u-boot-puma-rk3399.patch (text/x-diff, inline)]
From 1e070fe4c33c774992cb712bd78745b91ccef307 Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian <vagrant <at> debian.org> Date: Fri, 25 May 2018 13:04:17 -0700 Subject: [PATCH 1/1] system: Add u-boot-puma-rk3399. * gnu/packages/bootloaders.scm (u-boot-puma-rk3399): New variable. (make-u-boot-package)[arguments]: Add '.rksd' files to the files installed during custom 'install phase. * gnu/bootloader/u-boot.scm (u-boot-puma-rk3399-bootloader): New exported variable. * gnu/system/install.scm (rk3399-puma-installation-os): New exported variable. * gnu/packages/firmware.scm (arm-trusted-firmware-puma-rk3399): New variable. (rk3399-cortex-m0): New variable. --- gnu/bootloader/u-boot.scm | 16 +++++++++++ gnu/packages/bootloaders.scm | 36 ++++++++++++++++++++++++- gnu/packages/firmware.scm | 64 ++++++++++++++++++++++++++++++++++++++++++++ gnu/system/install.scm | 6 +++++ 4 files changed, 121 insertions(+), 1 deletion(-) diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm index ea0f67b3c..52b38dd1a 100644 --- a/gnu/bootloader/u-boot.scm +++ b/gnu/bootloader/u-boot.scm @@ -37,6 +37,7 @@ u-boot-nintendo-nes-classic-edition-bootloader u-boot-novena-bootloader u-boot-pine64-plus-bootloader + u-boot-puma-rk3399-bootloader u-boot-wandboard-bootloader)) (define install-u-boot @@ -84,6 +85,15 @@ (write-file-on-device u-boot (stat:size (stat u-boot)) device (* 69 1024))))) +(define install-puma-rk3399-u-boot + #~(lambda (bootloader device mount-point) + (let ((spl (string-append bootloader "/libexec/u-boot-spl.rksd")) + (u-boot (string-append bootloader "/libexec/u-boot.itb"))) + (write-file-on-device spl (stat:size (stat spl)) + device (* 64 512)) + (write-file-on-device u-boot (stat:size (stat u-boot)) + device (* 512 512))))) + ;;; @@ -162,3 +172,9 @@ (bootloader (inherit u-boot-allwinner64-bootloader) (package u-boot-pine64-plus))) + +(define u-boot-puma-rk3399-bootloader + (bootloader + (inherit u-boot-bootloader) + (package u-boot-puma-rk3399) + (installer install-puma-rk3399-u-boot))) diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 333f30e72..3c76b8b3d 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -450,7 +450,7 @@ board-independent tools."))) (let* ((out (assoc-ref outputs "out")) (libexec (string-append out "/libexec")) (uboot-files (append - (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb)$") + (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$") (find-files "." "^(MLO|SPL)$")))) (mkdir-p libexec) (install-file ".config" libexec) @@ -521,6 +521,40 @@ board-independent tools."))) (define-public u-boot-cubieboard (make-u-boot-package "Cubieboard" "arm-linux-gnueabihf")) +(define-public u-boot-puma-rk3399 + (let ((base (make-u-boot-package "puma-rk3399" "aarch64-linux-gnu"))) + (package + (inherit base) + (arguments + (substitute-keyword-arguments (package-arguments base) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'unpack 'set-environment + (lambda* (#:key inputs #:allow-other-keys) + ;; Need to copy the firmware into u-boot build + ;; directory. + (copy-file (string-append (assoc-ref inputs "firmware") + "/bl31.bin") "bl31-rk3399.bin") + (copy-file (string-append (assoc-ref inputs "firmware-m0") + "/rk3399m0.bin") "rk3399m0.bin"))) + (add-after 'build 'builditb + (lambda* (#:key make-flags #:allow-other-keys) + ;; The u-boot.itb is not built by default + (zero? (apply system* "make" `(,@make-flags ,"u-boot.itb"))))) + (add-after 'builditb 'buildrksd + (lambda* (#:key inputs #:allow-other-keys) + ;; Build rockchip SD card images. + (zero? (apply system* + (string-append + (assoc-ref inputs "u-boot-tools") "/bin/mkimage") + `(,"-T" ,"rksd" ,"-n" ,"rk3399" ,"-d" +,"spl/u-boot-spl.bin" ,"u-boot-spl.rksd"))))))))) + (native-inputs + `(("firmware" ,arm-trusted-firmware-puma-rk3399) + ("firmware-m0" ,rk3399-cortex-m0) + ("u-boot-tools" ,u-boot-tools) + ,@(package-native-inputs base)))))) + (define-public vboot-utils (package (name "vboot-utils") diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index 9e91ceca4..7bc12de38 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -404,3 +404,67 @@ such as: (sha256 (base32 "0r4xnlq7v9khjfcg6gqp7nmrmnw4z1r8bipwdr07png1dcbb8214"))))))) + +(define-public arm-trusted-firmware-puma-rk3399 + (let ((base (make-arm-trusted-firmware "rk3399")) + ;; Vendor's arm trusted firmware branch hasn't been upstreamed yet. + (commit "d71e6d83612df896774ec4c03d49500312d2c324") + (revision "1")) + (package + (inherit base) + (name "arm-trusted-firmware-puma-rk3399") + (version (string-append "1.3-" revision "." (string-take commit 7))) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://git.theobroma-systems.com/arm-trusted-firmware.git") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0vqhwqqh8h9qlkpybg2v94911091c1418bc4pnzq5fd7zf0fjkf8"))))))) + +(define-public rk3399-cortex-m0 + (package + (name "rk3399-cortex-m0") + (version "1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://git.theobroma-systems.com/rk3399-cortex-m0.git") + (commit (string-append "v" version)))) + (file-name (git-file-name "rk3399-cortex-m0" version)) + (sha256 + (base32 + "02wz1vkf4j3zc8rx289z76xhrf71jhb2p05lvmygky393a9gjh9w")))) + (home-page "https://git.theobroma-systems.com/rk3399-cortex-m0.git/about/") + (synopsis "PMU Cortex M0 firmware for RK3399 Q7 (Puma)") + (description + "Cortex-M0 firmware used with the RK3399 to implement +power-management functionality and helpers (e.g. DRAM frequency +switching support).\n") + (license license:bsd-3) + (build-system gnu-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (delete 'configure) + (delete 'check) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (mzerofiles (find-files "." "rk3399m0.(elf|bin)$"))) + (for-each + (lambda (file) + (install-file file out)) + mzerofiles)) + #t)) + (add-before 'build 'setenv + (lambda* (#:key inputs #:allow-other-keys) + (setenv "CROSS_COMPILE" "arm-none-eabi-") + #t))))) + (native-inputs `( + ("cross-gcc" ,(cross-gcc "arm-none-eabi" #:xgcc gcc-7)) + ("cross-binutils" ,(cross-binutils "arm-none-eabi")))))) diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 3efff915a..51f9e55ed 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -53,6 +53,7 @@ nintendo-nes-classic-edition-installation-os novena-installation-os pine64-plus-installation-os + rk3399-puma-installation-os wandboard-installation-os)) ;;; Commentary: @@ -453,6 +454,11 @@ The bootloader BOOTLOADER is installed to BOOTLOADER-TARGET." "/dev/mmcblk0" ; SD card storage "ttyS0")) +(define rk3399-puma-installation-os + (embedded-installation-os u-boot-puma-rk3399-bootloader + "/dev/mmcblk0" ; SD card storage + "ttyS0")) + (define wandboard-installation-os (embedded-installation-os u-boot-wandboard-bootloader "/dev/mmcblk0" ; SD card storage -- 2.11.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#31599
; Package guix-patches
.
(Sat, 26 May 2018 07:21:02 GMT) Full text and rfc822 format available.Message #8 received at 31599 <at> debbugs.gnu.org (full text, mbox):
From: Danny Milosavljevic <dannym <at> scratchpost.org> To: Vagrant Cascadian <vagrant <at> debian.org> Cc: 31599 <at> debbugs.gnu.org Subject: Re: [bug#31599] [PATCH] system: Add u-boot-puma-rk3399. Date: Sat, 26 May 2018 09:19:53 +0200
[Message part 1 (text/plain, inline)]
Hi, On Fri, 25 May 2018 15:29:40 -0700 Vagrant Cascadian <vagrant <at> debian.org> wrote: > Tested running on a puma-rk3399-haikou board running GuixSD! Cool! > [fdtfile u-boot variable needs to manually be set at boot] >This is likely to be fixed in future u-boot versions. Does upstream know about it? >+ ;; The u-boot.itb is not built by default ??? How can that be? Isn't it required for booting? I checked the source code - apparently they use mkimage to build the itb from the its. So now we are using two "different" mkimage tools. OK I guess - but weird. All they'd have to do is add ALL-y += u-boot.itb to the Makefile. Does upstream know about it? >+ (zero? (apply system* "make" `(,@make-flags ,"u-boot.itb"))))) Please use "invoke". It's shorthand for (zero? (system* ...)) but it also raises an exception on error. That's easier to maintain (when people add a second invocation they don't have to add "(and ...)"). So here it would be (apply invoke "make" `(,@make-flags ,"u-boot.itb")))) . >(add-after 'unpack 'set-environment >+ (lambda* (#:key inputs #:allow-other-keys) >+ ;; Need to copy the firmware into u-boot build >+ ;; directory. >+ (copy-file (string-append (assoc-ref inputs "firmware") >+ "/bl31.bin") "bl31-rk3399.bin") >+ (copy-file (string-append (assoc-ref inputs "firmware-m0") >+ "/rk3399m0.bin") "rk3399m0.bin"))) Please end this phase with "#t". >+ (version (string-append "1.3-" revision "." (string-take commit 7))) Please use (git-version "1.3" revision commit) instead of (string-append "1.3-" revision "." (string-take commit 7)) > [...] Sometimes the indentation you used is slightly off, like this: `((foo) (bar)) It should be `((foo) (bar))
[Message part 2 (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#31599
; Package guix-patches
.
(Sat, 26 May 2018 16:47:01 GMT) Full text and rfc822 format available.Message #11 received at 31599 <at> debbugs.gnu.org (full text, mbox):
From: Vagrant Cascadian <vagrant <at> debian.org> To: Danny Milosavljevic <dannym <at> scratchpost.org> Cc: 31599 <at> debbugs.gnu.org Subject: Re: [bug#31599] [PATCH] system: Add u-boot-puma-rk3399. Date: Sat, 26 May 2018 09:46:04 -0700
[Message part 1 (text/plain, inline)]
On 2018-05-26, Danny Milosavljevic wrote: > On Fri, 25 May 2018 15:29:40 -0700 > Vagrant Cascadian <vagrant <at> debian.org> wrote: >> [fdtfile u-boot variable needs to manually be set at boot] >>This is likely to be fixed in future u-boot versions. > > Does upstream know about it? A couple hours after I submitted this a patch was submitted upstream that fixes the issue: https://patchwork.ozlabs.org/patch/920785/ >>+ ;; The u-boot.itb is not built by default > > ??? How can that be? Isn't it required for booting? There may be other implementations of boot firmware that consume the various parts of u-boot and don't use u-boot.itb. The Debian u-boot package, for example, does not yet have arm-trusted-frimware or the cortex-m0 firmware available, so it needs to build without it and let the user build the other components and manually construct the u-boot.itb. > I checked the source code - apparently they use mkimage > to build the itb from the its. So now we are using two > "different" mkimage tools. OK I guess - but weird. An earlier patch I did added the tools directory to PATH and used the in-tree mkimage, but I opted for using the mkimage from u-boot-tools when I submitted. Wasn't sure which was better. > All they'd have to do is add > > ALL-y += u-boot.itb > > to the Makefile. Does upstream know about it? I'll bring the issue upstream; it may need to be added conditionally, as not all u-boot targets support generating a u-boot.itb. >>+ (zero? (apply system* "make" `(,@make-flags ,"u-boot.itb"))))) > > Please use "invoke". It's shorthand for (zero? (system* ...)) but it also > raises an exception on error. > That's easier to maintain (when people add a second invocation they > don't have to add "(and ...)"). > > So here it would be (apply invoke "make" `(,@make-flags ,"u-boot.itb")))) . Ok. >>(add-after 'unpack 'set-environment >>+ (lambda* (#:key inputs #:allow-other-keys) >>+ ;; Need to copy the firmware into u-boot build >>+ ;; directory. >>+ (copy-file (string-append (assoc-ref inputs "firmware") >>+ "/bl31.bin") "bl31-rk3399.bin") >>+ (copy-file (string-append (assoc-ref inputs "firmware-m0") >>+ "/rk3399m0.bin") "rk3399m0.bin"))) > > Please end this phase with "#t". Please forgive my ignorance, but I'm not sure where it belongs or even why... just a rank beginner with this. :) >>+ (version (string-append "1.3-" revision "." (string-take commit 7))) > > Please use (git-version "1.3" revision commit) instead of > > (string-append "1.3-" revision "." (string-take commit 7)) Will do. > Sometimes the indentation you used is slightly off, like this: > > `((foo) > (bar)) > > It should be > > `((foo) > (bar)) Will try to sort those out... Thanks for the review! live well, vagrant
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#31599
; Package guix-patches
.
(Sat, 26 May 2018 17:13:02 GMT) Full text and rfc822 format available.Message #14 received at 31599 <at> debbugs.gnu.org (full text, mbox):
From: Danny Milosavljevic <dannym <at> scratchpost.org> To: Vagrant Cascadian <vagrant <at> debian.org> Cc: 31599 <at> debbugs.gnu.org Subject: Re: [bug#31599] [PATCH] system: Add u-boot-puma-rk3399. Date: Sat, 26 May 2018 19:12:02 +0200
[Message part 1 (text/plain, inline)]
> A couple hours after I submitted this a patch was submitted upstream > that fixes the issue: > > https://patchwork.ozlabs.org/patch/920785/ Good. > >>+ ;; The u-boot.itb is not built by default > > > > ??? How can that be? Isn't it required for booting? > > There may be other implementations of boot firmware that consume the > various parts of u-boot and don't use u-boot.itb. > > The Debian u-boot package, for example, does not yet have > arm-trusted-frimware or the cortex-m0 firmware available, so it needs to > build without it and let the user build the other components and > manually construct the u-boot.itb. I see. OK, I'm fine with building u-boot.itb manually for now. I just asked because when we aren't careful we get into whack-a-mole quickly. (There's a huge amount of ARM boards and we shouldn't do the u-boot maintainer's job for them. It's more work *and* eventually we'd diverge from each other) > An earlier patch I did added the tools directory to PATH and used the > in-tree mkimage, but I opted for using the mkimage from u-boot-tools > when I submitted. Wasn't sure which was better. Right now, they are the same because u-boot-tools derives from u-boot in Guix. That said, for the sake of modularization I'd use the package-local mkimage if there is one. One reason is that there are weird u-boot forks for some boards (mainline u-boot doesn't work for them). These might have local quirks in mkimage and it's better to track these quirks when building that u-boot. (As long as we know the above in the back of our heads as a potential source of problems it doesn't matter much which mkimage we use in practice) u-boot-tools is meant for the end user. I didn't intend it to be used by the u-boots themselves (not that it's bad--but it's redundant right now). > >>(add-after 'unpack 'set-environment > >>+ (lambda* (#:key inputs #:allow-other-keys) > >>+ ;; Need to copy the firmware into u-boot build > >>+ ;; directory. > >>+ (copy-file (string-append (assoc-ref inputs "firmware") > >>+ "/bl31.bin") "bl31-rk3399.bin") > >>+ (copy-file (string-append (assoc-ref inputs "firmware-m0") > >>+ "/rk3399m0.bin") "rk3399m0.bin"))) > > > > Please end this phase with "#t". > Please forgive my ignorance, but I'm not sure where it belongs or even > why... just a rank beginner with this. :) Earlier guile didn't support exceptions--so phases have to return a boolean (whether the phase succeeded or not). In a lambda, the return value is the value of the last expression. There's an effort in core-updates to get it all up-to-speed so that these all actually return a boolean--and long term we'd get rid of this requirement. Some procedures are written especially for phases ("invoke" is, for example) and do what you'd expect (return #t if OK, otherwise raise exception). Other procedures you have to be careful what they actually return. In this case, copy-file's documentation[1] states "The return value is unspecified" (that implies that error handling is via exceptions). The unspecified return value is clearly not good. [1] https://www.gnu.org/software/guile/manual/html_node/File-System.html
[Message part 2 (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#31599
; Package guix-patches
.
(Tue, 29 May 2018 04:11:01 GMT) Full text and rfc822 format available.Message #17 received at 31599 <at> debbugs.gnu.org (full text, mbox):
From: Vagrant Cascadian <vagrant <at> debian.org> To: Danny Milosavljevic <dannym <at> scratchpost.org> Cc: 31599 <at> debbugs.gnu.org Subject: Re: [bug#31599] [PATCH v2] system: Add u-boot-puma-rk3399. Date: Mon, 28 May 2018 21:10:15 -0700
[Message part 1 (text/plain, inline)]
Thanks for the review! I think the attached patch addresses the issues raised: * Fix several indentation and numerous whitespace issues. * u-boot-puma-rk3399: Drop use of u-boot-tools as an input, calling ./tools/mkimage directly. * arm-trusted-firmware-puma-rk3399: Use git-version to set version. * u-boot-puma-rk3399: Complete block using #t * u-boot-puma-rk3399: Use "apply invoke" to make system calls. live well, vagrant
[0001-system-Add-u-boot-puma-rk3399.patch (text/x-diff, inline)]
From 23bcb1e653f771aae3781ce665728283c3076b76 Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian <vagrant <at> debian.org> Date: Mon, 28 May 2018 18:28:13 -0700 Subject: [PATCH 1/1] system: Add u-boot-puma-rk3399. * gnu/packages/bootloaders.scm (u-boot-puma-rk3399): New variable. (make-u-boot-package)[arguments]: Add '.rksd' files to the files installed during custom 'install phase. * gnu/bootloader/u-boot.scm (u-boot-puma-rk3399-bootloader): New exported variable. * gnu/system/install.scm (rk3399-puma-installation-os): New exported variable. * gnu/packages/firmware.scm (arm-trusted-firmware-puma-rk3399): New variable. (rk3399-cortex-m0): New variable. --- gnu/bootloader/u-boot.scm | 16 +++++++++++ gnu/packages/bootloaders.scm | 33 ++++++++++++++++++++++- gnu/packages/firmware.scm | 63 ++++++++++++++++++++++++++++++++++++++++++++ gnu/system/install.scm | 6 +++++ 4 files changed, 117 insertions(+), 1 deletion(-) diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm index ea0f67b3c..52b38dd1a 100644 --- a/gnu/bootloader/u-boot.scm +++ b/gnu/bootloader/u-boot.scm @@ -37,6 +37,7 @@ u-boot-nintendo-nes-classic-edition-bootloader u-boot-novena-bootloader u-boot-pine64-plus-bootloader + u-boot-puma-rk3399-bootloader u-boot-wandboard-bootloader)) (define install-u-boot @@ -84,6 +85,15 @@ (write-file-on-device u-boot (stat:size (stat u-boot)) device (* 69 1024))))) +(define install-puma-rk3399-u-boot + #~(lambda (bootloader device mount-point) + (let ((spl (string-append bootloader "/libexec/u-boot-spl.rksd")) + (u-boot (string-append bootloader "/libexec/u-boot.itb"))) + (write-file-on-device spl (stat:size (stat spl)) + device (* 64 512)) + (write-file-on-device u-boot (stat:size (stat u-boot)) + device (* 512 512))))) + ;;; @@ -162,3 +172,9 @@ (bootloader (inherit u-boot-allwinner64-bootloader) (package u-boot-pine64-plus))) + +(define u-boot-puma-rk3399-bootloader + (bootloader + (inherit u-boot-bootloader) + (package u-boot-puma-rk3399) + (installer install-puma-rk3399-u-boot))) diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 2dd530125..6ff26d0dc 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -489,7 +489,7 @@ board-independent tools."))) (let* ((out (assoc-ref outputs "out")) (libexec (string-append out "/libexec")) (uboot-files (append - (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb)$") + (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$") (find-files "." "^(MLO|SPL)$")))) (mkdir-p libexec) (install-file ".config" libexec) @@ -560,6 +560,37 @@ board-independent tools."))) (define-public u-boot-cubieboard (make-u-boot-package "Cubieboard" "arm-linux-gnueabihf")) +(define-public u-boot-puma-rk3399 + (let ((base (make-u-boot-package "puma-rk3399" "aarch64-linux-gnu"))) + (package + (inherit base) + (arguments + (substitute-keyword-arguments (package-arguments base) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'unpack 'set-environment + (lambda* (#:key inputs #:allow-other-keys) + ;; Need to copy the firmware into u-boot build + ;; directory. + (copy-file (string-append (assoc-ref inputs "firmware") + "/bl31.bin") "bl31-rk3399.bin") + (copy-file (string-append (assoc-ref inputs "firmware-m0") + "/rk3399m0.bin") "rk3399m0.bin") + #t)) + (add-after 'build 'builditb + (lambda* (#:key make-flags #:allow-other-keys) + ;; The u-boot.itb is not built by default + (apply invoke "make" `(,@make-flags ,"u-boot.itb")))) + (add-after 'builditb 'buildrksd + (lambda* (#:key inputs #:allow-other-keys) + ;; Build rockchip SD card images. + (apply invoke "./tools/mkimage" + `(,"-T" ,"rksd" ,"-n" ,"rk3399" ,"-d" ,"spl/u-boot-spl.bin" ,"u-boot-spl.rksd")))))))) + (native-inputs + `(("firmware" ,arm-trusted-firmware-puma-rk3399) + ("firmware-m0" ,rk3399-cortex-m0) + ,@(package-native-inputs base)))))) + (define-public vboot-utils (package (name "vboot-utils") diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index 9e91ceca4..986e1d621 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -404,3 +404,66 @@ such as: (sha256 (base32 "0r4xnlq7v9khjfcg6gqp7nmrmnw4z1r8bipwdr07png1dcbb8214"))))))) + +(define-public arm-trusted-firmware-puma-rk3399 + (let ((base (make-arm-trusted-firmware "rk3399")) + ;; Vendor's arm trusted firmware branch hasn't been upstreamed yet. + (commit "d71e6d83612df896774ec4c03d49500312d2c324") + (revision "1")) + (package + (inherit base) + (name "arm-trusted-firmware-puma-rk3399") + (version (git-version "1.3" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://git.theobroma-systems.com/arm-trusted-firmware.git") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0vqhwqqh8h9qlkpybg2v94911091c1418bc4pnzq5fd7zf0fjkf8"))))))) + +(define-public rk3399-cortex-m0 + (package + (name "rk3399-cortex-m0") + (version "1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://git.theobroma-systems.com/rk3399-cortex-m0.git") + (commit (string-append "v" version)))) + (file-name (git-file-name "rk3399-cortex-m0" version)) + (sha256 + (base32 + "02wz1vkf4j3zc8rx289z76xhrf71jhb2p05lvmygky393a9gjh9w")))) + (home-page "https://git.theobroma-systems.com/rk3399-cortex-m0.git/about/") + (synopsis "PMU Cortex M0 firmware for RK3399 Q7 (Puma)") + (description + "Cortex-M0 firmware used with the RK3399 to implement +power-management functionality and helpers (e.g. DRAM frequency +switching support).\n") + (license license:bsd-3) + (build-system gnu-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (delete 'configure) + (delete 'check) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (mzerofiles (find-files "." "rk3399m0.(elf|bin)$"))) + (for-each + (lambda (file) + (install-file file out)) + mzerofiles)) + #t)) + (add-before 'build 'setenv + (lambda* (#:key inputs #:allow-other-keys) + (setenv "CROSS_COMPILE" "arm-none-eabi-") + #t))))) + (native-inputs `(("cross-gcc" ,(cross-gcc "arm-none-eabi" #:xgcc gcc-7)) + ("cross-binutils" ,(cross-binutils "arm-none-eabi")))))) diff --git a/gnu/system/install.scm b/gnu/system/install.scm index acc9f15e0..35f4ba9c2 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -53,6 +53,7 @@ nintendo-nes-classic-edition-installation-os novena-installation-os pine64-plus-installation-os + rk3399-puma-installation-os wandboard-installation-os)) ;;; Commentary: @@ -451,6 +452,11 @@ The bootloader BOOTLOADER is installed to BOOTLOADER-TARGET." "/dev/mmcblk0" ; SD card storage "ttyS0")) +(define rk3399-puma-installation-os + (embedded-installation-os u-boot-puma-rk3399-bootloader + "/dev/mmcblk0" ; SD card storage + "ttyS0")) + (define wandboard-installation-os (embedded-installation-os u-boot-wandboard-bootloader "/dev/mmcblk0" ; SD card storage -- 2.11.0
[signature.asc (application/pgp-signature, inline)]
Danny Milosavljevic <dannym <at> scratchpost.org>
:Vagrant Cascadian <vagrant <at> debian.org>
:Message #22 received at 31599-done <at> debbugs.gnu.org (full text, mbox):
From: Danny Milosavljevic <dannym <at> scratchpost.org> To: Vagrant Cascadian <vagrant <at> debian.org> Cc: 31599-done <at> debbugs.gnu.org Subject: Re: [bug#31599] [PATCH v2] system: Add u-boot-puma-rk3399. Date: Tue, 29 May 2018 10:51:40 +0200
[Message part 1 (text/plain, inline)]
On Mon, 28 May 2018 21:10:15 -0700 Vagrant Cascadian <vagrant <at> debian.org> wrote: > + (apply invoke "./tools/mkimage" > + `(,"-T" ,"rksd" ,"-n" ,"rk3399" ,"-d" ,"spl/u-boot-spl.bin" ,"u-boot-spl.rksd") Heh, this is neutral. So (invoke "./tools/mkimage" "-T" "rksd" "-n" "rk3399" "-d" "spl/u-boot-spl.bin" "u-boot-spl.rksd") works fine. So I've changed it to that. I've pushed it to guix master. Let's see what our aarch64 machines say about the cross-compilation (probably doesn't work yet - but meh).
[Message part 2 (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#31599
; Package guix-patches
.
(Sun, 17 Jun 2018 12:17:01 GMT) Full text and rfc822 format available.Message #25 received at 31599-done <at> debbugs.gnu.org (full text, mbox):
From: Danny Milosavljevic <dannym <at> scratchpost.org> To: Vagrant Cascadian <vagrant <at> debian.org> Cc: 31599-done <at> debbugs.gnu.org Subject: Re: [bug#31599] [PATCH v2] system: Add u-boot-puma-rk3399. Date: Sun, 17 Jun 2018 14:15:39 +0200
[Message part 1 (text/plain, inline)]
Hi Vagrant, could you send a patch adding puma-rk3399 to buildroot? I'm thinking of using buildroot for the u-boot installation in GuixSD instead of our DIY installers (in the long term). Puma-rk3399 is one of the few u-boots that isn't in buildroot yet. I've attached an example patch adding Bananapi M2 Ultra. In order to build this example: $ git clone git://git.buildroot.net/buildroot $ cd buildroot $ patch -p1 < .../0001-Added-support-for-Sinovoip-BananaPi-M2-Ultra-board.patch $ make bananapi_m2_ultra_defconfig $ make # takes extremely long and takes lots of space I'm planning to copy genimage.cfg from buildroot - not everything. That would enable us to have a generic install-u-boot. Buildroot: https://buildroot.org/ Git web: https://git.busybox.net/buildroot/ Git: git clone git://git.buildroot.net/buildroot Git: git clone https://git.buildroot.net/buildroot Patches: http://lists.buildroot.org/mailman/listinfo/buildroot
[0001-Added-support-for-Sinovoip-BananaPi-M2-Ultra-board.patch (text/x-patch, attachment)]
[Message part 3 (application/pgp-signature, inline)]
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Mon, 16 Jul 2018 11:24:12 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.