GNU bug report logs - #44543
[PATCH] gnu: raspberry-pi: Add helpers for config.txt file generation.

Previous Next

Package: guix-patches;

Reported by: Stefan <stefan-guix <at> vodafonemail.de>

Date: Mon, 9 Nov 2020 23:55:01 UTC

Severity: normal

Tags: patch

Done: Stefan <stefan-guix <at> vodafonemail.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44543 in the body.
You can then email your comments to 44543 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#44543; Package guix-patches. (Mon, 09 Nov 2020 23:55:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan <stefan-guix <at> vodafonemail.de>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 09 Nov 2020 23:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan <stefan-guix <at> vodafonemail.de>
To: guix-patches <at> gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH] gnu: raspberry-pi: Add helpers for config.txt file generation.
Date: Tue, 10 Nov 2020 00:53:52 +0100
* 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






Information forwarded to guix-patches <at> gnu.org:
bug#44543; Package guix-patches. (Mon, 16 Nov 2020 09:33:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Stefan <stefan-guix <at> vodafonemail.de>
Cc: guix-patches <at> gnu.org
Subject: Re: [PATCH] gnu: raspberry-pi: Add helpers for config.txt file
 generation.
Date: Mon, 16 Nov 2020 10:32:31 +0100
[Message part 1 (text/plain, inline)]
I'm waiting for Ludo to comment about the dots in the variable names.
(Apparently, to be forward-compatible with literal pairs, dots in variable names are not nice to use)

It would be nice to also have some clients of that stuff in that file.

I.e. actually boot the raspberry pi using some chainloader config.

Otherwise it's hard to say whether this is a good API.  When the API is actually
used it's much easier to say.


