Intel Galileo2 SPI-Hook

From TinCanTools
Jump to: navigation, search

Flashing an Intel Galileo2 Board with the SPI Hook

These instructions are specifically for the Intel Galileo2 (gen. 2) development board.


  • Your Galileo2 is bricked or you want to upgrade the firmware.
  • The flashrom utility is installed and functions.
  • These instructions are for a Linux machine.

Jumper Settings

SPI (JP1): set to 3.3V (the flash operates at 3.3V)
SERIAL (JP2): set to 3.3V (serial communications operate at 3.3V)
JP3: set to pins 2-3 (this configures the mux signal)

Connecting the Cable to the Galileo2

NOTE: Unplug the SPI cable to use the serial console as the Galileo does not use the enable pin.

For a serial console, connect the 6 pin between the SPI Hook J3 and Galileo2 6-pin header located directly beside the Ethernet port on the board. Make sure the black wire (GND) is plugged toward the interior of the board, beside the IOREF jumper. Make sure the black wire is connected to PIN#1 on the SPI Hook.

Connect the 8-pin ribbon cable between the SPI Hook J2 and Gelileo2 8-pin header located at the top right corner of the board. Make sure pin #1 (RED stripe) is aligned with pin #1 of both connectors.

Building a New Flash Image

Here's where this process gets a little tricky as we have to deal with Intel tools.

  1. Download the Intel Quark Board Support Package
  2. Create a workspace directory to contain all of the extracted packages.
    In my case, I did:
    $mkdir edkiiworkspace
  3. Change to your new workspace directory and extract the zip file you downloaded in step #1 to your workspace directory:
    $cd edkiiworkspace
    $unzip <path to>/
  4. I like to move the unzipped files up a level to the workspace and remove the extracted directory name.
    $mv BSP_Sources_and_Docs_for_Intel_Quark_v1.2.1.1/* .
    $rmdir BSP_Sources_and_Docs_for_Intel_Quark_v1.2.1.1/
  5. Now listing your workspace directory will look like:
    X1000_SDM 330235_005US.pdf
    X1000 UEFI Firmware Writer’s Guide 330236_006US.pdf
  6. Extract all the .tar.gz files to your workspace:
    $for file in *.tar.gz; do tar -zxf $file; done
  7. For reference the following steps have been culled from the X1000_BSP_BuildGuide_329687_010US.pdf document, so if you have any problems with these instructions refer to that document for Intel's full instructions. Now, assuming you are on a Debian-based distribution, install the requirements for building:
    $sudo apt-get install build-essential gcc-multilib vim-common
    $sudo apt-get install build-essential uuid-dev iasl subversion nasm
    $cd Quark_EDKII*
    $svn update
  8. Install the crypto package as the build fails without it:
    Download OpenSSL 0.9.8zb from
    Extract the tarball into <workspace>/Quark_EDKII*/CryptoPkg/Library/OpenSslLib/openssl-0.9.8zb
    $mv <path to downloaded openssl> <your workspace>/Quark_EDKII_v1.2.1.1/CryptoPkg/Library/OpensslLib/
    $cd <path to downloaded openssl>
    $tar zxpvf openssl-0.9.8zb.tar.gz
    $cd openssl-0.9.8zb
    $patch -p0 -i ../EDKII_openssl-0.9.8zb.patch
    $cd ..
  9. Return to your Quark_EDK directory and build all of the EDKII Firmware validated build configurations:
    $cd <your workspace>/Quark_EDKII_v1.2.1.1
    $./ GCC46 /usr/bin/ QuarkPlatform

    Depending on the speed of your machine, this process could take some time. The results can be found in Build directory.
  10. Next create a Flash image for the board using the provided SPI Flash Tools:
    $cd sysimage_v1.2.1.1/sysimage.CP-8M-release
    In this directory, we need to edit the layout.conf file for the Galileo2 variables. First, copy layout.conf to layout.conf.orig in order to have a backup. Then edit layout.conf as follows:
    $cp layout.conf
    $vim layout.conf

    Delete all the lines following line 81, that is all lines referencing files that we didn't build. Note also the item_file lines referencing a Quark_EDKII directory. We do not have this directory, ours is called Quark_EDKII_v1.2.1.1 therefore add the version number in each line like this:
    Do this for all the 6 effected lines in the file.
  11. Run the script from the BSP directory:
    $cd <workspace>/Quark_EDKII_v1.2.1.1

  12. Run the tools makefile with the command:
  13. This will produce 3 new files in the directory, but we're only concerned with Flash-missingPDAT.bin
  14. Now we need to edit the platform data file to patch our bin with:
    $cd <workspace>/spi-flash-tools/platform-data/
    $cp sample-platform-data.ini platform-data.ini
    $vim platform-data.ini
    We have to add in the variables for the Galileo2 board.
    Uncomment the data.value variable in the Platform Type section data.value=8. Uncomment the data.value in the MrcParams section data.value=MRC/GalileoGen2.bin. Uncomment the data.value in the MAC address 0 section to match the MAC address on the sticker on your board data.value=FFFFFFFFFF00.
  15. Run the script to patch the BIN file as follows:
    ./ -p platform-data.ini -i ../../sysimage_v1.2.1.1/sysimage.CP-8M-release/Flash-missingPDAT.bin
    This produces a file called Flash+PlatformData.bin that can now be programmed onto the board.

Flashing the Galileo2

  1. Connect the SPI cable from the Galileo2 to the SPI Hook as described above.
  3. DO NOT CONNECT POWER TO THE GALILEO2. SPI programming is done without power to the board.
  4. Connect the USB cable from your host computer to the SPI Hook.
  5. At the command prompt on you host computer type $dmesg to verify that the SPI Hook was detected. In my case, I see:


  1. Run a test read of the SPI memory using the flashrom utility:
    sudo ./flashrom -p ft2232_spi:type=2232h,port=A,divisor=4 -r test.bin
    This will take a little time, but if it completes successfully you will see the following output in your terminal window:


  1. Now write your new binary file to the Galileo2:
    sudo flashrom -p ft2232_spi:type=2232h,port=A,divisor=4 -w Flash+PlatformData.bin
    You should see output as follows:


  1. Reboot the Galileo and verify boot via serial console. Unplug the SPI cable from the Galileo2 and connect the serial cable to the Galileo2 as described above. In a new terminal window:
    $$ sudo screen /dev/ttyUSB2 115200
    Plug in the Galileo2 power cable. If all went well you should be presented with a fresh EFI Shell: