From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id UCTCLQLxw1+uMAAA0tVLHw (envelope-from ) for ; Sun, 29 Nov 2020 19:05:38 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id KNqhKQLxw198VwAAB5/wlQ (envelope-from ) for ; Sun, 29 Nov 2020 19:05:38 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 47C07940363 for ; Sun, 29 Nov 2020 19:05:38 +0000 (UTC) Received: from localhost ([::1]:53036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kjS0t-0002KW-NT for larch@yhetil.org; Sun, 29 Nov 2020 14:05:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kjS0M-0002Ju-9R for guix-patches@gnu.org; Sun, 29 Nov 2020 14:05:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:41080) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kjS0M-0002If-14 for guix-patches@gnu.org; Sun, 29 Nov 2020 14:05:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kjS0L-0003qi-Sw for guix-patches@gnu.org; Sun, 29 Nov 2020 14:05:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#44543] [PATCH] gnu: raspberry-pi: Add helpers for config.txt file generation. Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 29 Nov 2020 19:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44543 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 44543@debbugs.gnu.org Received: via spool by 44543-submit@debbugs.gnu.org id=B44543.160667665414737 (code B ref 44543); Sun, 29 Nov 2020 19:05:01 +0000 Received: (at 44543) by debbugs.gnu.org; 29 Nov 2020 19:04:14 +0000 Received: from localhost ([127.0.0.1]:52626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kjRza-0003pb-Ez for submit@debbugs.gnu.org; Sun, 29 Nov 2020 14:04:14 -0500 Received: from vsmx009.vodafonemail.xion.oxcs.net ([153.92.174.87]:43678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kjRzY-0003pI-Rk for 44543@debbugs.gnu.org; Sun, 29 Nov 2020 14:04:13 -0500 Received: from vsmx001.vodafonemail.xion.oxcs.net (unknown [192.168.75.191]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id 7EC49159DBE6; Sun, 29 Nov 2020 19:04:06 +0000 (UTC) Received: from macbook-pro.kuh-wiese.my-router.de (unknown [88.70.113.247]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 1D518159D655; Sun, 29 Nov 2020 19:04:02 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Stefan In-Reply-To: <20201116150108.26a2daa7@scratchpost.org> Date: Sun, 29 Nov 2020 20:04:00 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20201116103231.2c151d33@scratchpost.org> <6C52CE60-8585-4FC4-BCBC-B901CB75B35F@vodafonemail.de> <20201116150108.26a2daa7@scratchpost.org> X-Mailer: Apple Mail (2.3124) X-VADE-STATUS: LEGIT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.7 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.78 X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-TUID: AHzRQBV6DK+W * gnu/packages/raspberry-pi.scm (raspi-config-file, raspi-custom-txt): New functions. (raspi-config-txt, raspi-bcm27-dtb-txt, raspi-bcm28-dtb-txt raspi-u-boot-bootloader-txt): New variables. --- gnu/packages/raspberry-pi.scm | 62 +++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/gnu/packages/raspberry-pi.scm = b/gnu/packages/raspberry-pi.scm index cdea392fc7..b189ec2f4e 100644 --- a/gnu/packages/raspberry-pi.scm +++ b/gnu/packages/raspberry-pi.scm @@ -235,3 +235,65 @@ Raspberry Pi. Note: It does not work on Raspberry = Pi 1.") (install-file "arm64.bin" libexec) #t)))))))) (supported-systems '("aarch64-linux")))) + +(define-public (raspi-config-file name content) + "Create a configuration file like config.txt for the Raspberry Pi = firmware. +CONTENT can be a list of strings, which are concatenated with a newline +character. Alternatively CONTENT can be a string with the full file = content." + (plain-file + name + (if (list? content) + (string-join content "\n" 'suffix) + content))) + +(define-public (raspi-config-file name content) + "Create a configuration file like config.txt for the Raspberry Pi = firmware. +CONTENT can be a list of strings, which are concatenated with a newline +character. Alternatively CONTENT can be a string with the full file = content." + (plain-file + name + (if (list? content) + (string-join content "\n" 'suffix) + content))) + +(define-public raspi-config-txt + ;; Create a config.txt to start the ARM cores up in 64-bit mode if = necessary + ;; and to include a dtb.txt, bootloader.txt, and a custom.txt, each = with + ;; separated configurations for the Raspberry Pi firmware. + (raspi-config-file + "config.txt" + `("# See = https://www.raspberrypi.org/documentation/configuration/config-txt/README.= md for details." + "" + ,(string-append "arm_64bit=3D" (if (target-aarch64?) "1" "0")) + "include dtb.txt" + "include bootloader.txt" + "include custom.txt"))) + +(define-public raspi-bcm27-dtb-txt + ;; Create a dtb.txt to be included by the config.txt to ensure that = the + ;; downstream device tree files bcm27*.dtb will be used. + (raspi-config-file + "dtb.txt" + "upstream_kernel=3D0")) + +(define-public raspi-bcm28-dtb-txt + ;; Create a dtb.txt to be included by the config.txt to ensure that = the + ;; upstream device tree files bcm28*.dtb will be used. + ;; This also implies the use of the dtoverlay=3Dupstream. + (raspi-config-file + "dtb.txt" + "upstream_kernel=3D1")) + +(define-public raspi-u-boot-bootloader-txt + ;; Create a bootloader.txt file to be included by the config.txt to = load the + ;; U-Boot bootloader. + (raspi-config-file + "bootloader.txt" + '("dtoverlay=3Dupstream" + "kernel=3Du-boot.bin"))) + +(define-public (raspi-custom-txt content) + "Create a custom.txt for the Raspberry Pi firmware. +CONTENT can be a list of strings, which are concatenated with a newline +character. Alternatively CONTENT can be a string with the full file = content." + (raspi-config-file "custom.txt" content)) --=20 2.29.2