guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#44543] [PATCH] gnu: raspberry-pi: Add helpers for config.txt file g


From: Stefan
Subject: [bug#44543] [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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]