This documentation goes though the process of manually building a Yocto Linux image for the Intel Edison hardware. The build techniques used here do not use the easier make file method which is now available in the Intel Edison Board Support Package (BSP) source. For documentation on building via the make file method, I will do a follow up post which explains that process in detail.
The manual build method used in this documentation allows for easier customization of the base Yocto image. Customizations can include tweaks such as changing the base kernel, adding extra kernel modules, adding base application packages, etc.
Most of the base steps found in this documentation were modeled after 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 page here.
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 Yocto image.
sudo apt-get -y install build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib libsdl1.2-dev u-boot-tools
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.
Before moving on, if your computer has more than 4 CPU cores, you can speed up the make process by telling Yocto to build using parallelization. By default, the Edison Yocto 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 Yocto from scratch in roughly 20 minutes. When I use the m4.10xlarge, I set both
bb_number_threadto a value of 40.
cd edison-src ./meta-intel-edison/setup.sh --parallel_make=4 --bb_number_thread=4
Enter Your Build Environment
The Yocto build utilizes bitbake. The following command sets up your current shell to properly run bitbake for the build. If you exit your shell after running this, you will have to do it again before doing consecutive builds.
cd ~/src/edison/edison-src/out/linux64 source poky/oe-init-build-env
Pre Download the Build Files
The actual build process using bitbake (in the next step) can take hours to run depending on your CPU cores and speed. Since I typically build on a laptop which may or may not have internet access during the whole build process, I typically pre download all of the source files for the build. In order to pre download the builds source files, run the following:
bitbake -c fetchall edison-image
Build the Yocto Image
As mentioned above, this step can take a very long time. When you are ready to kick off the build, run the following:
Finalize the Build for Device Flashing
Before you can flash your newly created Yocto image to the Intel Edison, you must finalize the build. This process wraps the base file system, kernel, uboot files, etc into a structure where provided scripts can easily flash the Edison.
cd ~/src/edison/edison-src/ ln -s ~/src/edison/edison-src/out/linux64/build/tmp ~/src/edison/edison-src/build/tmp ./meta-intel-edison/utils/flash/postBuild.sh
Flash the Yocto Image to the Edison Board.
Once the image is built, you can install it to the Edison board by running the following:
cd build/toFlash/ sudo apt-get -i install dfu-util ./flashall.sh
Hopefully this documentation proves useful in building Edison Yocto images from scratch. The manual build process is a bit more tedious than the make method, but allows for easier customizations. If you are interested in the easier make variant, I will create some documentation for that in my next Edison series blog post. Future Edison posts will also cover how to create Debian, and other Linux distributions for the Edison hardware. Stay tuned for more...
Post a Comment