From 4164ff51a9e26e7d0a7860566d7c108ce79f536d Mon Sep 17 00:00:00 2001 From: Herman Rimm Date: Sat, 23 Mar 2024 09:19:03 +0100 Subject: [PATCH] gnu: bootloader: Add nanopi-r4s-rk3399 bootloader. * gnu/bootloader/u-boot.scm (install-nanopi-r4s-rk3399-u-boot, u-boot-nanopi-r4s-rk3399-bootloader): Add variable. * gnu/packages/bootloaders.scm (u-boot-nanopi-r4s-rk3399): Add variable. Change-Id: I6d4cb098727fe4027aea33a39c59d34000dfc4db --- gnu/bootloader/u-boot.scm | 18 +++++++++++++++++- gnu/packages/bootloaders.scm | 17 ++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm index c5437a7b63..7888a4e030 100644 --- a/gnu/bootloader/u-boot.scm +++ b/gnu/bootloader/u-boot.scm @@ -5,7 +5,7 @@ ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2022 Maxim Cournoyer ;;; Copyright © 2023 Efraim Flashner -;;; Copyright © 2023 Herman Rimm +;;; Copyright © 2023-2024 Herman Rimm ;;; Copyright © 2024 Zheng Junjie <873216071@qq.com> ;;; ;;; This file is part of GNU Guix. @@ -37,6 +37,7 @@ (define-module (gnu bootloader u-boot) u-boot-cubietruck-bootloader u-boot-firefly-rk3399-bootloader u-boot-mx6cuboxi-bootloader + u-boot-nanopi-r4s-rk3399-bootloader u-boot-nintendo-nes-classic-edition-bootloader u-boot-novena-bootloader u-boot-orangepi-r1-plus-lts-rk3328-bootloader @@ -98,6 +99,15 @@ (define install-imx-u-boot (write-file-on-device u-boot (stat:size (stat u-boot)) image (* 69 1024))))) +(define install-nanopi-r4s-rk3399-u-boot + #~(lambda (bootloader root-index image) + (let ((spl (string-append bootloader "/libexec/idbloader.img")) + (u-boot (string-append bootloader "/libexec/u-boot.itb"))) + (write-file-on-device spl (stat:size (stat spl)) + image (* 64 512)) + (write-file-on-device u-boot (stat:size (stat u-boot)) + image (* 16384 512))))) + (define install-orangepi-r1-plus-lts-rk3328-u-boot #~(lambda (bootloader root-index image) (let ((idb (string-append bootloader "/libexec/idbloader.img")) @@ -274,6 +284,12 @@ (define u-boot-novena-bootloader (inherit u-boot-imx-bootloader) (package u-boot-novena))) +(define u-boot-nanopi-r4s-rk3399-bootloader + (bootloader + (inherit u-boot-bootloader) + (package u-boot-nanopi-r4s-rk3399) + (disk-image-installer install-nanopi-r4s-rk3399-u-boot))) + (define u-boot-orangepi-r1-plus-lts-rk3328-bootloader (bootloader (inherit u-boot-bootloader) diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index fcc1088fd6..402d192d08 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -18,7 +18,7 @@ ;;; Copyright © 2022, 2023 Denis 'GNUtoo' Carikli ;;; Copyright © 2021 Stefan ;;; Copyright © 2022, 2023, 2024 Maxim Cournoyer -;;; Copyright © 2023 Herman Rimm +;;; Copyright © 2023-2024 Herman Rimm ;;; Copyright © 2023 Simon Tournier ;;; Copyright © 2024 Zheng Junjie <873216071@qq.com> ;;; @@ -1247,6 +1247,21 @@ (define-public u-boot-novena version, contrary to Novena upstream, does not load u-boot.img from the first partition.")) +(define-public u-boot-nanopi-r4s-rk3399 + (let ((base (make-u-boot-package "nanopi-r4s-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) + (setenv "BL31" (search-input-file inputs "/bl31.elf")))))))) + (inputs + (modify-inputs (package-inputs base) + (append arm-trusted-firmware-rk3399)))))) + (define-public u-boot-orangepi-r1-plus-lts-rk3328 (let ((base (make-u-boot-package "orangepi-r1-plus-lts-rk3328" "aarch64-linux-gnu"))) (package