[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/07: gnu: raspberry-pi: Add helpers for config.txt file generation.
From: |
guix-commits |
Subject: |
05/07: gnu: raspberry-pi: Add helpers for config.txt file generation. |
Date: |
Thu, 1 Dec 2022 14:33:04 -0500 (EST) |
apteryx pushed a commit to branch master
in repository guix.
commit 4e2e4b222f3b77e63602ffd5f1695b440d0faec7
Author: Stefan <stefan-guix@vodafonemail.de>
AuthorDate: Thu Dec 1 13:18:14 2022 -0500
gnu: raspberry-pi: Add helpers for config.txt file generation.
* 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.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
---
gnu/packages/raspberry-pi.scm | 57 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/raspberry-pi.scm b/gnu/packages/raspberry-pi.scm
index 8949d2237a..d4b183981b 100644
--- a/gnu/packages/raspberry-pi.scm
+++ b/gnu/packages/raspberry-pi.scm
@@ -42,7 +42,9 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-2)
#:use-module (srfi srfi-26)
- #:use-module (ice-9 match))
+ #:use-module (ice-9 match)
+ #:export (raspi-config-file
+ raspi-custom-txt))
(define-public bcm2835
(package
@@ -238,6 +240,59 @@ Raspberry Pi. Note: It does not work on Raspberry Pi 1.")
#t))))))))
(supported-systems '("aarch64-linux"))))
+(define (raspi-config-file name content)
+ "Make 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
+ ;; A config.txt file 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
+ ;; A dtb.txt file 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
+ ;; A dtb.txt file 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
+ ;; A bootloader.txt file to be included by the config.txt to load the
+ ;; U-Boot bootloader.
+ (raspi-config-file
+ "bootloader.txt"
+ '("dtoverlay=upstream"
+ "enable_uart=1"
+ "kernel=u-boot.bin")))
+
+(define (raspi-custom-txt content)
+ "Make a custom.txt file 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))
+
(define (make-raspi-defconfig arch defconfig sha256-as-base32)
"Make for the architecture ARCH a file-like object from the DEFCONFIG file
with the hash SHA256-AS-BASE32. This object can be used as the #:defconfig
- branch master updated (1a63aea943 -> c7793b82ef), guix-commits, 2022/12/01
- 02/07: gnu: bootloader: Add U-Boot packages for Raspberry Pi models., guix-commits, 2022/12/01
- 05/07: gnu: raspberry-pi: Add helpers for config.txt file generation.,
guix-commits <=
- 01/07: gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader., guix-commits, 2022/12/01
- 03/07: gnu: linux: Add a 'customize-linux' procedure., guix-commits, 2022/12/01
- 04/07: gnu: raspberry-pi: Add defconfig objects to build customized Linux kernels., guix-commits, 2022/12/01
- 06/07: gnu: raspberry-pi: New make-raspi-bcm28-dtbs procedure., guix-commits, 2022/12/01
- 07/07: gnu: raspberry-pi: Add a bootloader-chain for the Raspberry Pi and os examples., guix-commits, 2022/12/01