foxlet / macOS-Simple-KVM

Tools to set up a quick macOS VM in QEMU, accelerated by KVM.
13.6k stars 1.14k forks source link

Support for QNAP NAS #443

Open ZenonBrak opened 3 years ago

ZenonBrak commented 3 years ago

Is it possible to use macOS-Simple-KVM on QNAP NAS? If so, then someone could point me on how?

I could attach a sample XML for QNAP Virtualization Station to figure out what modifications are needed.

The current version of QTS 4.5.2.1630 uses QEMU emulator version 4.1.1 (v2.9.0-18460-g10049b1-dirty) and you can run it from /QVS/usr/bin/qemu-system-x86_64.

ZenonBrak commented 3 years ago

If someone's interested I was able to run macOS High Sierra on QNAP NAS headlessly with macOS-Simple-KVM.

Here is how: Install Entware-ng 0.97 from QNAP Club.

Login via ssh to NAS. Enter q and y to get a terminal.

Install git using opkg install git git-http.

Go to NAS drive using cd /share/.

Clone macOS-Simple-KVM repository using git clone https://github.com/foxlet/macOS-Simple-KVM.git.

Go to macOS-Simple-KVM using cd macOS-Simple-KVM.

Install python3 and nano using opkg install python3 python3-pip nano.

Edit headless.sh with nano using nano headless.sh. Add /QVS/usr/bin/ in front of qemu-system-x86_64 and save changes CTRL+x, y and Enter.

Then simply follow README.md to install desired macOS to run it headlessly.

I wonder if it's possible to run it using QNAP Virtualization Station having all obvious advantages. I tried to edit XML file myself, but without success. Machine doesn't start...

Sample XML:

<domain type='kvm'>
  <name>648447aa-f8de-4ad1-a546-f6487b0943fe</name>
  <uuid>648447aa-f8de-4ad1-a546-f6487b0943fe</uuid>
  <metadata xmlns:qvs="http://www.qnap.com/schemas/qvs/1.0">
    <qvs:vm>
      <qvs:os arch="x86" type="ubuntubionic"/>
      <qvs:name>macOS</qvs:name>
      <qvs:auto_start_delay enable="quo">0</qvs:auto_start_delay>
      <qvs:qvm enable="yes"/>
      <qvs:rollback>
        <qvs:device><video><model heads="1" ram="65536" type="qxl" vgamem="16384" vram="65536"/></video>

                          ich6
                          <graphics autoport="yes" keymap="en-us" listen="0.0.0.0" passwd="" port="-1" type="vnc"/><graphics autoport="yes" keymap="en-us" listen="0.0.0.0" passwd="" type="spice"><image compression="off"/><jpeg compression="never"/><zlib compression="never"/><playback compression="off"/><streaming mode="all"/></graphics>
                        </qvs:device>
      </qvs:rollback>
      <qvs:test enable="no"/>
      <qvs:mom reserved_memory="1048576">0</qvs:mom>
      <qvs:hdds>
        <qvs:hdd bus="ide" dev="hda" index="1" root="/share/VMs/macOS/macOS.img"/>
      </qvs:hdds>
      <qvs:cdroms>
        <qvs:cdrom bus="ide" dev="hdb" index="1"/>
      </qvs:cdroms>
      <qvs:nics>
        <qvs:nic bridge="qvs0" index="1" mac="52:54:00:f6:f8:fa" model="e1000"/>
      </qvs:nics>
      <qvs:usbs/>
      <qvs:serialports/>
      <qvs:meta_path>/share/VMs/macOS/.648447aa-f8de-4ad1-a546-f6487b0943fe.meta</qvs:meta_path>
      <qvs:host_cpu>Intel(R) Celeron(R) CPU  J1900</qvs:host_cpu>
      <qvs:nas_model>TS-X51</qvs:nas_model>
      <qvs:snapshot type="external"/>
      <qvs:graphics>
        <qvs:graphics autoport="yes" keymap="en-us" listen="0.0.0.0" passwd="" port="-1" type="vnc"/>
        <qvs:graphics autoport="yes" keymap="en-us" listen="0.0.0.0" passwd="" type="spice">
          <qvs:image compression="off"/>
          <qvs:jpeg compression="never"/>
          <qvs:zlib compression="never"/>
          <qvs:playback compression="off"/>
          <qvs:streaming mode="all"/>
        </qvs:graphics>
      </qvs:graphics>
      <qvs:videos>
        <qvs:video>
          <qvs:model heads="1" ram="65536" type="qxl" vgamem="16384" vram="65536"/>
        </qvs:video>
      </qvs:videos>
    </qvs:vm>
  </metadata>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type>
    <boot dev='cdrom'/>
    <boot dev='hd'/>
    <bootmenu enable='no'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <cpu mode='custom' match='exact' check='partial'>
    <model fallback='allow'>Nehalem</model>
    <topology sockets='1' cores='2' threads='1'/>
  </cpu>
  <clock offset='localtime'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/QVS/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/share/VMs/macOS/macOS.img' startupPolicy='optional'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source startupPolicy='optional'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:b6:18:f2'/>
      <source bridge='qvs0'/>
      <model type='e1000'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <channel type='unix'>
      <source mode='bind' path='/QVS/var/lib/libvirt/qemu/648447aa-f8de-4ad1-a546-f6487b0943fe.agent'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='en-us' passwd=''>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <graphics type='spice' autoport='yes' listen='0.0.0.0' keymap='en-us' passwd=''>
      <listen type='address' address='0.0.0.0'/>
      <image compression='off'/>
      <jpeg compression='never'/>
      <zlib compression='never'/>
      <playback compression='off'/>
      <streaming mode='all'/>
    </graphics>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </memballoon>
  </devices>
</domain>