Skip to content

Commit 1429996

Browse files
gedfoxlet
authored andcommitted
[TOOLS] Dynamically replace machine type with highest supported QEMU version.
1 parent 20d8871 commit 1429996

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

make.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# by Foxlet <foxlet@furcode.co>
55

66
VMDIR=$PWD
7+
MACHINE=$(qemu-system-x86_64 --machine help | grep q35 | cut -d" " -f1 | egrep -oe ".*-[0-9.]+" | sort -rV | head -1)
78
OUT="template.xml"
89

910
print_usage() {
@@ -20,7 +21,7 @@ error() {
2021
}
2122

2223
generate(){
23-
sed -e "s|VMDIR|$VMDIR|g" tools/template.xml.in > $OUT
24+
sed -e "s|VMDIR|$VMDIR|g" -e "s|MACHINE|$MACHINE|g" tools/template.xml.in > $OUT
2425
echo "$OUT has been generated in $VMDIR"
2526
}
2627

tools/template.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<currentMemory unit='KiB'>2097152</currentMemory>
66
<vcpu placement='static'>4</vcpu>
77
<os>
8-
<type arch='x86_64' machine='pc-q35-3.0'>hvm</type>
8+
<type arch='x86_64' machine='MACHINE'>hvm</type>
99
<loader readonly='yes' type='pflash'>VMDIR/firmware/OVMF_CODE.fd</loader>
1010
<nvram>VMDIR/firmware/OVMF_VARS-1024x768.fd</nvram>
1111
<boot dev='hd'/>

0 commit comments

Comments
 (0)