Coding with Titans

so breaking things happens constantly, but never on purpose

Windows IoT the wrong way

Few days ago I ordered Raspberry Pi 2 and unboxed it just today. After a lecture of few videos on Channel9 about Microsoft //Build/ 2015 I was very excited and wanted to test the latest Windows 10 for IoT myself. Then I simply hit obstacle after obstacle and wasted more than 10 hours of my life to simply get the image written on microSD card. That was a real nightmare, but maybe because I am not a typical Windows user. Please treat the rest of this post as a warning and also as a guide to make the whole process straight to the point.

Before I start painting everything with my grief, compare, how easy it is to use Raspbian. 4 steps:

  1. download an OS image (without signing anything)

  2. download a burning tool, that doesn’t need installation and works on any version of Windows

  3. burn the image on an microSD card using your favorite card-reader

  4. put the card into Raspberry and and power it on!

10 minutes and you are ready to write your programs.

Now let’s install Windows 10 IoT and see, if the Universal Windows Platform is really as awesome as they say. There is a step-by-step guide on the IoT project website. I also found a nice post on Scott Hanselman’s blog, but they both seemed to skip a few quite important details. Let me bring them to light.

  1. Yes, here it’s also required to download the image (.ffu), but to get it, you need to sign into Microsoft beta-testers program. The same time, you claim not to reveal any bugs etc., found during the usage of the software. OK, this approach I understand.

  2. & 3) But what about the other actions? How to put the image on microSD card?

What you need: 1. Windows 10 Insider Preview - must be a physical Windows machine (not a VM).

Shocking, but true. You need to have a preview version of the desktop OS installed on physical hardware, to actually be able to burn image for Raspberry Pi 2. Confirmed, I tried to create it from a Hyper-V virtual machine and failed to do so. Hyper-V used to access host plugged-in USB card-reader can’t make it at enough low level to perform the image writing. Still I was forced to install 20GB OS to simply use a small command-line utility program that will prepare the microSD card. It really sounds ridiculously and the person, who had this idea at Microsoft should be promoted ;) Couldn’t the utility be ported back to Windows 8.1 and occupy 2MB?

Well, installation of Windows 10 (version 10074) and using it on Hyper-V at least gave me an idea, how the new OS will look and work like. It was fairly OK. However it setup my mind with a sentence – ‘do not install it yet on any of PCs that are used to make money!’. That eliminated my 3 quite new and powerful machines.

UPDATED: version 10130 is much stable and pleasant to work. Although I prefer to use it via Hyper-V (and remote desktop) than on a physical old hardware as described below, which is much slower than i7 with 32GB of RAM and SSD.

The one that left was a Pentium IV 4GHz Prescott from 2005 I suppose.  With Windows XP on-baord it was a nice testing machine. It turned out it can’t be easily upgraded to Windows 10 Preview as this is the last processor, which doesn’t support NX instruction set and causes 0x000000005D failure during installation. Thankfully I found this video explaining, how to overcome this issue. As a result I ended up with a machine with Hyper Threading disabled, enabled legacy USB support in BIOS, modified kernel, which required starting Windows in safe-mode after each reboot and had digital signatures integrity checks disabled. At least it had 2GB of RAM to start! Running on regular HDD was killing any performance the machine had, but I though I was so close the goal. Then I could simply format it as soon as the microSD card is flashed and forget.

So close is sometimes far enough. Execution of flashing:

dism.exe /Apply-Image /ImageFile:flash.ffu /ApplyDrive:\.\PhysicalDriveN /SkipPlatformCheck

(N is a drive number assigned to card reader)

finished with magic “error 1168”. Turned out external card readers are not supported! If I had a build-in one, like when using Surface Pro or other tablet, I wouldn’t have problem like that. Once again Internet helped me with this forum thread. Komarov (whoever he is) found the root cause and explained, how to edit another system library with hex editor.

You can patch x86 version of FfuProvider.dll with HEX editor.

File offset 0x7312, replace B8 90 04 07 80 with B8 00 00 00 00 (valid for 10074 and 10075)

Job done. Image written.

  1. After longer fist boot, Raspberry Pi 2 is now able to run Windows 10 IoT. That’s just great.

I still believe Microsoft won’t leave it that way and will simplify the whole process and this was just hard-core for beta testers.

On the other hand – lesson learned – buy the cheapest Windows 8.1 tablet, which is most probably faster and better supported than 10-years old PC!