5. BSP

The Board Support Package is composed by a set files, patches, recipes, configuration files, etc. This chapter gives you the information you need when you want to customize something, fix a bug, or simply learn how the all thing has been assembled.

5.1. Bootloader

On power on the boot sequence steps of Galileo are:

  • BIOS starts
  • grub loads the kernel and ramdisk
  • the kernel loads the ramdisk drivers
  • the kernel loads the sdcard rootfs

The bootloader used by Galileo is Quark EDKII. If You need to build the open source EDKII firmware for the Intel® Quark™ SoC download the Intel® Build and Software User Guide:

The building guide starts at chapter 4.

If You want only to download the latest firmware go to:

5.2. Linux Kernel

The first step to compile the linux Kernel is to get the sources. You can get them from the Internet by cloning the proper repository and checking out the proper hash commit:

  Host    select
cd ~/Documents
git clone -b linux-3.8.y git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
cd linux-stable
git checkout 531ec28f9f26f78797124b9efcf2138b89794a1e

The second step is to properly patching the sources:

  Host    select
cd ~/Documents/linux-stable
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0001-tty-don-t-deadlock-while-flushing-workqueue-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0002-driver-core-constify-data-for-class_find_devic-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0003-TTY-mark-tty_get_device-call-with-the-proper-c-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0004-pwm-Add-sysfs-interface-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0005-drivers-pwm-sysfs.c-add-export.h-RTC-50404-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0006-core-Quark-patch-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0007-Quark-Platform-Code-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0008-Quark-UART-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0009-EFI-capsule-update-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0010-Quark-SDIO-host-controller-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0011-Quark-USB-host-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0012-USB-gadget-serial-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0013-Quark-stmmac-Ethernet-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0014-Quark-GPIO-2-2-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0015-Quark-GPIO-1-2-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0016-Quark-GIP-Cypress-I-O-expander-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0017-Quark-I2C-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0018-Quark-sensors-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0019-Quark-SC-SPI-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0020-Quark-IIO-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/0021-Quark-SPI-flash-quark.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/uart-1.0.patch
patch -p1 -d linux-stable/ < ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/GAL-118-USBDeviceResetOnSUSRES-2.patch

The third step is to copy the configuration:

  Host    select
cp ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/meta-clanton-bsp/recipes-kernel/linux/files/quark.cfg linux-stable/.config
source ~/architech_sdk/architech/galileo/toolchain/environment-nofs
cd ~/Documents/linux-2.6-imx
make menuconfig

and the next step is to compile them:

  Host    select
mkdir ../modules
KMACHINE=clanton KTYPE=standard KARCH=i386 make -j X
make modules_install INSTALL_MOD_PATH=../modules

Warning

X isn’t a parameter. It’s the number of processor’s threads

By the end of the build process you will get bzImage under arch/i386/boot.

  Host    select
~/Documents/linux-stable/arch/i386/boot/bzImage

Now you need to download and unzip the RAMdisk rootfs from the Internet:

  Host    select
cd ~
wget http://downloads.architechboards.com/galileo/download/dylan/initramfs-rootfs.tgz
tar -zxvf initramfs-rootfs.tgz

Then you have to copy the compiled modules to RAMdisk rootfs:

  Host    select
cp -r ~/Documents/modules/lib/modules/3.8.7+/ ~/rootfs/lib/modules/
cd rootfs
find . | cpio -o -H newc > ~/core-image-minimal-initramfs-clanton.cpio
cd ..
gzip -f -9 -c ~/core-image-minimal-initramfs-clanton.cpio > ~/core-image-minimal-initramfs-clanton.cpio.gz

5.2.1. Build from bitbake

The most frequent way of customization of the Linux Kernel is to change the .config file that contains the Kernel options. Setup the environment and run:

  Host    select
bitbake virtual/kernel -c cleanall
bitbake virtual/kernel -c menuconfig

a new window, like the following one, will pop-up:

_images/menuconfig.png

follow the instructions, save and exit, than you ready to generate your preferred image based on your customized kernel. If you prefer, you can build just the kernel running:

  Host    select
bitbake virtual/kernel

At the end of the build process, the output file (bzImage), along with the built kernel modules, will be placed under tmp/deploy/images/galileo/ inside your build directory, so, if you are building your system from the default directory, the destination directory will be /home/architech/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/yocto_build/tmp/deploy/images/.

5.3. Root FS

By default, Galileo’s Yocto/OpenEmbedded SDK will generate this files when you build an image:

  • image-full-galileo-clanton.ext3*,
  • core-image-minimal-initramfs-clanton.cpio.gz*

To open .ext3 file use:

  Host    select
mount -o loop image-full-galileo-clanton.ext3 /path/to/folder

now you can read and edit the files. At the end of your changes you must umount the folder

  Host    select
umount /path/to/folder

This files and the bootloader are to be copied in your final medium partition (on SD card or USB stick) on your host development system and used for build purposes with the Yocto Project.

The SD card ( or USB stick) must meet the following requirements:
- SD card must be formatted as FAT or FAT32.
- SD card size must be 32GB (or smaller) and SDHC format. SDXC format is not supported.

Now you are rady to copy the files to the final device:

  Host    select
cp -r ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/yocto_build/tmp/deploy/images/boot /path/to/your/sd/card/device
cp ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/yocto_build/tmp/deploy/images/bzImage /path/to/your/sd/card/device
cp ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/yocto_build/tmp/deploy/images/core-image-minimal-initramfs-clanton.cpio.gz /path/to/your/sd/card/device
cp ~/architech_sdk/architech/galileo/yocto/meta-clanton_v1.0.1/yocto_build/tmp/deploy/images/image-full-galileo-clanton.ext3 /path/to/your/sd/card/device

Warning

The content of the media will be lost forever!

After the copy completes, run:

  Host    select
sync