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: Mon, 16 Nov 2020 11:38:19 +0100	[thread overview]
Message-ID: <6C52CE60-8585-4FC4-BCBC-B901CB75B35F@vodafonemail.de> (raw)
In-Reply-To: <20201116103231.2c151d33@scratchpost.org>

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





  reply	other threads:[~2020-11-16 10:39 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 [this message]
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

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=6C52CE60-8585-4FC4-BCBC-B901CB75B35F@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).