From patchwork Thu Oct 31 21:15:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 69716 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id ACD6527BBE2; Thu, 31 Oct 2024 21:17:40 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DB33327BBEA for ; Thu, 31 Oct 2024 21:17:39 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6cXi-0005IA-Ji; Thu, 31 Oct 2024 17:17:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6cXP-0005HB-Ov for guix-patches@gnu.org; Thu, 31 Oct 2024 17:17:03 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6cXP-0006Ob-GK for guix-patches@gnu.org; Thu, 31 Oct 2024 17:17:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=bFWeR6NS+AYxEmJVo3SazWK4Aib9Rgv4nb552nN0uOE=; b=MGsksIScYg4IPWsr3Xtte8nENbyAYyjwg5ygF9Diew4bvylNv4xSvnEh5GyzP9epN0cToHehOw0gb3CFBmApMs5vfsaQTkD3U3m8hJx/O2hhYZsI7FWInvDu7U5YhRUSL/IcyLtHz0idd1rH1PKPMyTrGfg+3W7zYYuHARBMkoyv/NVN7iWNLyPf/PvsgWEkXNrEkDI5385OeJxLyRGKkt3cFWBc3fOH+yUICMATnr5mhtusHKB8jXH47f6mPhxWRyZcMgP7WD+gKO856OWk6/MdFahjBi5UXuEs8P7wDUa9+KkqBCF9j7KiQW+MDGfO0KHRggjf9p3xPsynFixDFg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t6cXP-0000xY-B3 for guix-patches@gnu.org; Thu, 31 Oct 2024 17:17:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#74109] [PATCH v2 2/2] gnu: bootloader: u-boot: Add procedure to share installer code. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 31 Oct 2024 21:17:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74109 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74109@debbugs.gnu.org Received: via spool by 74109-submit@debbugs.gnu.org id=B74109.17304094093651 (code B ref 74109); Thu, 31 Oct 2024 21:17:03 +0000 Received: (at 74109) by debbugs.gnu.org; 31 Oct 2024 21:16:49 +0000 Received: from localhost ([127.0.0.1]:44368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6cXA-0000wk-AT for submit@debbugs.gnu.org; Thu, 31 Oct 2024 17:16:48 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:43653 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6cX5-0000w4-AX for 74109@debbugs.gnu.org; Thu, 31 Oct 2024 17:16:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1730409393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+nxd3wlRKi5kVjAYSC5tHvBCODcef7xZ/o0LQVDpt/U=; b=ICyPdi/gbHKzcP9bd7Bd4l3yoBWuYMU2lx4AyoKTIWwKB1LMqWUDJjJYdoA26ekTb4Rb2K ryD9+9A/uvt/2oMpisfwVpVxHeJu+bn+ptnZwubp6DMU9DTVI8fJ1H+u7KEgFwlgJMQTLm JxSHTRspRwD4HwWgCzxpc0RDCvHGlBeU5qM2BBZNBkzvnPjL2GpJiQsIh83tQiuFghZK0i ehttGKQjqUYh+bGJXypFVfQyWq+Plrg+Tby4zY1rRXZMT0HZ+lwEvsrqoOj7r9YBrT0519 xwkiEvNK0sE4AtDBwUD8gWC1gxML/1seFK7BiPtEAlpG+QABzRt99J+N7kkFIQ== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 433069b6 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <74109@debbugs.gnu.org>; Thu, 31 Oct 2024 21:16:33 +0000 (UTC) Date: Thu, 31 Oct 2024 22:15:50 +0100 Message-ID: <19a389de12d56ef271ab7c7637b3f5fcab2d0cd6.1730408855.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/bootloader/u-boot.scm (make-u-boot-installer): Add procedure. (install-u-boot-ts7970-q-2g-1000mhz-c-u-boot, install-qemu-riscv64-u-boot): Remove variables. (install-starfive-visionfive2-uEnv.txt, u-boot-ts7970-q-2g-1000mhz-c-bootloader, u-boot-qemu-riscv64-bootloader): Use make-u-boot-installer. Change-Id: I0b0b507925a7c8ca608f7307d442d9588862ae91 --- gnu/bootloader/u-boot.scm | 47 ++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm index c5437a7b63..5e149eaea0 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. @@ -28,6 +28,7 @@ (define-module (gnu bootloader u-boot) #:use-module (gnu bootloader) #:use-module (gnu packages bootloaders) #:use-module (guix gexp) + #:use-module (ice-9 match) #:export (u-boot-bootloader u-boot-a20-olinuxino-lime-bootloader u-boot-a20-olinuxino-lime2-bootloader @@ -53,6 +54,18 @@ (define-module (gnu bootloader u-boot) u-boot-ts7970-q-2g-1000mhz-c-bootloader u-boot-wandboard-bootloader)) +(define (make-u-boot-installer file) + (let ((file + (match file + ((? string?) + (list #~(install-file (string-append bootloader #$file) + install-dir))) + ((? file-like?) (list #~(install-file #$file install-dir))) + (#f '())))) + #~(lambda (bootloader device mount-point) + (let ((install-dir (string-append mount-point "/boot"))) + #$@file)))) + (define install-u-boot #~(lambda (bootloader root-index image) (if bootloader @@ -145,12 +158,6 @@ (define install-rockpro64-rk3399-u-boot (define install-pinebook-pro-rk3399-u-boot install-rockpro64-rk3399-u-boot) -(define install-u-boot-ts7970-q-2g-1000mhz-c-u-boot - #~(lambda (bootloader device mount-point) - (let ((u-boot.imx (string-append bootloader "/libexec/u-boot.imx")) - (install-dir (string-append mount-point "/boot"))) - (install-file u-boot.imx install-dir)))) - (define install-sifive-unmatched-u-boot #~(lambda (bootloader root-index image) (let ((spl (string-append bootloader "/libexec/spl/u-boot-spl.bin")) @@ -171,24 +178,14 @@ (define install-starfive-visionfive2-u-boot image (* 2082 512))))) (define install-starfive-visionfive2-uEnv.txt - #~(lambda (bootloader device mount-point) - (mkdir-p (string-append mount-point "/boot")) - (call-with-output-file (string-append mount-point "/boot/uEnv.txt") - (lambda (port) - (format port - ;; if board SPI use vender's u-boot, will find - ;; ""starfive/starfive_visionfive2.dtb"", We cannot guarantee - ;; that users will update this u-boot, so set it. - "fdtfile=starfive/jh7110-starfive-visionfive-2-v1.3b.dtb~%"))))) - -(define install-qemu-riscv64-u-boot - #~(lambda (bootloader device mount-point) - (let ((u-boot.bin (string-append bootloader "/libexec/u-boot.bin")) - (install-dir (string-append mount-point "/boot"))) - (install-file u-boot.bin install-dir)))) + (make-u-boot-installer + ;; If the board SPI uses the vendor's U-Boot, it will find starfive/ + ;; starfive_visionfive2.dtb. We cannot guarantee that users will + ;; update this U-Boot, so set the FDT explicitly. + (plain-file "uEnv.txt" + "fdtfile=starfive/jh7110-starfive-visionfive-2-v1.3b.dtb~%"))) - ;;; ;;; Bootloader definitions. ;;; @@ -329,7 +326,7 @@ (define u-boot-ts7970-q-2g-1000mhz-c-bootloader (bootloader (inherit u-boot-bootloader) (package u-boot-ts7970-q-2g-1000mhz-c) - (installer install-u-boot-ts7970-q-2g-1000mhz-c-u-boot) + (installer (make-u-boot-installer "libexec/u-boot.imx")) (disk-image-installer #f))) (define u-boot-sifive-unmatched-bootloader @@ -349,5 +346,5 @@ (define u-boot-qemu-riscv64-bootloader (bootloader (inherit u-boot-bootloader) (package u-boot-qemu-riscv64) - (installer install-qemu-riscv64-u-boot) + (installer (make-u-boot-installer "libexec/u-boot.bin")) (disk-image-installer #f)))