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.
parent
b2fc209b2c
commit
814214c369
|
@ -175,10 +175,13 @@
|
||||||
(modules '((guix build utils)))
|
(modules '((guix build utils)))
|
||||||
(snippet
|
(snippet
|
||||||
'(begin
|
'(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.
|
;; Delete bundled code that we provide externally.
|
||||||
;; TODO: Unbundle SeaBIOS!
|
|
||||||
(for-each delete-file-recursively
|
(for-each delete-file-recursively
|
||||||
'("dtc" "meson"))))))
|
'("dtc" "meson" "roms/seabios"))))))
|
||||||
(outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs
|
(outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs
|
||||||
(build-system gnu-build-system)
|
(build-system gnu-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -189,15 +192,20 @@
|
||||||
(not (string=? "i686-linux" (%current-system))))
|
(not (string=? "i686-linux" (%current-system))))
|
||||||
#:configure-flags
|
#:configure-flags
|
||||||
#~(let ((gcc (search-input-file %build-inputs "/bin/gcc"))
|
#~(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))
|
(out #$output))
|
||||||
(list (string-append "--cc=" gcc)
|
(list (string-append "--cc=" gcc)
|
||||||
;; Some architectures insist on using HOST_CC.
|
;; Some architectures insist on using HOST_CC.
|
||||||
(string-append "--host-cc=" gcc)
|
(string-append "--host-cc=" gcc)
|
||||||
|
(string-append "--meson=" meson)
|
||||||
(string-append "--prefix=" out)
|
(string-append "--prefix=" out)
|
||||||
|
|
||||||
"--sysconfdir=/etc"
|
"--sysconfdir=/etc"
|
||||||
(string-append "--meson=" (search-input-file %build-inputs
|
|
||||||
"bin/meson"))
|
|
||||||
"--enable-fdt=system"
|
"--enable-fdt=system"
|
||||||
|
(string-append "--firmwarepath=" out "/share/qemu:"
|
||||||
|
(dirname seabios))
|
||||||
(string-append "--smbd=" out "/libexec/samba-wrapper")
|
(string-append "--smbd=" out "/libexec/samba-wrapper")
|
||||||
"--disable-debug-info" ;for space considerations
|
"--disable-debug-info" ;for space considerations
|
||||||
;; The binaries need to be linked against -lrt.
|
;; The binaries need to be linked against -lrt.
|
||||||
|
@ -211,6 +219,33 @@
|
||||||
,@%gnu-build-system-modules)
|
,@%gnu-build-system-modules)
|
||||||
#:phases
|
#:phases
|
||||||
#~(modify-phases %standard-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
|
(add-after 'unpack 'extend-test-time-outs
|
||||||
(lambda _
|
(lambda _
|
||||||
;; These tests can time out on heavily-loaded and/or slow storage.
|
;; These tests can time out on heavily-loaded and/or slow storage.
|
||||||
|
@ -277,17 +312,22 @@
|
||||||
(mkdir-p "b/qemu")
|
(mkdir-p "b/qemu")
|
||||||
(chdir "b/qemu")
|
(chdir "b/qemu")
|
||||||
(apply invoke "../../configure" configure-flags)))
|
(apply invoke "../../configure" configure-flags)))
|
||||||
|
|
||||||
;; Configure, build and install QEMU user-emulation static binaries.
|
;; Configure, build and install QEMU user-emulation static binaries.
|
||||||
(add-after 'configure 'configure-user-static
|
(add-after 'configure 'configure-user-static
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
(let* ((static (assoc-ref outputs "static"))
|
(let* ((static (assoc-ref outputs "static"))
|
||||||
(gcc (search-input-file inputs "/bin/gcc"))
|
(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
|
;; This is the common set of configure flags; it is
|
||||||
;; duplicated here to isolate this phase from manipulations
|
;; duplicated here to isolate this phase from manipulations
|
||||||
;; to the #:configure-flags build argument, as done in
|
;; to the #:configure-flags build argument, as done in
|
||||||
;; derived packages such as qemu-minimal.
|
;; derived packages such as qemu-minimal.
|
||||||
(configure-flags (list (string-append "--cc=" gcc)
|
(configure-flags (list (string-append "--cc=" gcc)
|
||||||
(string-append "--host-cc=" gcc)
|
(string-append "--host-cc=" gcc)
|
||||||
|
(string-append "--firmwarepath="
|
||||||
|
#$output "/share/qemu:"
|
||||||
|
(dirname seabios))
|
||||||
"--sysconfdir=/etc"
|
"--sysconfdir=/etc"
|
||||||
"--disable-debug-info")))
|
"--disable-debug-info")))
|
||||||
(mkdir-p "../user-static")
|
(mkdir-p "../user-static")
|
||||||
|
@ -313,6 +353,15 @@
|
||||||
(scandir "."
|
(scandir "."
|
||||||
(cut string-suffix?
|
(cut string-suffix?
|
||||||
"-linux-user" <>))))))))
|
"-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
|
;; 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
|
;; pulling it in as an input. Note that you need to explicitly install
|
||||||
;; Samba in your Guix profile for Samba support.
|
;; Samba in your Guix profile for Samba support.
|
||||||
|
@ -357,6 +406,7 @@ exec smbd $@")))
|
||||||
pixman
|
pixman
|
||||||
pulseaudio
|
pulseaudio
|
||||||
sdl2
|
sdl2
|
||||||
|
seabios
|
||||||
spice
|
spice
|
||||||
usbredir
|
usbredir
|
||||||
util-linux
|
util-linux
|
||||||
|
@ -367,13 +417,16 @@ exec smbd $@")))
|
||||||
zlib
|
zlib
|
||||||
`(,zstd "lib")))
|
`(,zstd "lib")))
|
||||||
(native-inputs
|
(native-inputs
|
||||||
(list gettext-minimal
|
;; Note: acpica is here only to pretty-print firmware differences with IASL
|
||||||
`(,glib "bin") ;gtester, etc.
|
;; (see the replace-firmwares phase above).
|
||||||
perl
|
(list acpica
|
||||||
flex
|
|
||||||
bison
|
bison
|
||||||
|
flex
|
||||||
|
gettext-minimal
|
||||||
|
`(,glib "bin") ;gtester, etc.
|
||||||
meson-0.63
|
meson-0.63
|
||||||
ninja
|
ninja
|
||||||
|
perl
|
||||||
pkg-config
|
pkg-config
|
||||||
python-wrapper
|
python-wrapper
|
||||||
python-sphinx
|
python-sphinx
|
||||||
|
|
Reference in New Issue