Showing posts with label iot. Show all posts
Showing posts with label iot. Show all posts

2017/12/25

Windows 10 IoT Core on Raspberry Pi 3

Following up on my last post, finally got around to trying to install IoT Core on my actual Raspberry Pi device:

My development machine is a 15" Macbook Pro running OSX High Sierra (10.3.2).  Wasn't able to get a Windows 10 VM in VirtualBox to recognize the SD card slot in my adapter (the otherwise fantastic Satechi type-C multi-port adapater), so started looking for how to flash the image without using IoT Core Dashboard.

Image Preparation

Microsoft has some docs about using dism instead of Dashboard.  From the IoT Core download page you can obtain an iso file containing an msi that by default installs the image to:
 C:\Program Files (x86)\Microsoft IoT\FFU\RaspberryPi2\flash.ffu  

ffu2img (https://github.com/t0x0/random/wiki/ffu2img) can be used to convert the ffu to an img file usable with dd found on OSX (and Linux, etc.).

Ensure you're using Python 2.7 and convert the image:
 python ffu2img.py PATH/flash.ffu
Resulting in a flash.img file in the same location as the ffu.

Writing Image to SD Card

To write the image to an SD card I consulted the documentation at raspberrypi.org.

I had trouble getting those instructions to work with my card/reader.  No matter what, dd failed with "Operation not permitted".  In the end I had to:
  1. Insert card into reader and connect reader to laptop
  2. Without unmounting the SD card, run:
     sudo diskutil partitionDisk /dev/disk2 1 MBR "Free Space" "%noformat%" 100%  
    
  3. Disconnect then reconnect the reader (above command seemed to eject the SD card)
  4. Write the image:
     sudo dd bs=1m if=PATH/flash.img of=/dev/rdisk2 conv=sync
In my case, the SD card is /dev/disk2.  /dev/disk2 and /dev/rdisk2 in the above commands should be adjusted appropriately for other cases.

Using df can see several partitions were created (/dev/disk2s1, disk2s2, disk2s3, and disk2s6) on the SD card.  Once inserted in the Raspberry Pi device and powered on, IoT Core should boot.

IoT Core Setup

As it happens, I didn't have a USB keyboard on hand to get the device on the wifi.

Using an ethernet cable to connect the device directly to my laptop, I obtained the device's link-local address from the bottom-left of the touch screen.  The device's admin portal is now accessible by pointing my laptop browser at http://169.254.236.118:8080 (default username/password is Administrator/p@ssw0rd).

In the left panel, selecting Connectivity, then Network, you can configure the wifi AP:

Initially the display was upside-down (assuming the HDMI port is "up" as when using this touchscreen case).  To fix this, in the left panel pick Device Settings and towards the bottom in Display Orientation select "Landscape (Flipped)":

2017/11/18

Win 10 IoT Core

Recently been looking at using a Raspberry Pi 3 for a modestly work-related project.

Since the rest of our platform is running on Windows 10 IoT Enterprise (aka Windows 10 Enterprise LTSB), I thought I'd give IoT Core a look in the hopes that almost no porting would be required.  The hardware compatibility list deserves special mention here because there is far more RaspPi accessories available than are actually supported by Win10.

For various reasons I'm not going to have hardware for over a month, so I'm trying to give things a whirl via virtualbox.  This blog post seems to be referenced numerous places as the reference to get an x86/x64 ISO of IoT Core running in a VM.  But, between using some tool from the XNA developer forums and glossing over several details I started looking for other sources.

This post from a year and a half ago gave me another view as it goes over running IoT Core in VMWare.  It pointed me towards investigating VHD and dism.  A series of MS blogs also gave me a bit better understanding of their usage: this, this, and this.

What follows is what I did in the end to get things running.

Installation

Image Creation


Start by downloading IoT Core.  You want the ISO for MinnowBoard MAX or whatever else is x64.  Mount that and run the msi.  Some stuff is installed to c:\Program Files (x86)\Microsoft IoT\.

Next, need to create a VHD image:
  1. Launch Disk Management
  2. Action -> Create VHD
    • Enter a location for the file
    • Use 8 GB for "Virtual hard disk size"
    • I left everything else as default
  3. Note the name of the drive that was created (in my case it was "Disk 1")
Now copy the IoT Core ffu image to the VHD:

 C:\> dism /Apply-Image /Image-File:”C:\Program Files (x86)\Microsoft IoT\MinnowBoardMax_x64\flash.ffu” /ApplyDrive:\\.\PhysicalDrive1 /SkipPlatformCheck
Where PhysicalDriveN is the "Disk N"- the VHD.

Once it finishes writing, right-click the drive in Disk Management and select "Detach VHD".

VM Configuration


In VirtualBox (I'm using 5.1.26), create a new VM:
  • Version "Windows 10 (64-bit)"
  • Memory size 2048
  • "Use an existing virtual hard disk file" and browse to the VHD
After the VM is created, right-click it and select "Settings".  On the System tab check "Enable EFI (special OSes only)".

Start the VM and after brief startup you should be greeted with:
Sweet, sweet victory!

Detours

There were a few miss-steps along the way.

Despite every reference I found calling out the need to boot with EFI, I managed to overlook that by the time I finally got around to setting my VM up.  Should you do the same, on startup the VM will fail immediately:

 FATAL: No bootable medium found! System halted.  

After that, once I enabled EFI I was dropped into a UEFI shell:
Luckily, I stubbled upon the setup guide for the MinnowBoard MAX which provided the necessary hint.  Guessing that the first device listed was the correct device I tried:

 Shell> fs0:  
 fs0:> efi\boot\bootia32.efi  

Only, it wasn't there.  There was only an efi file for x64- it was trying to boot a 64-bit OS.  I'd followed the old blogs and picked "Windows 10 (32-bit)" when setting up the VM.  Nuking that VM and setting it up as "Windows 10 (64-bit)" like in the instructions above did the trick.

Astute readers might have noticed my host OS is OSX.  The Windows 10 portions were also done within the confines of VirtualBox.