November 18, 2016

Intel Galileo - Gen 2 - Firmware Update

The "standard advice" is to update the firmware immediately after receiving the board. I suppose these boards all get the latest firmware at the time they are assembled, then sit in one warehouse or other for an unknown period. At this time version 1.0.4 of the firmware is available.

I work from a linux system. The game should be to connect the Galileo to power and let it boot, then connect it to my linux machine via USB. Linux should see it as /dev/ttyACM0 or some such. Then I fire up the updater software, give it the proper serial device name and go for it.

Let's do it

I download the linux zip file IntelGalileoFirmwareUpdater-1.0.4-Linux.zip. This unzips to a single file: firmware-updater-1.0.4. This is some kind of executable shell script wrapper of some java thing.

Next I plug in the Galileo, while I dig around for a USB cable it boots (no doubt) and when I connect it via the USB cable, I see this in my /var/log/messages file:

Nov 22 17:02:10 trona kernel: usb 3-1: new high-speed USB device number 3 using xhci_hcd
Nov 22 17:02:10 trona kernel: usb 3-1: New USB device found, idVendor=8086, idProduct=babe
Nov 22 17:02:10 trona kernel: usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Nov 22 17:02:10 trona kernel: usb 3-1: Product: Gadget Serial v2.4
Nov 22 17:02:10 trona kernel: usb 3-1: Manufacturer: Linux 3.8.7-yocto-standard with pch_udc
Nov 22 17:02:10 trona kernel: cdc_acm 3-1:1.0: ttyACM0: USB ACM device
Nov 22 17:02:10 trona kernel: usbcore: registered new interface driver cdc_acm
Nov 22 17:02:10 trona kernel: cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
Then I run the updater:
chmod a+x firmware-updater-1.0.4
./firmware-updater-1.0.4 
Exception in thread "AWT-EventQueue-0" java.awt.HeadlessException
	at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
	at java.awt.Window.(Window.java:536)
	at java.awt.Frame.(Frame.java:420)
	at java.awt.Frame.(Frame.java:385)
	at javax.swing.JFrame.(JFrame.java:189)
	at com.intel.galileo.flash.tool.FirmwareUpdateTool.(Unknown Source)
	at com.intel.galileo.flash.tool.FirmwareUpdateTool$1.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
And nobody is surprised, this is java after all, and it never works without pain and suffering. I hate java. We are using the following version on a Fedora 24 system.
[tom@trona Firmware]$ java -version
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-b16)
OpenJDK 64-Bit Server VM (build 25.111-b16, mixed mode)
Maybe it wants the actual Oracle java with all the grief involved with installing that. But before launching into that, we google on the error given and then try this based on a suggestion:
export JAVA_TOOL_OPTIONS='-Djava.awt.headless=false'
./firmware-updater-1.0.4 
Picked up JAVA_TOOL_OPTIONS: -Djava.awt.headless=false
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-3.b16.fc24.x86_64/jre/lib/amd64/libawt_xawt.so
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1827)
	at java.lang.Runtime.load0(Runtime.java:809)
	at java.lang.System.load(System.java:1086)
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1845)
	at java.lang.Runtime.loadLibrary0(Runtime.java:870)
	at java.lang.System.loadLibrary(System.java:1122)
	at java.awt.Toolkit$3.run(Toolkit.java:1640)
	at java.awt.Toolkit$3.run(Toolkit.java:1638)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.Toolkit.loadLibraries(Toolkit.java:1637)
	at java.awt.Toolkit.(Toolkit.java:1672)
	at java.awt.Component.(Component.java:593)
So that environment variable setting got us further, but now we are missing the awt library or something of the sort.

Install Oracle Java

The First step is to download the 160M RPM for 64 bit x86, i.e. jdk-8u112-linux-x64.rpm. This is Java 1.8.0 (aka "Java 8"). I install this via:
dnf install jdk-8u112-linux-x64.rpm
alternatives --config java
alternatives --config javac
java -version
Picked up JAVA_TOOL_OPTIONS: -Djava.awt.headless=false
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)
There was only one choice for javac. For java I changed to the oracle version in /usr/java/jdk1.8.0_112/jre/bin/java

Try it again

This time it works! It takes about 5 minutes. There are various complaints on the terminal window, but the GUI comes up and seems to do all the right things. It tells me I have version 1.0.2 of the firmware and that it is ready to go to version 1.0.4. It warns me that I should be using an external power supply (I am). Then away it goes for about 1 minute with a progress bar. Then there is a wait of 15 seconds or so that worried me a bit, then it tells me it will be updating firmware and it may take up to 5 minutes. Another progress bar appears. There are lots of messages on the terminal window (see below), but ultimately there is a popup announcing success.
 ./firmware-updater-1.0.4 
