2015-06-29 22:41

Installing Windows 10 IoT on a Raspberry Pi 2 without a Windows computer

Yes, I had to try it.

Not very useful though, as the IoT install is just a base for putting apps on. No browser etc. You'll need a Windows machine and Visual Studio to do anything useful.

But.. this is how I did it:

I reused an old micro SD card, put it into my card reader. Ubuntu auto-mounted and opened up the old partitions in the file browser automatically. You should NOT use the unmount button in the graphical file browser to unmount them as this also disables the card by doing a size change of the device to 0 size. You can not copy to the card if this is done.

But instead check the last couple of lines in "dmesg". On my machine:

moggen@moggen-pc:~$ dmesg

... a lot of lines outputted ...

[   47.100287] sd 6:0:0:2: [sdd] 31356928 512-byte logical blocks: (16.0 GB/14.9 GiB)
[   47.101789] sd 6:0:0:2: [sdd] No Caching mode page found
[   47.101790] sd 6:0:0:2: [sdd] Assuming drive cache: write through
[   47.104054] sd 6:0:0:2: [sdd] No Caching mode page found
[   47.104055] sd 6:0:0:2: [sdd] Assuming drive cache: write through
[   47.105341]  sdd: sdd1 sdd2
[   47.340525] FAT-fs (sdd1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[   47.383595] systemd-hostnamed[3650]: Warning: nss-myhostname is not installed. Changing the local hostname
might make it unresolveable. Please install nss-myhostname!
[   48.607431] EXT4-fs (sdd2): recovery complete
[   48.612857] EXT4-fs (sdd2): mounted filesystem with ordered data mode. Opts: (null)

I can see that /dev/sdd is my SD card. I unmounted the partitions manually:

moggen@moggen-pc:~$ sudo umount /dev/sdd1
moggen@moggen-pc:~$ sudo umount /dev/sdd2

Now the card is ready. You need of course the Windows 10 IoT ISO image. Get it via this page http://ms-iot.github.io/content/en-US/Downloads.htm Get the "Windows 10 IoT Core for Raspberry Pi 2" image, click Download. The current file is about 508 MB (when this is written).

You need to install the excellent 7-Zip software on your Ubuntu machine. Run this if you don't have it already:

moggen@moggen-pc:~$ sudo apt-get install p7zip-full

Make a temporary directory somewhere and put the downloaded ISO file in it.

moggen@moggen-pc:~$ cd Downloads/
moggen@moggen-pc:~/Downloads$ mkdir temp
moggen@moggen-pc:~/Downloads$ mv IOT\ Core\ RPi.ISO temp/

Unpack the ISO with 7z:

moggen@moggen-pc:~/Downloads$ cd temp
moggen@moggen-pc:~/Downloads/temp$ 7z x IOT\ Core\ RPi.ISO 

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

Processing archive: IOT Core RPi.ISO

Extracting  Windows_10_IoT_Core_RPi2.msi

Everything is Ok

Size:       532140032
Compressed: 532776960

Unpack the MSI with 7z:

moggen@moggen-pc:~/Downloads/temp$ 7z x Windows_10_IoT_Core_RPi2.msi 

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

Processing archive: Windows_10_IoT_Core_RPi2.msi

Extracting  DISM_api_ms_win_core_apiquery_l1_1_0.dll
Extracting  DISM_api_ms_win_downlevel_advapi32_l1_1_0.dll

... more files ...

Everything is Ok

Files: 28
Size:       1235566696
Compressed: 532140032

Among the files extracted there is a big file called: File_WindowsIoTRpi2Flash.ffu. This is the file we are interested in.

The FFU format is a special image file that Microsoft uses and contains checksums and other useful stuff. But we want a raw image to put directly on the SD card without having to use the DISM tools on a Windows machine. Luckily T0x0 has made a converter in Python: https://github.com/t0x0/random/wiki/ffu2img.

Get the script with wget:

moggen@moggen-pc:~/Downloads/temp$ wget https://raw.githubusercontent.com/t0x0/random/master/ffu2img.py
--2015-06-29 22:03:19--  https://raw.githubusercontent.com/t0x0/random/master/ffu2img.py
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 23.235.43.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|23.235.43.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6243 (6,1K) [text/plain]
Saving to: ‘ffu2img.py’

100%[======================================>] 6 243       --.-K/s   in 0s      

2015-06-29 22:03:19 (614 MB/s) - ‘ffu2img.py’ saved [6243/6243]

Run the script to generate a raw image from the FFU file:

moggen@moggen-pc:~/Downloads/temp$ python ffu2img.py File_WindowsIoTRpi2Flash.ffu img.raw
Input File: File_WindowsIoTRpi2Flash.ffu
Output File: img.raw
Block data entries begin: 0x800f8
Block data entries end: 0xa4c98
Block data chunks begin: 0xc0000
9401 blocks, 1203328kb written - Delay expected. Please wait.  
Write complete.

Use DD to put the image on the SD card. IMPORTANT: use the device you found with dmesg above. You can wipe your linux system if you use the wrong device with this command! ADJUST this command to use the device of the SD card on YOUR machine!!

moggen@moggen-pc:~/Downloads/temp$ sudo dd if=img.raw of=/dev/sdd bs=1M
7372+1 records in
7372+1 records out
7730495488 bytes (7,7 GB) copied, 601,936 s, 12,8 MB/s

This took about 10 minutes on my system and my micro SD card (a Transcend Ultimate 600x, 16GB). It may be faster or slower on your setup.

Assure that all bits and bytes are actually written to the card before removing it

moggen@moggen-pc:~/Downloads/temp$ sync

Now, remove the card from your reader, put it in a RPi2 and power it up!