The last days, I got several requests about how to build an image and how to customize the kernel. Instead of writing the same text again and again, I want to make a dedicated public post.
Intel provides two basic images for the Intel Galileo, the so-called SPI image and the Full image (or SD Card image). Both can be downloaded and work out-of-the-box. But to really get the best out of your Galileo – and to get additional hardware supported – you should know how to build an image and customize the kernel.
You need a “Host Computer” or “Build Computer”. This can be your desktop computer or laptop. It must run on Linux, have at least 70GB free disk space and 2 GB RAM.
But I'm on Windows/MacOS!
No Problem! You can use a Virtual Machine (VM). A VM allows you to run another operating system on your computer like a regular program. Some of them are free to use, some of them are not. A free one will fit our needs.
After installing a VM program, you have to create a virtual machine and install a Linux “in it”. The program will ask you about what kind of VM image you want to create. Make sure, this VM image can use at least 90 GB disk space and provides 2 GB RAM.
Note: The term VM image here does not refer to an image for the Galileo. Both have nothing in common.
One problem with an VM is: The Linux in the VM has often no connection to your Windows/MacOS and Hardware. Sometimes you can “share” and access devices like a smart card readers on the Linux, sometimes this will fail. But you need a way to transfer the generated Galileo image to a smart card (and the generated files can be big). What usually works is to setup a “shared folder”. This is a folder or directory writable and readable from the Linux in the VM and on Windows/MacOs at the same time.
(Re-)Build a Linux image
I wan't cover this in detail. There are two documents you should read:
The official Intel Quark BSP Build Guild (Intel® Quark BSP Build Guide) and a blog post from Sergey Kiselev (Intel Galileo - Building Linux Image - Malinov Family Web Presence). The second one is much easier to follow, and it also contains the explanation for the “famous” LSB image or also called “image-sdk” image. But you should really look at both, starting with Intel's one.
I only want to add some hints:
- After you download and extract the Build Support Package, you get a really long directory name like “Board_Support_Package_Sources_for_Intel_Quark_v0.7.5”. Rename this directory before doing anything else, for example to “bsp0.7.5”. Or you might get in trouble later.
- Sergeys Blog entry contains a bug: Calling setup.sh without any parameter is wrong. It must be:
setup.sh -e layer
- Setup.sh might throws errors about missing programs like “git” or “diffstat”. Just install them using the package manager of your Linux, for example (on Ubuntu):
sudo apt-get install git
- After setup, build the SPI image first using “bitbake image-spi”. If it runs without any problems, your setup is correct.
- Building image-full (the Full SD card image) or image-sdk (the LSB image) for the first time needs hours, if not a whole day! (That is the reason, why you should test the setup with image-spi).
- Later builds will require much less time - as long as you don't delete any caches.
- Some basic customizations to the image and the build process can be done in <BSP dir>/meta-clanton_v0.7.5/conf/local.conf. Explanations about the entries can be found in <BSP dir>/meta-clanton_v0.7.5/poky/meta-yocto/conf/local.conf.sample
Customize the kernel
If you are able to build your own image, you are ready to customize the kernel. You need to customize the kernel, if you want to use specific hardware that is not supported by the kernel in your current images. Typical use case: You have an older or non-Intel Wlan card.
Warning: Don't customize the kernel “for fun”. You can break things easily.
Go to the directory <BSP dir>/meta-clanton_v0.7.5. Always call:
source poky/oe-init-build-env yocto_build
before doing anything else.
You should be in the yocto_build directory now, so run:
bitbake virtual/kernelconfig -c menuconfig
A text based GUI will show up. Here you can modify the kernel – enable or disable kernel modules.
Rule of thumb: Never disable kernel modules you didn't enable before, or you might crash your kernel.
After you modified the kernel, don't forget to save the config at the end. Now you are ready to create a new kernel, just create the image as usual:
Which kernel module do I need for my Wlan card?
There are plenty of kernel modules. Which you need depends on hardware to add. In case of a Wlan card, the used networking chip matters often. Check the technical specs of the card. If it says, it uses a Broadcom chip, you need to enable one of the Broadcom kernel modules. If you are unsure, use Google&Co. Then, you use the search feature of the kernelconfig GUI to locate the module.