Note: Content of this article is outdated and no longer valid.
How to develop windows phone 10 applications while using Linux as main OS? One answer is to take advantage of nested virtualization and run Windows guest on kvm virtualizor. This is how I managed to get the environment up and running on Intel I5 based laptop with Fedora 23.
My laptop included license for windows 8.1, so process should be as easy as installing windows 8.1 as virtual machine, then upgrade it to windows 10, but in real life there are some small issues on the way.
Windows 8.1 installation
First step is to dig out the product key from BIOS, and the magic happens by typing:
sudo xxd /sys/firmware/acpi/tables/MSDM
now just take a note of the key you have revealed. Sadly getting legal windows ISO file is not just as easy. You can download regular/pro version of Windows 8.1 install image from Microsofts site, but you need to use their download manager, which needs windows to run. It might work with wine, but personally I didn't get it to run. Here's the link to the download:
On the site click "Create Media" link, download and run the exe. Select the version you have the key for and select "create ISO" options. When the operation is done, upload the ISO file back to Linux machine.
Now that you have the installation file, create virtual machine using "virt-manager" . Windows 8.1 with Visual studio 2015 & WP SDK takes about 35GB, so I suggest that you create drive with size of 60GB or more. Rest of the process is a walk in the park.
Upgrading windows 8.1 to windows 10
Upgrading process should be as easy as installing all updates,but with kvm there's a small speed bumb.. After you have installed all updates include windows 10 update, do not reboot. Shutdown the machine, go to virtual machines processor tab and change the cpu to: core2duo . Without this change, your guest machine will most likely just end up in black screen. For more help, see this ubuntu thread.
Enable nested virtualization:
To see, if your Linux has nested virtualization enabled, type:
the above command should say "Y". If not, you need to add kernel parameter "kvm-intel.nested=1" to file /etc/default/grub . Line you want to add the parameter to begins with: "GRUB_CMDLINE_LINUX=". After you have added line, create new grub config with command:
grub2-mkconfig -o /boot/grub2/grub.cfg
and reboot. Then (hopefully) the output of first commands changes from N to Y. Now you can navigate to virtual machines processor tab and type "host-passthrough" to model field, that way windows should be able to use Hyper-V to run phone emulator.
And this is the place things get stuck.. It seems that kvm virtualization currently can't handle nested hyper-v properly, so we'll just have to wait and see.. More info about the issue on this kvm mailinglist.
Edit (29.12.2015): Kernel 4.4 promises better support for nested virtualization, but the problem hasn't gone away.. At least not with 4.4-rc6 kernel from Fedora rawhide.
Edit (29.1.2016): Seems that kernel 4.5-rc1 doesn't fix this problem either. According to this article nested hyper-v is possible on windows server 2016, so there's still hope :)
Edit (8.7.2016): Haven't tried this in a while, but according to this latest thread on kvm mailinglist the process will keep on failing :(