1
0
Fork 0
mirror of https://github.com/foxlet/macOS-Simple-KVM.git synced 2024-11-30 15:09:42 +01:00

Name with version, copy template, allow nested virtualization

This commit is contained in:
Kowalski Prime 2020-05-03 19:08:20 +02:00
parent 5924de1e05
commit bc47ea3cf4
No known key found for this signature in database
GPG key ID: C4E819BD2BC6233E
3 changed files with 24 additions and 17 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ BaseSystem.img
BaseSystem.dmg BaseSystem.dmg
BaseSystem.chunklist BaseSystem.chunklist
template.xml template.xml
version

15
make.sh
View file

@ -26,8 +26,12 @@ error() {
} }
generate(){ generate(){
NAME="macOS"
if [[ -e version ]]; then
NAME="$NAME $(cat version)"
fi
UUID=$( cat /proc/sys/kernel/random/uuid ) UUID=$( cat /proc/sys/kernel/random/uuid )
sed -e "s|BOXESHOME|$BOXES_HOME|g" -e "s|QEMUHOME|$QEMU_HOME|g" -e "s|UUID|$UUID|g" -e "s|MACHINE|$MACHINE|g" -e "s|MACHINE|$MACHINE|g" tools/template.xml.in > $OUT sed -e "s|BOXESHOME|$BOXES_HOME|g" -e "s|MACOSNAME|$NAME|g" -e "s|BOXESHOME|$BOXES_HOME|g" -e "s|QEMUHOME|$QEMU_HOME|g" -e "s|UUID|$UUID|g" -e "s|MACHINE|$MACHINE|g" -e "s|MACHINE|$MACHINE|g" tools/template.xml.in > $OUT
echo "$OUT has been generated in $VMDIR" echo "$OUT has been generated in $VMDIR"
} }
@ -41,11 +45,12 @@ install(){
cp -Zfu BaseSystem.img $BOXES_HOME cp -Zfu BaseSystem.img $BOXES_HOME
cp -Zfu ESP.qcow2 $BOXES_HOME cp -Zfu ESP.qcow2 $BOXES_HOME
echo Coping OVMF_CODE.fd in $QEMU_HOME/firmware/ echo Coping OVMF_CODE.fd in $QEMU_HOME/firmware/
cp firmware/OVMF_CODE.fd $QEMU_HOME/firmware/ cp -Zfu firmware/OVMF_CODE.fd $QEMU_HOME/firmware/
echo Coping OVMF_CODE.fd in $QEMU_HOME/nvram/ echo Coping OVMF_CODE.fd in $QEMU_HOME/nvram/
cp firmware/OVMF_VARS-1024x768.fd $QEMU_HOME/nvram/ cp -Zfu firmware/OVMF_VARS-1024x768.fd $QEMU_HOME/nvram/
echo Adding template.xml to GNOME Boxes domain echo Copy template.xml to $QEMU_HOME
virsh -c qemu:///session define $OUT cp -Zfu template.xml $QEMU_HOME/macOS-Simple-KVM.xml
virsh -c qemu:///session define $QEMU_HOME/macOS-Simple-KVM.xml
} }
generate generate

View file

@ -1,7 +1,7 @@
<domain type="kvm" xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0"> <domain type="kvm" xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">
<name>macOS-Simple-KVM</name> <name>macOS-Simple-KVM</name>
<uuid>UUID</uuid> <uuid>UUID</uuid>
<title>macOS</title> <title>MACOSNAME</title>
<memory unit="KiB">4194304</memory> <memory unit="KiB">4194304</memory>
<currentMemory unit="KiB">4194304</currentMemory> <currentMemory unit="KiB">4194304</currentMemory>
<vcpu placement="static">4</vcpu> <vcpu placement="static">4</vcpu>
@ -34,7 +34,7 @@
<devices> <devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator> <emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk"> <disk type="file" device="disk">
<driver name="qemu" type="qcow2" /> <driver name="qemu" type="qcow2" cache="writeback" io="threads" />
<source file="BOXESHOME/ESP.qcow2" /> <source file="BOXESHOME/ESP.qcow2" />
<target dev="sda" bus="sata" /> <target dev="sda" bus="sata" />
<address type="drive" controller="0" bus="0" target="0" unit="0" /> <address type="drive" controller="0" bus="0" target="0" unit="0" />
@ -46,7 +46,7 @@
<address type="drive" controller="0" bus="0" target="0" unit="1" /> <address type="drive" controller="0" bus="0" target="0" unit="1" />
</disk> </disk>
<disk type="file" device="disk"> <disk type="file" device="disk">
<driver name="qemu" type="raw" /> <driver name="qemu" type="qcow2" cache="writeback" io="threads" />
<source file="BOXESHOME/macOS.qcow2" /> <source file="BOXESHOME/macOS.qcow2" />
<target dev="sdc" bus="sata" /> <target dev="sdc" bus="sata" />
<address type="drive" controller="0" bus="0" target="0" unit="2" /> <address type="drive" controller="0" bus="0" target="0" unit="2" />
@ -83,21 +83,22 @@
<target type="serial" port="0" /> <target type="serial" port="0" />
</console> </console>
<input type="tablet" bus="usb"> <input type="tablet" bus="usb">
<address type="usb" bus="0" port="1"/> <address type="usb" bus="0" port="1" />
</input> </input>
<input type="keyboard" bus="usb"> <input type="keyboard" bus="usb">
<address type="usb" bus="0" port="2" /> <address type="usb" bus="0" port="2" />
</input> </input>
<graphics type="spice" autoport="yes"> <graphics type="spice">
<listen type="address" /> <listen type="none" />
<image compression="off" /> <image compression="off" />
<gl enable="no" />
</graphics> </graphics>
<sound model="ich9"> <sound model="ich9">
<address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0" /> <address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0" />
</sound> </sound>
<video> <video>
<model type="vga" vram="131072" heads="1" primary="yes"/> <model type="vga" vram="131072" heads="1" primary="yes" />
<address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/> <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0" />
</video> </video>
<redirdev bus="usb" type="spicevmc"> <redirdev bus="usb" type="spicevmc">
<address type="usb" bus="0" port="3" /> <address type="usb" bus="0" port="3" />
@ -107,10 +108,10 @@
</redirdev> </redirdev>
<memballoon model="none" /> <memballoon model="none" />
</devices> </devices>
<seclabel type="dynamic" model="selinux" relabel="yes"/> <seclabel type="dynamic" model="selinux" relabel="yes" />
<qemu:commandline> <qemu:commandline>
<qemu:arg value="-cpu" /> <qemu:arg value="-cpu" />
<qemu:arg value="Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check" /> <qemu:arg value="Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,vmx=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check" />
<qemu:arg value="-device" /> <qemu:arg value="-device" />
<qemu:arg value="isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" /> <qemu:arg value="isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" />
<qemu:arg value="-smbios" /> <qemu:arg value="-smbios" />