Adding dev tools (gcc, make…) to Galileo SD image and using nodejs with native extensions

Tweet about this on TwitterShare on Google+Share on FacebookShare on LinkedInShare on RedditEmail this to someone

Galileo is an Arduino that runs on a (x86) Intel® Quark X1000 SOC.IntelGalileo_fabD_Front_450px

While it’s fully compatible with Arduino Software Development Environment, it’s also capable of running a full Linux distribution.

Sept. 2014 update: GCC and other dev tools are now part of the official linux image you can download from Intel Developer Zone.

You can get such distribution from the official website. The “LINUX IMAGE FOR SD for Intel Galileo” is a poky distribution built using Yocto. It’s using uClibc and contains useful binaries like SSHd, bluez, nodejs and OpenCV while it can still run Arduino sketches !

It’s really simple to install it: you only need to unzip the .7z package at the root of a FAT32 formatted microSD.

I’ve came across some interesting nodejs modules, and some of them are relying on native extensions. Cross-compiling these seemed complicated so I’ve chosen another way to get these working on my Galileo: rebuilding the poky distribution to add dev tools.

And while it may sound complicated… it’s in fact dead simple thanks to the way Yocto is working.

First set up your build environment the same way you would build the same image than the one distributed on the official website, by downloading Galileo BSP and setting up Yocto:

Stop here to create your custom configuration:

Here I’ve chosen to triple the filesystem size to make it around 900mo:

added -dev packages to the image by adding dev-pkgs feature:

added the tools I wanted by adding this line:

and also integrated the right firmware for my Wi-Fi/BT4.0 chipset (Centrino  6235) by adding this line:

Finally you can build your custom distribution:

For me this process took around 20GB space and around an hour of automated download/build. Once its done you’ll find your generated files inside yocto_build/tmp/deploy/images. You can copy these to your microSD like so:

  • latest bzImage-* as bzImage
  • latest core-image-minimal-initramfs-* as core-image-minimal-initramfs-clanton.cpio.gz
  • latest image-* as image-full-clanton.ext3
  • boot folder as boot

Now you can easily get useful nodejs modules with native extensions – they will be compiled on the Galileo itself :

npm install

And if you don’t have the time and bandwidth to spare, you can directly download the custom image I’ve generated 🙂

update: There is now an official SD image with gcc support:

If you want to get more information on how to build your own image or learn how to use another libc than uClibc, you should read this article: Intel Galileo – Building Linux Image

PS: I’ve encountered one small bug with the image I’ve generated, stdbuf couldn’t find ‘’. You can easily fix this by running ln -s /usr/lib/coreutils/ /usr/lib/coreutils/coreutils/

Tweet about this on TwitterShare on Google+Share on FacebookShare on LinkedInShare on RedditEmail this to someone

Published by

Xavier Hallade

Software Engineer working at Intel Software and Service Group (SSG) in Paris, France. Google Developer Expert for Android. Helping developers to make a better use of Intel-based platforms, with a focus on the Android NDK.

7 thoughts on “Adding dev tools (gcc, make…) to Galileo SD image and using nodejs with native extensions”

  1. Great post … I was looking to add Dev tools and this is just what I needed. However, I tried booting from your pre-built custom files and my Serial Port doesn’t show up when the USB cable is connected. I also bitbaked the custom build from sources and had the same result. I tried this with an IDE running on Windows and Ubuntu – same results: the [Tools,Serial Port} menuitem is greyed out. I’ve tried this on two different Galileo boards and see the same result (both boards boot Intel’s SD image fine. ) Any ideas what might be causing this? Any workaround ideas? Thanks for the informative post.

  2. Oh I thought all the arduino-ide stack was still working, but I’ve tried it out again and indeed it’s not.

    Here is a start for a workaround:

    root@clanton:~# modprobe pch-udc
    root@clanton:~# modprobe g-serial vendor=0x8086 product=0xBABE

    that brings back the serial over usb communication but I think some other things need to be configured for being able to run sketches again. I’ll try to see what later… if you find more information in the meantime, please share.

    1. Thanks … I’m still trying to figure this out.

      I’m now watching the boot sequence over the serial connection (TRENDnet USB to RS-232 Serial Converter TU-S9 plus DB9 Female to 3.5mm Serial Cable) with PuTTY,

      It looks like things get stuck soon after a message indicates “Cannot execute Galileo Sketch Reset”. That is followed by this error message being continually written to the PuTTY terminal window:

      /etc/init.d/ line 3: /dev/ttyGS0: No such file or directory
      /etc/init.d/ line 3: /dev/ttyGS0: No such file or directory

      Consequently, I can’t get to a clean command line to log in with the modified build. (That works fine with default SD card build.)

    1. That’s what I was hoping … but … I looked up the DHCP address assigned to this Galileo’s MAC and then # ssh root@DHCP address but it errors with “No route to host.” (I had configured this Galileo with a static IP using the standard SD image. The Galileo and the SSH machine are on the same subnet of a connected network.) Is this my hardware or network? I know “Hello World” in C++ on the Galileo is within reach …

      1. It happened to me the galileo with my image failed to show up on the network after being unplugged at a bad time (now I always stop it using poweroff cmd). Reflashing the image should solve the issue.

        1. Thanks for taking the time to provide these pointers along with the custom build … this seems to have done the trick!

          I ran the [Help,Firmware Update] menu item to reflash the board. After the next reboot, I was able to match the MAC to the DHCP address and then use that to ssh into the Galileo running your customized SD with dev tools.

          Yes! I was able to SCP a HelloGalileo.cpp file over and compile it into a running program on the dev board: “Hello Galileo!”

          I found a thread which cleared up some other related problems:, specifically comment #10 describes a problem I was seeing:”The distribution booted fine and I now have access to gcc, etc. However, over the serial line there were a stream of messages about the clloader.” I followed their recommended steps to edit out the respawn and that helped resolve the mad scrolling terminal window I was seeing through Putty, running over the serial connection.

          Is vi the only editor choice? Any chance there’s a package for Nano or Pico possible?

Leave a Reply

Your email address will not be published. Required fields are marked *