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.
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.
- Download the Intel Quark Board Support Package
- Create a workspace directory to contain all of the extracted packages.
In my case, I did:
- Change to your new workspace directory and extract the zip file you downloaded in step #1 to your workspace directory:
$unzip <path to>/BSP_Sources_and_Docs_for_Intel_Quark_v126.96.36.199.zip
- 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_v188.8.131.52/* .
- Now listing your workspace directory will look like:
X1000 UEFI Firmware Writer’s Guide 330236_006US.pdf
- Extract all the .tar.gz files to your workspace:
$for file in *.tar.gz; do tar -zxf $file; done
- 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
- Install the crypto package as the build fails without it:
Download OpenSSL 0.9.8zb from http://www.openssl.org/source/openssl-0.9.8zb.tar.gz
Extract the tarball into <workspace>/Quark_EDKII*/CryptoPkg/Library/OpenSslLib/openssl-0.9.8zb
$mv <path to downloaded openssl> <your workspace>/Quark_EDKII_v184.108.40.206/CryptoPkg/Library/OpensslLib/
$cd <path to downloaded openssl>
$tar zxpvf openssl-0.9.8zb.tar.gz
$patch -p0 -i ../EDKII_openssl-0.9.8zb.patch
- Return to your Quark_EDK directory and build all of the EDKII Firmware validated build configurations:
$cd <your workspace>/Quark_EDKII_v220.127.116.11
$./buildallconfigs.sh 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.
- Next create a Flash image for the board using the provided SPI Flash Tools:
$cd sysimage_v18.104.22.168/sysimage.CP-8M-releaseIn 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 layout.conf.org
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_v22.214.171.124 therefore add the version number in each line like this:
Do this for all the 6 effected lines in the file.
- Run the create_symlinks.sh script from the BSP directory:
- Run the tools makefile with the command:
- This will produce 3 new files in the directory, but we’re only concerned with Flash-missingPDAT.bin
- Now we need to edit the platform data file to patch our bin with:
$cd <workspace>/spi-flash-tools/platform-data/We have to add in the variables for the Galileo2 board.
$cp sample-platform-data.ini platform-data.ini
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
- Run the script to patch the BIN file as follows:
./platform-data-patch.py -p platform-data.ini -i ../../sysimage_v126.96.36.199/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
- Connect the SPI cable from the Galileo2 to the SPI Hook as described above.
- DO NOT CONNECT THE SERIAL CABLE.
- DO NOT CONNECT POWER TO THE GALILEO2. SPI programming is done without power to the board.
- Connect the USB cable from your host computer to the SPI Hook.
- At the command prompt on you host computer type $dmesg to verify that the SPI Hook was detected. In my case, I see:
- 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:
- 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:
- 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: