add static supported machines file

Same rationale as the CPU flags file, avoids calling QEMU binary just to
query machine types.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
master
Stefan Reiter 2021-03-04 13:52:03 +01:00 committed by Thomas Lamprecht
parent 2413972b46
commit a6ede89808
2 changed files with 24 additions and 1 deletions

21
debian/parse-machines.pl vendored Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/perl
use warnings;
use strict;
my @machines = ();
while (<STDIN>) {
if (/^\s*Supported machines are:/) {
next;
}
s/^\s+//;
my @machine = split(/\s+/);
next if $machine[0] !~ m/^pc-(i440fx|q35)/;
push @machines, $machine[0];
}
die "no QEMU machine types detected from STDIN input" if scalar (@machines) <= 0;
print join("\n", @machines) or die "$!\n";

4
debian/rules vendored
View File

@ -22,6 +22,7 @@ PACKAGE=pve-qemu-kvm
destdir := $(CURDIR)/debian/$(PACKAGE)
flagfile := $(destdir)/usr/share/kvm/recognized-CPUID-flags-x86_64
machinefile := $(destdir)/usr/share/kvm/machine-versions-x86_64
# default QEMU out-of-tree build directory is ./build
BUILDDIR=build
@ -124,7 +125,7 @@ install: build
rm $(destdir)/usr/share/kvm/qemu_vga.ndrv
rm $(destdir)/usr/share/kvm/slof.bin
rm $(destdir)/usr/share/kvm/u-boot.e500
# remove Aplha files
# remove Alpha files
rm $(destdir)/usr/share/kvm/palcode-clipper
# remove RISC-V files
rm $(destdir)/usr/share/kvm/opensbi-riscv32-generic-fw_dynamic.elf
@ -138,6 +139,7 @@ install: build
# CPU flags are static for QEMU version, allows avoiding more costly checks
$(destdir)/usr/bin/qemu-system-x86_64 -cpu help | ./debian/parse-cpu-flags.pl > $(flagfile)
$(destdir)/usr/bin/qemu-system-x86_64 -machine help | ./debian/parse-machines.pl > $(machinefile)
# Build architecture-independent files here.
binary-indep: build install