diff options
| author | Vagrant Cascadian <vagrant@debian.org> | 2018-05-28 21:10:15 -0700 |
|---|---|---|
| committer | Danny Milosavljevic <dannym@scratchpost.org> | 2018-05-29 10:46:13 +0200 |
| commit | 6fe165770539a4551b303dc5cd52db6c51c7604a (patch) | |
| tree | ae271a8af36d02daabaae9935151decbcc88e2c3 /gnu | |
| parent | 2a49aee4d120cd3a8bfd855578f0b8832db88227 (diff) | |
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.
Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/bootloader/u-boot.scm | 16 | ||||
| -rw-r--r-- | gnu/packages/bootloaders.scm | 33 | ||||
| -rw-r--r-- | gnu/packages/firmware.scm | 63 | ||||
| -rw-r--r-- | gnu/system/install.scm | 6 |
4 files changed, 117 insertions, 1 deletions
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm index ea0f67b3cdd..52b38dd1abf 100644 --- a/gnu/bootloader/u-boot.scm +++ b/gnu/bootloader/u-boot.scm | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | u-boot-nintendo-nes-classic-edition-bootloader | 37 | u-boot-nintendo-nes-classic-edition-bootloader |
| 38 | u-boot-novena-bootloader | 38 | u-boot-novena-bootloader |
| 39 | u-boot-pine64-plus-bootloader | 39 | u-boot-pine64-plus-bootloader |
| 40 | u-boot-puma-rk3399-bootloader | ||
| 40 | u-boot-wandboard-bootloader)) | 41 | u-boot-wandboard-bootloader)) |
| 41 | 42 | ||
| 42 | (define install-u-boot | 43 | (define install-u-boot |
| @@ -84,6 +85,15 @@ | |||
| 84 | (write-file-on-device u-boot (stat:size (stat u-boot)) | 85 | (write-file-on-device u-boot (stat:size (stat u-boot)) |
| 85 | device (* 69 1024))))) | 86 | device (* 69 1024))))) |
| 86 | 87 | ||
| 88 | (define install-puma-rk3399-u-boot | ||
| 89 | #~(lambda (bootloader device mount-point) | ||
| 90 | (let ((spl (string-append bootloader "/libexec/u-boot-spl.rksd")) | ||
| 91 | (u-boot (string-append bootloader "/libexec/u-boot.itb"))) | ||
| 92 | (write-file-on-device spl (stat:size (stat spl)) | ||
| 93 | device (* 64 512)) | ||
| 94 | (write-file-on-device u-boot (stat:size (stat u-boot)) | ||
| 95 | device (* 512 512))))) | ||
| 96 | |||
| 87 | 97 | ||
| 88 | 98 | ||
| 89 | ;;; | 99 | ;;; |
| @@ -162,3 +172,9 @@ | |||
| 162 | (bootloader | 172 | (bootloader |
| 163 | (inherit u-boot-allwinner64-bootloader) | 173 | (inherit u-boot-allwinner64-bootloader) |
| 164 | (package u-boot-pine64-plus))) | 174 | (package u-boot-pine64-plus))) |
| 175 | |||
| 176 | (define u-boot-puma-rk3399-bootloader | ||
| 177 | (bootloader | ||
| 178 | (inherit u-boot-bootloader) | ||
| 179 | (package u-boot-puma-rk3399) | ||
| 180 | (installer install-puma-rk3399-u-boot))) | ||
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 2dd530125f5..a86c73731e3 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm | |||
| @@ -489,7 +489,7 @@ board-independent tools."))) | |||
| 489 | (let* ((out (assoc-ref outputs "out")) | 489 | (let* ((out (assoc-ref outputs "out")) |
| 490 | (libexec (string-append out "/libexec")) | 490 | (libexec (string-append out "/libexec")) |
| 491 | (uboot-files (append | 491 | (uboot-files (append |
| 492 | (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb)$") | 492 | (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$") |
| 493 | (find-files "." "^(MLO|SPL)$")))) | 493 | (find-files "." "^(MLO|SPL)$")))) |
| 494 | (mkdir-p libexec) | 494 | (mkdir-p libexec) |
| 495 | (install-file ".config" libexec) | 495 | (install-file ".config" libexec) |
| @@ -560,6 +560,37 @@ board-independent tools."))) | |||
| 560 | (define-public u-boot-cubieboard | 560 | (define-public u-boot-cubieboard |
| 561 | (make-u-boot-package "Cubieboard" "arm-linux-gnueabihf")) | 561 | (make-u-boot-package "Cubieboard" "arm-linux-gnueabihf")) |
| 562 | 562 | ||
| 563 | (define-public u-boot-puma-rk3399 | ||
| 564 | (let ((base (make-u-boot-package "puma-rk3399" "aarch64-linux-gnu"))) | ||
| 565 | (package | ||
| 566 | (inherit base) | ||
| 567 | (arguments | ||
| 568 | (substitute-keyword-arguments (package-arguments base) | ||
| 569 | ((#:phases phases) | ||
| 570 | `(modify-phases ,phases | ||
| 571 | (add-after 'unpack 'set-environment | ||
| 572 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 573 | ;; Need to copy the firmware into u-boot build | ||
| 574 | ;; directory. | ||
| 575 | (copy-file (string-append (assoc-ref inputs "firmware") | ||
| 576 | "/bl31.bin") "bl31-rk3399.bin") | ||
| 577 | (copy-file (string-append (assoc-ref inputs "firmware-m0") | ||
| 578 | "/rk3399m0.bin") "rk3399m0.bin") | ||
| 579 | #t)) | ||
| 580 | (add-after 'build 'build-itb | ||
| 581 | (lambda* (#:key make-flags #:allow-other-keys) | ||
| 582 | ;; The u-boot.itb is not built by default. | ||
| 583 | (apply invoke "make" `(,@make-flags ,"u-boot.itb")))) | ||
| 584 | (add-after 'build-itb 'build-rksd | ||
| 585 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 586 | ;; Build Rockchip SD card images. | ||
| 587 | (invoke "./tools/mkimage" "-T" "rksd" "-n" "rk3399" "-d" | ||
| 588 | "spl/u-boot-spl.bin" "u-boot-spl.rksd"))))))) | ||
| 589 | (native-inputs | ||
| 590 | `(("firmware" ,arm-trusted-firmware-puma-rk3399) | ||
| 591 | ("firmware-m0" ,rk3399-cortex-m0) | ||
| 592 | ,@(package-native-inputs base)))))) | ||
| 593 | |||
| 563 | (define-public vboot-utils | 594 | (define-public vboot-utils |
| 564 | (package | 595 | (package |
| 565 | (name "vboot-utils") | 596 | (name "vboot-utils") |
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index 9e91ceca4e0..986e1d62197 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm | |||
| @@ -404,3 +404,66 @@ such as: | |||
| 404 | (sha256 | 404 | (sha256 |
| 405 | (base32 | 405 | (base32 |
| 406 | "0r4xnlq7v9khjfcg6gqp7nmrmnw4z1r8bipwdr07png1dcbb8214"))))))) | 406 | "0r4xnlq7v9khjfcg6gqp7nmrmnw4z1r8bipwdr07png1dcbb8214"))))))) |
| 407 | |||
| 408 | (define-public arm-trusted-firmware-puma-rk3399 | ||
| 409 | (let ((base (make-arm-trusted-firmware "rk3399")) | ||
| 410 | ;; Vendor's arm trusted firmware branch hasn't been upstreamed yet. | ||
| 411 | (commit "d71e6d83612df896774ec4c03d49500312d2c324") | ||
| 412 | (revision "1")) | ||
| 413 | (package | ||
| 414 | (inherit base) | ||
| 415 | (name "arm-trusted-firmware-puma-rk3399") | ||
| 416 | (version (git-version "1.3" revision commit)) | ||
| 417 | (source | ||
| 418 | (origin | ||
| 419 | (method git-fetch) | ||
| 420 | (uri (git-reference | ||
| 421 | (url "https://git.theobroma-systems.com/arm-trusted-firmware.git") | ||
| 422 | (commit commit))) | ||
| 423 | (file-name (git-file-name name version)) | ||
| 424 | (sha256 | ||
| 425 | (base32 | ||
| 426 | "0vqhwqqh8h9qlkpybg2v94911091c1418bc4pnzq5fd7zf0fjkf8"))))))) | ||
| 427 | |||
| 428 | (define-public rk3399-cortex-m0 | ||
| 429 | (package | ||
| 430 | (name "rk3399-cortex-m0") | ||
| 431 | (version "1") | ||
| 432 | (source | ||
| 433 | (origin | ||
| 434 | (method git-fetch) | ||
| 435 | (uri (git-reference | ||
| 436 | (url "https://git.theobroma-systems.com/rk3399-cortex-m0.git") | ||
| 437 | (commit (string-append "v" version)))) | ||
| 438 | (file-name (git-file-name "rk3399-cortex-m0" version)) | ||
| 439 | (sha256 | ||
| 440 | (base32 | ||
| 441 | "02wz1vkf4j3zc8rx289z76xhrf71jhb2p05lvmygky393a9gjh9w")))) | ||
| 442 | (home-page "https://git.theobroma-systems.com/rk3399-cortex-m0.git/about/") | ||
| 443 | (synopsis "PMU Cortex M0 firmware for RK3399 Q7 (Puma)") | ||
| 444 | (description | ||
| 445 | "Cortex-M0 firmware used with the RK3399 to implement | ||
| 446 | power-management functionality and helpers (e.g. DRAM frequency | ||
| 447 | switching support).\n") | ||
| 448 | (license license:bsd-3) | ||
| 449 | (build-system gnu-build-system) | ||
| 450 | (arguments | ||
| 451 | `(#:phases | ||
| 452 | (modify-phases %standard-phases | ||
| 453 | (delete 'configure) | ||
| 454 | (delete 'check) | ||
| 455 | (replace 'install | ||
| 456 | (lambda* (#:key outputs #:allow-other-keys) | ||
| 457 | (let ((out (assoc-ref outputs "out")) | ||
| 458 | (mzerofiles (find-files "." "rk3399m0.(elf|bin)$"))) | ||
| 459 | (for-each | ||
| 460 | (lambda (file) | ||
| 461 | (install-file file out)) | ||
| 462 | mzerofiles)) | ||
| 463 | #t)) | ||
| 464 | (add-before 'build 'setenv | ||
| 465 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 466 | (setenv "CROSS_COMPILE" "arm-none-eabi-") | ||
| 467 | #t))))) | ||
| 468 | (native-inputs `(("cross-gcc" ,(cross-gcc "arm-none-eabi" #:xgcc gcc-7)) | ||
| 469 | ("cross-binutils" ,(cross-binutils "arm-none-eabi")))))) | ||
diff --git a/gnu/system/install.scm b/gnu/system/install.scm index acc9f15e0db..35f4ba9c247 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm | |||
| @@ -53,6 +53,7 @@ | |||
| 53 | nintendo-nes-classic-edition-installation-os | 53 | nintendo-nes-classic-edition-installation-os |
| 54 | novena-installation-os | 54 | novena-installation-os |
| 55 | pine64-plus-installation-os | 55 | pine64-plus-installation-os |
| 56 | rk3399-puma-installation-os | ||
| 56 | wandboard-installation-os)) | 57 | wandboard-installation-os)) |
| 57 | 58 | ||
| 58 | ;;; Commentary: | 59 | ;;; Commentary: |
| @@ -451,6 +452,11 @@ The bootloader BOOTLOADER is installed to BOOTLOADER-TARGET." | |||
| 451 | "/dev/mmcblk0" ; SD card storage | 452 | "/dev/mmcblk0" ; SD card storage |
| 452 | "ttyS0")) | 453 | "ttyS0")) |
| 453 | 454 | ||
| 455 | (define rk3399-puma-installation-os | ||
| 456 | (embedded-installation-os u-boot-puma-rk3399-bootloader | ||
| 457 | "/dev/mmcblk0" ; SD card storage | ||
| 458 | "ttyS0")) | ||
| 459 | |||
| 454 | (define wandboard-installation-os | 460 | (define wandboard-installation-os |
| 455 | (embedded-installation-os u-boot-wandboard-bootloader | 461 | (embedded-installation-os u-boot-wandboard-bootloader |
| 456 | "/dev/mmcblk0" ; SD card storage | 462 | "/dev/mmcblk0" ; SD card storage |
