Tuesday, February 16, 2016

Building Debian Linux for Intel Edison

This documentation goes though the process of building a base Debian Linux image via simple make files for the Intel Edison board. The make file method for building Debian images is very similar to my last post for building Yocto images from Intels make file method. The make files provided by Intel in the BSP Edison source package wrap the build process with scripts to make building an extremely simple process.

Most of the base steps found in this documentation were based on Intels Board Support Package (BSP) User Guide. The BSP User Guide can be found here.

Also note, all of these steps were tested in Ubuntu Linux 14.04 x64 LTS. As of this writing, this OS/Version has the most support for doing Edison source builds. I have done these steps in other operating systems, but the process is not as clean due to bugs, script tweaks, etc.


Create a Directory for Building the Image

  • This step is optional, but I find it useful to create a directory for keeping my builds organized. If you chose to skip this step or alter it, just note that you may have to substitute directory references later in this documentation.

    mkdir -p ~/src/edison
    cd ~/src/edison

Download the Latest Edison Source Package

  • The source packages Intel provides are periodically updated. Because of this, it is wise to manually download them from Intels official download page. As of this writing you can find the source package downloads on this page.

  • Download the latest "Linux source files" on the page listed above. As of this documentation, the link was "Linux source files".

  • If you are not interested in grabbing the latest source package and want to use the latest package at the time of this writing, you can run the following.

    curl -O http://downloadmirror.intel.com/25028/eng/edison-src-ww25.5-15.tgz

Uncompress the Source Files

  • If you manually downloaded the source files in the step above, make sure you move the tar file to your build directory ~/src/edison. Once it is there, you can uncompress it with the following command.

    tar xfvz edison-src-ww25.5-15.tgz

Install Build Dependancies

  • Once the source files are downloaded and uncompressed, we must install some build dependancies before creating our Debian image.

  • Note: There are some extra dependancies here that are not in the Yocto build documentation from my last post

    sudo apt-get -y install build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib debootstrap u-boot-tools debian-archive-keyring dfu-util

(Optional) Speed Up The Build With Parallelization

  • Before moving on, if your computer has more than 4 CPU cores, you can speed up the make process by telling the build scripts to build using parallelization. By default, the Edison build configuration is set to build 4 packages at a time with 4 make threads. If you have a machine with 8 or more CPU cores, set the following variables to the amount of CPU cores on your machine.

  • Here is a little tip. If you dont have access to a fast machine with tons of CPU cores, you can spin up an Amazon ec2 m4.10xlarge instance (it has 40 CPU cores) to build an image from scratch in roughly 20 minutes. When I use the m4.10xlarge, I set both parallel_make and bb_number_thread to a value of 40.

    export SETUP_ARGS="--parallel_make=8 --bb_number_thread=8"

Initialize the Build Environment

  • The following commands prepare our build directory. You only need to run this command prior to your first build. You will not have to run this again on consecutive builds unless you completely wipe the edison-src directory.

    cd edison-src
    make setup

Build the Debian Image

  • Note, this step can take a very long time. When you are ready to kick off the build, run the following:

  • This process will build the base Debian image to ~/src/edison/edison-src/out/linux64/build/jessie-chroot. The jessie-chroot directory will then be compressed to ~/src/edison/edison-src/out/linux64/build/toFlash_debian.tar.gz. Finally, the toFlash_debian.tar.gz file is coppied to ~/src/edison/edison-src/out/linux64/built/toFlash/edison-image-edison.ext4. If you want to make any customizations to the file system, the edison-image-edison.ext4 file is where you want to hack before flashing you device.

    make debian_image
    sudo ./meta-intel-edison/utils/create-debian-image.sh --build_dir=~/src/edison/edison-src/out/current/build

Flash the Debian Image to the Edison Board.

  • Once the image is built, you can install it to the Edison board by running the following:

  • If you are customizing you base image filesystem before flashing, you can skip this step and just run ./flashall.sh from the toFlash directory as you do in the manual Yacto build process.

  • When logging into you Debian image, the login username and password is set to Username:user Password:edison

    make flash

Summary

Hopefully this documentation proves useful in building Edison Debian images via the simplified make file method. I find this method more flexible for customizations than just installing a standard pre built Debian image for the Edison Board.

1 comment:

  1. Excellent, will try ASAP, I was trying to build mine 2 years ago, I just discovered that Ubilinux is no more available, Emutex doesn't provide support anymore.

    ReplyDelete