unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan <stefan-guix@vodafonemail.de>
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: 44543@debbugs.gnu.org
Subject: [bug#44543] [PATCH] gnu: raspberry-pi: Add helpers for config.txt file generation.
Date: Sun, 29 Nov 2020 20:04:00 +0100	[thread overview]
Message-ID: <C744BEF8-07E0-4BD8-A0F6-D5C5B093F28D@vodafonemail.de> (raw)
In-Reply-To: <20201116150108.26a2daa7@scratchpost.org>

* 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=" (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=0"))
+
+(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=upstream.
+  (raspi-config-file
+   "dtb.txt"
+   "upstream_kernel=1"))
+
+(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=upstream"
+     "kernel=u-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))
-- 
2.29.2





  reply	other threads:[~2020-11-29 19:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09 23:53 [bug#44543] [PATCH] gnu: raspberry-pi: Add helpers for config.txt file generation Stefan
2020-11-16  9:32 ` Danny Milosavljevic
2020-11-16 10:38   ` Stefan
2020-11-16 14:01     ` Danny Milosavljevic
2020-11-29 19:04       ` Stefan [this message]
2020-12-13 13:06         ` Stefan
2020-12-28 19:24           ` Stefan
2021-03-27 16:40             ` Stefan
2021-03-27 16:47               ` Léo Le Bouter via Guix-patches via
2021-03-27 19:43                 ` Stefan
2021-03-27 19:51                   ` Léo Le Bouter via Guix-patches via
2021-03-27 22:03                     ` Stefan
2021-05-06 21:12                       ` bug#44543: " Stefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C744BEF8-07E0-4BD8-A0F6-D5C5B093F28D@vodafonemail.de \
    --to=stefan-guix@vodafonemail.de \
    --cc=44543@debbugs.gnu.org \
    --cc=dannym@scratchpost.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).