unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#44543] [PATCH] gnu: raspberry-pi: Add helpers for config.txt file generation.
@ 2020-11-09 23:53 Stefan
  2020-11-16  9:32 ` Danny Milosavljevic
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan @ 2020-11-09 23:53 UTC (permalink / raw)
  To: 44543; +Cc: Danny Milosavljevic

* gnu/packages/raspberry-pi.scm (raspi-config-file, raspi-custom.txt):
  New functions.
  (raspi-config.txt, raspi-u-boot-bootloader.txt, raspi-kernel.txt):
  New variables.
---
 gnu/packages/raspberry-pi.scm | 44 +++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/raspberry-pi.scm b/gnu/packages/raspberry-pi.scm
index 7700c26d06..af3998c4d6 100644
--- a/gnu/packages/raspberry-pi.scm
+++ b/gnu/packages/raspberry-pi.scm
@@ -235,3 +235,47 @@ 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)
+  "Creates 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
+  ;; Creates a config.txt to start the ARM cores up in 64-bit mode if necessary
+  ;; and to include bootloader.txt, kernel.txt, and a custom.txt, each with
+  ;; separate 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 bootloader.txt"
+     "include kernel.txt"
+     "include custom.txt")))
+
+(define-public raspi-u-boot-bootloader.txt
+  ;; Creates a bootloader.txt file to be included by the config.txt to load the
+  ;; U-Boot bootloader.
+  (raspi-config-file
+   "bootloader.txt"
+   "kernel=u-boot.bin"))
+
+(define-public raspi-kernel.txt
+  ;; Creates a kernel.txt to be included by the config.txt to ensure that
+  ;; upstream kernel and device tree files can be used.
+  (raspi-config-file
+   "kernel.txt"
+   '("dtoverlay=upstream"
+     "upstream_kernel=1")))
+
+(define-public (raspi-custom.txt content)
+  "Creates a custom.txt to be included by the config.txt.  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.26.0






^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-05-06 21:13 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).