diff options
author | Marius Bakke <marius@gnu.org> | 2022-12-17 23:26:09 +0100 |
---|---|---|
committer | Efraim Flashner <efraim@flashner.co.il> | 2022-12-21 17:33:25 +0200 |
commit | 70d9a3171792ce1c409ba86398fd23c84d5c95ac (patch) | |
tree | 9b421b966c46be85d13f8f61607f52abd4dd67fb /gnu | |
parent | 228db28165dcde2a11d3f98c96935b65098eecc6 (diff) | |
download | guix-70d9a3171792ce1c409ba86398fd23c84d5c95ac.tar guix-70d9a3171792ce1c409ba86398fd23c84d5c95ac.tar.gz |
gnu: QEMU: Unbundle SeaBIOS.
* gnu/packages/virtualization.scm (qemu)[source](snippet): Delete SeaBIOS
ROMs and source code.
[arguments]: Add replace-firmwares and delete-firmwares phases.
[inputs]: Add SEABIOS.
[native-inputs]: Add ACPICA. While here, sort inputs.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/packages/virtualization.scm | 69 |
1 files changed, 61 insertions, 8 deletions
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index 6890f13233..d0f5fd5af4 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm @@ -175,10 +175,13 @@ (modules '((guix build utils))) (snippet '(begin + ;; TODO: Scrub all firmwares from this directory! + (with-directory-excursion "pc-bios" + ;; Delete firmwares provided by SeaBIOS. + (for-each delete-file (find-files "." "^(bios|vgabios).*\\.bin$"))) ;; Delete bundled code that we provide externally. - ;; TODO: Unbundle SeaBIOS! (for-each delete-file-recursively - '("dtc" "meson")))))) + '("dtc" "meson" "roms/seabios")))))) (outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs (build-system gnu-build-system) (arguments @@ -189,15 +192,20 @@ (not (string=? "i686-linux" (%current-system)))) #:configure-flags #~(let ((gcc (search-input-file %build-inputs "/bin/gcc")) + (meson (search-input-file %build-inputs "bin/meson")) + (seabios (search-input-file %build-inputs + "share/firmware/bios.bin")) (out #$output)) (list (string-append "--cc=" gcc) ;; Some architectures insist on using HOST_CC. (string-append "--host-cc=" gcc) + (string-append "--meson=" meson) (string-append "--prefix=" out) + "--sysconfdir=/etc" - (string-append "--meson=" (search-input-file %build-inputs - "bin/meson")) "--enable-fdt=system" + (string-append "--firmwarepath=" out "/share/qemu:" + (dirname seabios)) (string-append "--smbd=" out "/libexec/samba-wrapper") "--disable-debug-info" ;for space considerations ;; The binaries need to be linked against -lrt. @@ -211,6 +219,33 @@ ,@%gnu-build-system-modules) #:phases #~(modify-phases %standard-phases + ;; Since we removed the bundled firmwares above, many tests + ;; can't work. Re-add them here. + (add-after 'unpack 'replace-firmwares + (lambda* (#:key inputs #:allow-other-keys) + (let* ((seabios (dirname (search-input-file + inputs "share/firmware/bios.bin"))) + (seabios-firmwares (find-files seabios "\\.bin$")) + (allowed-differences + ;; Ignore minor differences (addresses etc) in the firmware + ;; data tables compared to what the test suite expects. + '("tests/data/acpi/pc/SSDT.dimmpxm" + "tests/data/acpi/pc/DSDT.dimmpxm" + "tests/data/acpi/pc/ERST.acpierst" + "tests/data/acpi/q35/ERST.acpierst" + "tests/data/acpi/q35/DSDT.cxl")) + (allowed-differences-whitelist + (open-file "tests/qtest/bios-tables-test-allowed-diff.h" + "a"))) + (with-directory-excursion "pc-bios" + (for-each (lambda (file) + (symlink file (basename file))) + seabios-firmwares)) + (for-each (lambda (file) + (format allowed-differences-whitelist + "\"~a\",~%" file)) + allowed-differences) + (close-port allowed-differences-whitelist)))) (add-after 'unpack 'extend-test-time-outs (lambda _ ;; These tests can time out on heavily-loaded and/or slow storage. @@ -277,17 +312,22 @@ (mkdir-p "b/qemu") (chdir "b/qemu") (apply invoke "../../configure" configure-flags))) + ;; Configure, build and install QEMU user-emulation static binaries. (add-after 'configure 'configure-user-static (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((static (assoc-ref outputs "static")) (gcc (search-input-file inputs "/bin/gcc")) + (seabios (search-input-file inputs "/share/firmware/bios.bin")) ;; This is the common set of configure flags; it is ;; duplicated here to isolate this phase from manipulations ;; to the #:configure-flags build argument, as done in ;; derived packages such as qemu-minimal. (configure-flags (list (string-append "--cc=" gcc) (string-append "--host-cc=" gcc) + (string-append "--firmwarepath=" + #$output "/share/qemu:" + (dirname seabios)) "--sysconfdir=/etc" "--disable-debug-info"))) (mkdir-p "../user-static") @@ -313,6 +353,15 @@ (scandir "." (cut string-suffix? "-linux-user" <>)))))))) + + (add-after 'install 'delete-firmwares + (lambda _ + ;; Delete firmares that are accessible on --firmwarepath. + ;; For some reason tests fail if we simply remove them from + ;; pc-bios/meson.build, hence this roundabout way. + (with-directory-excursion (string-append #$output "/share/qemu") + (for-each delete-file + (find-files "." "^(vga)?bios(-[a-z0-9-]+)?\\.bin$"))))) ;; Create a wrapper for Samba. This allows QEMU to use Samba without ;; pulling it in as an input. Note that you need to explicitly install ;; Samba in your Guix profile for Samba support. @@ -357,6 +406,7 @@ exec smbd $@"))) pixman pulseaudio sdl2 + seabios spice usbredir util-linux @@ -367,13 +417,16 @@ exec smbd $@"))) zlib `(,zstd "lib"))) (native-inputs - (list gettext-minimal - `(,glib "bin") ;gtester, etc. - perl - flex + ;; Note: acpica is here only to pretty-print firmware differences with IASL + ;; (see the replace-firmwares phase above). + (list acpica bison + flex + gettext-minimal + `(,glib "bin") ;gtester, etc. meson-0.63 ninja + perl pkg-config python-wrapper python-sphinx |