guix-commits
[Top][All Lists]
Advanced

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

06/08: gnu: seabios: Build vgabios targets.


From: guix-commits
Subject: 06/08: gnu: seabios: Build vgabios targets.
Date: Wed, 22 Dec 2021 21:15:19 -0500 (EST)

mbakke pushed a commit to branch master
in repository guix.

commit 57f011818e005a5b1881d87834654e5f77407b55
Author: Marius Bakke <marius@gnu.org>
AuthorDate: Sat Dec 18 23:38:16 2021 +0100

    gnu: seabios: Build vgabios targets.
    
    * gnu/packages/firmware.scm (seabios)[arguments]: Add new phase to build
    various vgabiosen.  While at it, create a "bios-256k.bin" as expected by
    QEMU.
---
 gnu/packages/firmware.scm | 44 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 13e33af..c204014 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -296,6 +296,8 @@ for platform-specific firmwares executing in M-mode.")
     (arguments
      `(#:tests? #f                      ; no check target
        #:make-flags '("EXTRAVERSION=-guix") ;upstream wants distros to set this
+       #:modules (,@%gnu-build-system-modules
+                  (ice-9 match))
        #:phases
        (modify-phases %standard-phases
          (replace 'configure
@@ -307,12 +309,52 @@ for platform-specific firmwares executing in M-mode.")
                (lambda (port)
                  (format port ,(package-version this-package))))
              (setenv "CC" "gcc")))
+         (add-after 'build 'build-vgabios
+           (lambda* (#:key (make-flags ''()) #:allow-other-keys)
+             (for-each
+              (match-lambda
+                ((target . config)
+                 (let* ((dot-config (string-append (getcwd) "/" target 
"/.config"))
+                        (flags (append make-flags
+                                      (list (string-append "KCONFIG_CONFIG="
+                                                           dot-config)
+                                            (string-append "OUT=" target 
"/")))))
+                   (mkdir target)
+                   (call-with-output-file dot-config
+                     (lambda (port)
+                       (for-each (lambda (entry)
+                                   (if (string-suffix? "=n" entry)
+                                       (format port "# CONFIG_~a is not set~%"
+                                               (string-drop-right entry 2))
+                                       (format port "CONFIG_~a~%" entry)))
+                                 (cons "BUILD_VGABIOS=y" config))))
+                   (apply invoke "make" (append flags '("oldnoconfig")))
+                   (apply invoke "make" flags)
+                   (link (string-append target "/bios.bin")
+                         (string-append "out/" target ".bin")))))
+              ;; These tuples are modelled after Debians packaging:
+              ;; 
https://salsa.debian.org/qemu-team/seabios/-/blob/master/debian/rules
+              '(("ati"    . ("VGA_ATI=y" "VGA_PCI=y"))
+                ("bochs-display" . ("DISPLAY_BOCHS=y" "VGA_PCI=y"))
+                ("cirrus" . ("VGA_CIRRUS=y" "VGA_PCI=y"))
+                ("stdvga" . ("VGA_BOCHS=y" "VGA_PCI=y"))
+                ("virtio" . ("VGA_BOCHS_VIRTIO=y" "VGA_PCI=y"))
+                ("vmware" . ("VGA_BOCHS_VMWARE=y" "VGA_PCI=y"))
+                ("qxl"    . ("VGA_BOCHS_QXL=y" "VGA_PCI=y"))
+                ("isavga" . ("VGA_BOCHS=y" "VGA_PCI=n"))
+                ("ramfb"  . ("VGA_RAMFB=y" "VGA_PCI=n"))))))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (fmw (string-append out "/share/firmware")))
                (mkdir-p fmw)
-               (copy-file "out/bios.bin" (string-append fmw "/bios.bin"))))))))
+               (copy-file "out/bios.bin" (string-append fmw "/bios.bin"))
+               (for-each (lambda (bios)
+                           (install-file bios fmw))
+                         (find-files "out" "\\.bin$"))
+               (with-directory-excursion fmw
+                 ;; QEMU 1.7 and later looks only for the latter.
+                 (symlink "bios.bin" "bios-256k.bin"))))))))
     (home-page "https://www.seabios.org/SeaBIOS";)
     (synopsis "x86 BIOS implementation")
     (description "SeaBIOS is an implementation of a 16bit x86 BIOS.  SeaBIOS



reply via email to

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