[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#44543; Package guix-patches. (Mon, 16 Nov 2020 10:39:01 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan <stefan-guix <at> vodafonemail.de>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: guix-patches <at> gnu.org
Subject: Re: [PATCH] gnu: raspberry-pi: Add helpers for config.txt file
 generation.
Date: Mon, 16 Nov 2020 11:38:19 +0100
Hi Danny!

> It would be nice to also have some clients of that stuff in that file.
> 
> I.e. actually boot the raspberry pi using some chainloader config.
> 
> Otherwise it's hard to say whether this is a good API.  When the API is actually
> used it's much easier to say.

There will be more patches to come, then there will be a use of these functions.

The firmware blob using these files can’t be handled by Guix, this will have to be left as an exercise. But could I add a skeleton for it? Maybe something like this (but better using the copy-build-system): 

(define (raspi-firmware url version hash)
  (package
   (build-system trivial-build-system)
   (arguments
    '(#:modules
      ((guix build utils))
      #:builder (begin
                  (use-modules (guix build utils))
                  (let* ((source (assoc-ref %build-inputs "source"))
                         (out (assoc-ref %outputs "out"))
                         (boot (string-append out "/boot"))
                         (opt (string-append out "/opt")))
                    (mkdir-p boot)
                    (copy-recursively (string-append source "/boot") boot)
                    (delete-file (string-append boot "/kernel.img"))
                    (delete-file (string-append boot "/kernel7.img"))
                    (delete-file (string-append boot "/kernel7l.img"))
                    (delete-file (string-append boot "/kernel8.img"))
                    (mkdir-p opt)
                    (copy-recursively (string-append source "/opt") opt)
                    (delete-file-recursively (string-append opt "/vc/src"))
                    #t))))
…))

Further steps will be some functionality to modify the U-Boot configuration (done with Kconfig) and to have a specific U-Boot package.

Then I’ll care for a kernel.

The board will only boot if all of this is in place.

This is how I use it all currently (left out kernel, kernel-arguments, initrd-modules):

(operating-system
  (bootloader 
    (bootloader-configuration
      (bootloader (bootloader-chain
                   (list (file-append raspi-firmware "/boot/")
                         (file-append u-boot-rpi-3 "/libexec/u-boot.bin")
                         raspi-config.txt
                         raspi-u-boot-bootloader.txt
                         ;; Additional configurations to use.
                         (raspi-custom.txt '("disable_overscan=1"
                                             "hdmi_force_hotplug=1"
                                             "audio=on"
                                             "dtoverlay=gpio-ir"
                                             "dtoverlay=disable-wifi"
                                             "dtoverlay=vc4-fkms-v3d,cma-64")))
                   grub-efi-netboot-bootloader 
                   #:installer (install-grub-efi-netboot "efi/boot")
                   #:copy-files? #t))
      (theme
        (grub-theme
          (resolution 
            '(1920 . 1080))
             (image (file-append %artwork-repository "/grub/GuixSD-fully-black-16-9.svg"))))
      (target "/boot")
      (keyboard-layout keyboard-layout)))
…)

The above bootloader-chain could certainly be added to Guix, but leaving out the raspi-firmware and the raspi-custom.txt – maybe as a function to allow adding an own raspi-custom.txt. If someone copies the firmware by hand onto an SD card, then such a bootloader provided as e.g. raspi-grub-bootloader would work.


Bye

Stefan





Information forwarded to guix-patches <at> gnu.org:
bug#44543; Package guix-patches. (Mon, 16 Nov 2020 14:02:01 GMT) Full text and rfc822 format available.

Message #14 received at 44543 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Stefan <stefan-guix <at> vodafonemail.de>
Cc: 44543 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: raspberry-pi: Add helpers for config.txt file
 generation.
Date: Mon, 16 Nov 2020 15:01:08 +0100
[Message part 1 (text/plain, inline)]
Hi Stefan,

thanks!

On Mon, 16 Nov 2020 11:38:19 +0100
Stefan <stefan-guix <at> vodafonemail.de> wrote:

> The firmware blob using these files can’t be handled by Guix, this will have to be left as an exercise. But could I add a skeleton for it? Maybe something like this (but better using the copy-build-system): 

There is a free software Raspberry VC firmware on
https://github.com/librerpi/rpi-open-firmware/ (currently cannot handle graphics
and USB and lots of other important things--but it DOES boot) and development
is ongoing.

We can just package that free software firmware and use it.

I've already started packaging it for Guix.

> (operating-system
>   (bootloader 
>     (bootloader-configuration
>       (bootloader (bootloader-chain
>                    (list (file-append raspi-firmware "/boot/")
>                          (file-append u-boot-rpi-3 "/libexec/u-boot.bin")
>                          raspi-config.txt
>                          raspi-u-boot-bootloader.txt
>                          ;; Additional configurations to use.
>                          (raspi-custom.txt '("disable_overscan=1"
>                                              "hdmi_force_hotplug=1"
>                                              "audio=on"
>                                              "dtoverlay=gpio-ir"
>                                              "dtoverlay=disable-wifi"
>                                              "dtoverlay=vc4-fkms-v3d,cma-64")))
>                    grub-efi-netboot-bootloader 
>                    #:installer (install-grub-efi-netboot "efi/boot")
>                    #:copy-files? #t))

I advice to add a user-level function for a free software Raspberry Pi 3 efi
netboot bootloader to Guix (and a non-efi-netboot one, too, maybe).

Something like

(define (raspi-3-efi-netboot-bootloader efi-boot custom-text)
  (bootloader-chain like you do above custom-text))

I don't think that it's reasonable to expect the user to use bootloader-chain
by himself (it's not user-friendly to have to do that).

> The above bootloader-chain could certainly be added to Guix, but leaving out the raspi-firmware and the raspi-custom.txt – maybe as a function to allow adding an own raspi-custom.txt. If someone copies the firmware by hand onto an SD card, then such a bootloader provided as e.g. raspi-grub-bootloader would work.

Yeah.
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#44543; Package guix-patches. (Sun, 29 Nov 2020 19:05:01 GMT) Full text and rfc822 format available.

Message #17 received at 44543 <at> debbugs.gnu.org (full text, mbox):

From: Stefan <stefan-guix <at> vodafonemail.de>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 44543 <at> debbugs.gnu.org
Subject: [PATCH] gnu: raspberry-pi: Add helpers for config.txt file generation.
Date: Sun, 29 Nov 2020 20:04:00 +0100
* 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





Information forwarded to guix-patches <at> gnu.org:
bug#44543; Package guix-patches. (Sun, 13 Dec 2020 13:08:01 GMT) Full text and rfc822 format available.

Message #20 received at 44543 <at> debbugs.gnu.org (full text, mbox):

From: Stefan <stefan-guix <at> vodafonemail.de>
To: Danny Milosavljevic <dannym <at> scratchpost.org>,
 44543 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: raspberry-pi: Add helpers for config.txt file
 generation.
Date: Sun, 13 Dec 2020 14:06:56 +0100
Hi Danny!

A friendly ping. :-)


Bye

Stefan




Information forwarded to guix-patches <at> gnu.org:
bug#44543; Package guix-patches. (Mon, 28 Dec 2020 19:25:02 GMT) Full text and rfc822 format available.

Message #23 received at 44543 <at> debbugs.gnu.org (full text, mbox):

From: Stefan <stefan-guix <at> vodafonemail.de>
To: Danny Milosavljevic <dannym <at> scratchpost.org>,
 44543 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe <at> gnu.org>
Subject: Re: [PATCH] gnu: raspberry-pi: Add helpers for config.txt file
 generation.
Date: Mon, 28 Dec 2020 20:24:19 +0100
Hi!

A friendly ping! :-)


Bye

Stefan




Information forwarded to guix-patches <at> gnu.org:
bug#44543; Package guix-patches. (Sat, 27 Mar 2021 16:41:02 GMT) Full text and rfc822 format available.

Message #26 received at 44543 <at> debbugs.gnu.org (full text, mbox):

From: Stefan <stefan-guix <at> vodafonemail.de>
To: Danny Milosavljevic <dannym <at> scratchpost.org>,
 44543 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe <at> gnu.org>
Subject: Re: [PATCH] gnu: raspberry-pi: Add helpers for config.txt file
 generation.
Date: Sat, 27 Mar 2021 17:40:27 +0100
Hi!

Another friendly ping! This patch is meanwhile really getting old, but it is still not forgotten. :-)

<http://issues.guix.gnu.org/44543>


Bye

Stefan





Information forwarded to guix-patches <at> gnu.org:
bug#44543; Package guix-patches. (Sat, 27 Mar 2021 16:48:01 GMT) Full text and rfc822 format available.

Message #29 received at 44543 <at> debbugs.gnu.org (full text, mbox):

From: Léo Le Bouter <lle-bout <at> zaclys.net>
To: Stefan <stefan-guix <at> vodafonemail.de>, Danny Milosavljevic
 <dannym <at> scratchpost.org>, 44543 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe <at> gnu.org>
Subject: Re: [bug#44543] [PATCH] gnu: raspberry-pi: Add helpers for
 config.txt file generation.
Date: Sat, 27 Mar 2021 17:47:14 +0100
[Message part 1 (text/plain, inline)]
On Sat, 2021-03-27 at 17:40 +0100, Stefan wrote:
> Hi!
> 
> Another friendly ping! This patch is meanwhile really getting old,
> but it is still not forgotten. :-)
> 
> <http://issues.guix.gnu.org/44543>
> 
> 
> Bye
> 
> Stefan

I have a Raspberry Pi 3B+ here at home, how can I test these changes?

I don't feel capable to review this without testing something as a
whole verifying that it works then inspecting these things that make it
work.

Thank you
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#44543; Package guix-patches. (Sat, 27 Mar 2021 19:44:01 GMT) Full text and rfc822 format available.

Message #32 received at 44543 <at> debbugs.gnu.org (full text, mbox):

From: Stefan <stefan-guix <at> vodafonemail.de>
To: Léo Le Bouter <lle-bout <at> zaclys.net>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 44543 <at> debbugs.gnu.org,
 Mathieu Othacehe <othacehe <at> gnu.org>
Subject: Re: [bug#44543] [PATCH] gnu: raspberry-pi: Add helpers for config.txt
 file generation.
Date: Sat, 27 Mar 2021 20:43:02 +0100
Hi Léo!

> I have a Raspberry Pi 3B+ here at home, how can I test these changes?
> 
> I don't feel capable to review this without testing something as a
> whole verifying that it works then inspecting these things that make it
> work.

The support for the Raspberry is still not complete. I’m using mine without an SD card, booting it over TFTP with an NFS root mount.

Installing on an SD card is not tested and certainly not working yet.

One of my next patches will be several u-boot packages for different Raspberry models. To build them I need to do changes to the defconfig file of u-boot. Therefore another ticket is pending, which eases defconfig modifications (<http://issues.guix.gnu.org/45046>, and I hope this can also be used to modify Linux). When that one is done, then I will send that next patch to add the u-boot packages. 

My bootloader currently looks like this, but I’m using already further modifications, mainly for GRUB, so this will not work for you, but you can get an impression of the final intended use of all patches:

  (bootloader
    (bootloader-configuration
      (target "/boot")
      (bootloader (efi-bootloader-chain
                   grub-efi-netboot-removable-bootloader
                   ;; Packages needed to boot the Raspberry.
                   #:packages (list raspberrypi-firmware 
                                    u-boot-rpi-efi-64)
                   ;; Additional files for configuration.
                   #:files (list ;; Detects 32 or 64 bit, includes other txt files.
                                 raspi-config-txt
                                 ;; Use the downstream device tree (upstream is bcm28).
                                 raspi-bcm27-dtb-txt
                                 ;; This is the next boot stage.
                                 raspi-u-boot-bootloader-txt 
                                 ;; Additional configurations to use.
                                 (raspi-custom-txt '("disable_overscan=1"
                                                     "hdmi_force_hotplug=1"
                                                     "audio=on"
                                                     "dtoverlay=gpio-ir"
                                                     "dtoverlay=disable-wifi"
                                                     "dtoverlay=vc4-fkms-v3d,cma-64")))))))

Your bootloader configuration would need to look like this, and you may get it running from an SD card:

  (bootloader
    (bootloader-configuration
      (target "/boot")
      (bootloader
        (efi-bootloader-chain
          (list (file-append firmware "/boot/")
                (file-append u-boot-my-scb "/libexec/u-boot.bin")
                raspi-config-txt
                raspi-bcm27-dtb-txt
                raspi-u-boot-bootloader-txt)
          grub-efi-netboot-bootloader
          #:installer
           (chain-efi-bootloader-installer (install-grub-efi-netboot "efi/boot")))))

So you need to provide firmware and u-boot (still) yourself. As a short cut you may omit both (file-append …) functions and copy both parts by hand from some other distribution, maybe openSUSE – this is basically how I got started.

If you mount an ext4-partition of an SD card to e.g. /my-target/ and the FAT partition to /my-target/boot, then you may try a ‘guix system init … /my-target’.

If this succeeds, then it may be possible that adding the file /my-target/boot/efi/boot/grub.cfg with this content gets you to a system booting from an SD card:

search --file /boot/grub/grub.cfg
configfile /boot/grub/grub.cfg

But this is all untested, it certainly fails. :-)

At least – regarding this patch – I can ensure that the three config files as used in these bootloader examples are properly generated working.
 

Bye

Stefan



Information forwarded to guix-patches <at> gnu.org:
bug#44543; Package guix-patches. (Sat, 27 Mar 2021 19:52:01 GMT) Full text and rfc822 format available.

Message #35 received at 44543 <at> debbugs.gnu.org (full text, mbox):

From: Léo Le Bouter <lle-bout <at> zaclys.net>
To: Stefan <stefan-guix <at> vodafonemail.de>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 44543 <at> debbugs.gnu.org,
 Mathieu Othacehe <othacehe <at> gnu.org>
Subject: Re: [bug#44543] [PATCH] gnu: raspberry-pi: Add helpers for
 config.txt file generation.
Date: Sat, 27 Mar 2021 20:51:10 +0100
[Message part 1 (text/plain, inline)]
On Sat, 2021-03-27 at 20:43 +0100, Stefan wrote:
> Hi Léo!
> 
> > I have a Raspberry Pi 3B+ here at home, how can I test these
> > changes?
> > 
> > I don't feel capable to review this without testing something as a
> > whole verifying that it works then inspecting these things that
> > make it
> > work.
> 
> The support for the Raspberry is still not complete. I’m using mine
> without an SD card, booting it over TFTP with an NFS root mount.
> 
> Installing on an SD card is not tested and certainly not working yet.
> 
> One of my next patches will be several u-boot packages for different
> Raspberry models. To build them I need to do changes to the defconfig
> file of u-boot. Therefore another ticket is pending, which eases
> defconfig modifications (<http://issues.guix.gnu.org/45046>;, and I
> hope this can also be used to modify Linux). When that one is done,
> then I will send that next patch to add the u-boot packages. 
> 
> My bootloader currently looks like this, but I’m using already
> further modifications, mainly for GRUB, so this will not work for
> you, but you can get an impression of the final intended use of all
> patches:
> 
>   (bootloader
>     (bootloader-configuration
>       (target "/boot")
>       (bootloader (efi-bootloader-chain
>                    grub-efi-netboot-removable-bootloader
>                    ;; Packages needed to boot the Raspberry.
>                    #:packages (list raspberrypi-firmware 
>                                     u-boot-rpi-efi-64)
>                    ;; Additional files for configuration.
>                    #:files (list ;; Detects 32 or 64 bit, includes
> other txt files.
>                                  raspi-config-txt
>                                  ;; Use the downstream device tree
> (upstream is bcm28).
>                                  raspi-bcm27-dtb-txt
>                                  ;; This is the next boot stage.
>                                  raspi-u-boot-bootloader-txt 
>                                  ;; Additional configurations to use.
>                                  (raspi-custom-txt
> '("disable_overscan=1"
>                                                      "hdmi_force_hotp
> lug=1"
>                                                      "audio=on"
>                                                      "dtoverlay=gpio-
> ir"
>                                                      "dtoverlay=disab
> le-wifi"
>                                                      "dtoverlay=vc4-
> fkms-v3d,cma-64")))))))
> 
> Your bootloader configuration would need to look like this, and you
> may get it running from an SD card:
> 
>   (bootloader
>     (bootloader-configuration
>       (target "/boot")
>       (bootloader
>         (efi-bootloader-chain
>           (list (file-append firmware "/boot/")
>                 (file-append u-boot-my-scb "/libexec/u-boot.bin")
>                 raspi-config-txt
>                 raspi-bcm27-dtb-txt
>                 raspi-u-boot-bootloader-txt)
>           grub-efi-netboot-bootloader
>           #:installer
>            (chain-efi-bootloader-installer (install-grub-efi-netboot
> "efi/boot")))))
> 
> So you need to provide firmware and u-boot (still) yourself. As a
> short cut you may omit both (file-append …) functions and copy both
> parts by hand from some other distribution, maybe openSUSE – this is
> basically how I got started.
> 
> If you mount an ext4-partition of an SD card to e.g. /my-target/ and
> the FAT partition to /my-target/boot, then you may try a ‘guix system
> init … /my-target’.
> 
> If this succeeds, then it may be possible that adding the file /my-
> target/boot/efi/boot/grub.cfg with this content gets you to a system
> booting from an SD card:
> 
> search --file /boot/grub/grub.cfg
> configfile /boot/grub/grub.cfg
> 
> But this is all untested, it certainly fails. :-)
> 
> At least – regarding this patch – I can ensure that the three config
> files as used in these bootloader examples are properly generated
> working.
>  
> 
> Bye
> 
> Stefan

Thanks for all your work!

I would prefer if you opened one single bug with all the changes so I
can test the whole thing, right now I don't feel at ease reviewing
things like this. How can I be sure what you are submitting is the
right abstraction for your future work? Are you sure that abstraction
will be right for your future patches? If anything needs to be changed
I feel like one big patchset about Raspberry Pi 3B+ support will be
easier to review (at least for me).

Léo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#44543; Package guix-patches. (Sat, 27 Mar 2021 22:04:02 GMT) Full text and rfc822 format available.

Message #38 received at 44543 <at> debbugs.gnu.org (full text, mbox):

From: Stefan <stefan-guix <at> vodafonemail.de>
To: Léo Le Bouter <lle-bout <at> zaclys.net>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 44543 <at> debbugs.gnu.org,
 Mathieu Othacehe <othacehe <at> gnu.org>
Subject: Re: [bug#44543] [PATCH] gnu: raspberry-pi: Add helpers for config.txt
 file generation.
Date: Sat, 27 Mar 2021 23:03:15 +0100
Hi Léo!

> I would prefer if you opened one single bug with all the changes so I
> can test the whole thing, right now I don't feel at ease reviewing
> things like this.

I see. I’m doing little steps, sending patches for the parts which I think are ready.

> How can I be sure what you are submitting is the
> right abstraction for your future work?

True. In this case you only have the bootloader examples that I gave.

This patch is just a building block to generate some config.txt in a modular and comfortable way. There is a bootloader installer copying any listed file-like-object.

Who knows, in future there might be a TianoCore bootloader, then a similar patch might be required to provide a raspi-tianocore-bootloader-txt.

> Are you sure that abstraction
> will be right for your future patches?

Yes. There are basically three decisions to take for a Guix System: 32 or 64 bit, which device tree (depends on the linux kernel), which bootloader. Beyond this anything is a custom setting. 

> If anything needs to be changed
> I feel like one big patchset about Raspberry Pi 3B+ support will be
> easier to review (at least for me).

I see, this is not yet testable for you out of the box to boot a system.

What is testable right now is an incomplete bootloader. At least it is possible to inspect what files will be generated by this patch and copied into /boot. It must even be buildable for x86_64.

 (bootloader
   (bootloader-configuration
     (target "/boot")
     (bootloader
       (efi-bootloader-chain
         (list raspi-config-txt
               raspi-bcm27-dtb-txt
               raspi-u-boot-bootloader-txt)
         grub-efi-netboot-bootloader
         #:installer
          (chain-efi-bootloader-installer (install-grub-efi-netboot "efi/boot")))))


Bye

Stefan


P.S. If you change your mind and want to test that bootloader, then you should know that GRUB depends on qemu and unfortunately qemu is failing its test on aarch64 since some months. Then this patch may help you get going. 

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 2262aa6197..3732320df8 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -161,8 +161,9 @@
       (arguments
       `(;; FIXME: Disable tests on i686 to work around
         ;; <https://bugs.gnu.org/40527>.
-       #:tests? ,(or (%current-target-system)
-                     (not (string=? "i686-linux" (%current-system))))
+       #:tests? ,(and (not (target-aarch64?))
+                      (or (%current-target-system)
+                          (not (string=? "i686-linux" (%current-system)))))
  
         #:configure-flags (list "--enable-usb-redir" "--enable-opengl"
                                 "--enable-docs"






Reply sent to Stefan <stefan-guix <at> vodafonemail.de>:
You have taken responsibility. (Thu, 06 May 2021 21:13:02 GMT) Full text and rfc822 format available.

Notification sent to Stefan <stefan-guix <at> vodafonemail.de>:
bug acknowledged by developer. (Thu, 06 May 2021 21:13:02 GMT) Full text and rfc822 format available.

Message #43 received at 44543-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan <stefan-guix <at> vodafonemail.de>
To: 44543-done <at> debbugs.gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>,
 Léo Le Bouter <lle-bout <at> zaclys.net>,
 Mathieu Othacehe <othacehe <at> gnu.org>
Subject: Re: [bug#44543] [PATCH] gnu: raspberry-pi: Add helpers for config.txt
 file generation.
Date: Thu, 6 May 2021 23:12:20 +0200
Hi!

I’m closing this ticket. There will be a new patch series which will also contain this change.


Bye

Stefan



bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 04 Jun 2021 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 321 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.