Picked up JAVA_TOOL_OPTIONS: -Djava.awt.headless=false
zmodemOperationWithTimeout
Output was: 0x01000200
Transfer complete
Exception in thread "serial-input" java.lang.NullPointerException
	at com.intel.galileo.flash.tool.JsscZmodemService$SerialInputPipe.run(Unknown Source)
	at java.lang.Thread.run(Thread.java:745)
Nov 22, 2016 5:36:36 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: Uploading: /home/tom/.galileo/firmware.cap
Nov 22, 2016 5:36:36 PM com.intel.galileo.flash.tool.AbstractZmodemService sendFile
INFO: [/home/tom/.galileo/lsz, --escape, --binary, --overwrite, --verbose, firmware.cap]
Nov 22, 2016 5:39:42 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: Checking uploaded file: md5sum /firmware.cap
Nov 22, 2016 5:39:43 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: MD5 result: f9d79a6813dede6f7f184b5460a32718  /firmware.cap
Transfer complete
Nov 22, 2016 5:39:43 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: Integrity good, preparing for upgrade...
Nov 22, 2016 5:39:43 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: mkdir -p /tmp/spi_upgrade
Nov 22, 2016 5:39:43 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: mkdir -p /lib/firmware/tmp/spi_upgrade
Nov 22, 2016 5:39:43 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: mv /firmware.cap /tmp/spi_upgrade/galileo_firmware.bin
Nov 22, 2016 5:39:44 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: cp /tmp/spi_upgrade/galileo_firmware.bin /lib/firmware/tmp/spi_upgrade/galileo_firmware.bin
Nov 22, 2016 5:39:44 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: Preparations complete!
Nov 22, 2016 5:39:44 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: ./opt/cln/galileo/start_spi_upgrade.sh
Nov 22, 2016 5:39:44 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: reboot
Nov 22, 2016 5:39:45 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: Updating firmware...This may take up to 5 minutes.
Nov 22, 2016 5:42:45 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: poll ...  1
Nov 22, 2016 5:42:45 PM com.intel.galileo.flash.tool.JsscZmodemService openSerialTransport
SEVERE: Port name - /dev/ttyACM0; Method name - openPort(); Exception type - Port not found.
Nov 22, 2016 5:42:50 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: poll ...  2
Nov 22, 2016 5:42:50 PM com.intel.galileo.flash.tool.JsscZmodemService openSerialTransport
SEVERE: Port name - /dev/ttyACM0; Method name - openPort(); Exception type - Port not found.
Nov 22, 2016 5:42:55 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: poll ...  3
Nov 22, 2016 5:42:55 PM com.intel.galileo.flash.tool.JsscZmodemService openSerialTransport
SEVERE: Port name - /dev/ttyACM0; Method name - openPort(); Exception type - Port not found.
Nov 22, 2016 5:43:00 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: poll ...  4
Nov 22, 2016 5:43:00 PM com.intel.galileo.flash.tool.JsscZmodemService openSerialTransport
SEVERE: Port name - /dev/ttyACM0; Method name - openPort(); Exception type - Port busy.
Nov 22, 2016 5:43:05 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: poll ...  5
Nov 22, 2016 5:43:05 PM com.intel.galileo.flash.tool.JsscZmodemService openSerialTransport
SEVERE: Port name - /dev/ttyACM0; Method name - openPort(); Exception type - Port busy.
Nov 22, 2016 5:43:10 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: poll ...  6
Nov 22, 2016 5:43:10 PM com.intel.galileo.flash.tool.JsscZmodemService openSerialTransport
SEVERE: Port name - /dev/ttyACM0; Method name - openPort(); Exception type - Port busy.
Nov 22, 2016 5:43:15 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: poll ...  7
Nov 22, 2016 5:43:15 PM com.intel.galileo.flash.tool.JsscZmodemService openSerialTransport
SEVERE: Port name - /dev/ttyACM0; Method name - openPort(); Exception type - Port busy.
Nov 22, 2016 5:43:20 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: poll ...  8
zmodemOperationWithTimeout
Output was: 0x01000400
Transfer complete
Nov 22, 2016 5:43:25 PM com.intel.galileo.flash.tool.JsscZmodemService$SerialInputPipe run
SEVERE: Stream closed
Nov 22, 2016 5:43:25 PM com.intel.galileo.flash.tool.GalileoFirmwareUpdater updateFirmwareOnBoard
INFO: Update was successful!
I connect my serial console and I see:
Poky 9.0.2 (Yocto Project 1.4 Reference Distro) 1.4.2 clanton /dev/ttyS1
clanton login: root
uname -a
Linux clanton 3.8.7-yocto-standard #1 Fri Oct 10 16:20:19 PDT 2014 i586 GNU/Linux
halt
The halt takes about 10 seconds.

Restarting the board and running the firmware updater again shows that 1.0.4 firmware is in place. After verifying this, I simply quit the updater.


Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org