Overview
This page presents instructions on how to build the following Linux items:
- U-Boot
- Linux Kernel
- Linux Root Filesystem
Host Setup for Yocto
The Altera Linux Yocto recipes were tested to build correctly with CentOS 6.5. It may also work with other distributions. For a list of distributions against which Yocto project was tested see
https://wiki.yoctoproject.org/wiki/Distribution_Support.
This section presents the packages that need to be installed on the host PC to allow the Yocto Recipes to be built. Since each machine may have been installed in a different way, the packages listed here are not an exhaustive list. Add packages as necessary if you encounter issues.
CentOS 6.4
These are the required packages that need to be installed:
$ sudo yum update
$ sudo yum groupinstall "Development Tools"
$ sudo yum install texi2html texinfo glibc-devel chrpath
If the host machine runs the 64bit version of the OS, then the following additional packages need to be installed:
$ sudo yum install glibc.i686 libgcc.i686 libstdc++.i686 glibc-devel.i686 ncurses-libs.i686 zlib.i686
Ubuntu 12.04
T
hese are the required packages that need to be installed:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install sed wget cvs subversion git-core coreutils unzip texi2html texinfo libsdl1.2-dev docbook-utils gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff libtool xterm
If the host machine runs the 64bit version of the OS, then the following additional packages need to be installed:
$ sudo apt-get install ia32-libs
Build U-Boot, Kernel and Rootfs Using Yocto Recipes
The U-Boot, Kernel and Rootfs can be built using the Yocto recipes that are provided as a Git tree.
Component |
Git address |
Tag |
---|
Yocto Recipes |
poky-socfpga.git |
ACDS14.0_REL_GSRD_PR |
This section presents how to clone the Yocto Project git tree and also how to build using it.
Note that only the Yocto Project build system and the recipes are cloned, all the dependencies are downloaded from Internet during the build process.
The commands for cloning the Yocto Project git trees and building Yocto Project are:
$ cd ~
$ git clone http://git.rocketboards.org/poky-socfpga.git
$ cd poky-socfpga/
$ git checkout -b test_branch ACDS14.0_REL_GSRD_PR
$ source ./altera-init build
$ bitbake virtual/kernel virtual/bootloader altera-gsrd-image
Note: replace
test_branch with the name of the branch you want to use locally.
Note: If your computer connects to the Internet using a proxy, you may need to use this command totell the Git utility about the proxy:
$ git config --global http.proxy <proxy_name>
The first time you build the Yocto Source Package it may take up to several hours depending on your host machine.
Once finished, all images should be generated in
~/poky-socfpga/build/tmp/deploy/images
. Some of the most important files created are:
File |
Description |
---|
u-boot-socfpga_cyclone5 |
U-Boot ELF file |
u-boot-socfpga_cyclone5.bin |
U-Boot binary file |
u-boot-socfpga_cyclone5.img |
U-Boot image |
vmlinux |
Kernel ELF file |
zImage |
Compressed kernel image |
altera-gsrd-image-socfpga_cyclone5.cpio |
Root Filesystem in cpio archive format |
altera-gsrd-image-socfpga_cyclone5.ext3 |
Root Filesystem as ext3 image |
altera-gsrd-image-socfpga_cyclone5.tar.gz |
Root Filesystem in tar gzip archive format |
The above files are actually links to the actual build resulted files. Each build file has a timestamp attached to its name and each time it it rebuilt, Yocto updates the link to point to the latest file.
Building Kernel & U-Boot Separately From Git Trees
U-boot and Linux kernel can also be built directly from the git trees at
http://rocketboards.org/gitweb. This section presents instructions for cloning the git trees and building U-boot, Linux kernel and Yocto.
Component |
Git address |
Tag |
---|
Linux |
linux-socfpga.git |
ACDS14.0_REL_GSRD_PR |
U-Boot |
u-boot-socfpga.git |
ACDS14.0_REL_GSRD_PR |
In case the U-boot or Linux kernel git trees are directly used, the build toolchain has to be manually downloaded. This section contains the instructions on how to download and setup the toolchain for this case.
Note that the build toolchain is provided with the Poky Yocto recipes. So when the Yocto Project git tree is used, the recipes will download the build chain automatically.
The steps necessary to download and setup the build toolchain are:
$ cd ~
$ wget https://launchpad.net/linaro-toolchain-binaries/trunk/2013.03/+download/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2
$ tar xjf gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2
$ export CROSS_COMPILE=~/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin/arm-linux-gnueabihf-
Building U-Boot
This section presents instructions on how to clone the U-boot git tree and compile U-boot. It assumes that you have manually downloaded the build toolchain.
$ cd ~
$ git clone http://git.rocketboards.org/u-boot-socfpga.git
$ cd u-boot-socfpga
$ git checkout -b test_branch ACDS14.0_REL_GSRD_PR
$ export CROSS_COMPILE=~/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin/arm-linux-gnueabihf-
$ make mrproper
$ make socfpga_cyclone5_config
$ make
Notes:
- replace
test_branch
with the name of the branch you want to use locally.
Some of the files that are created:
File |
Description |
---|
u-boot |
U-boot ELF file |
u-boot.bin |
U-boot binary file |
u-boot.img |
U-boot image file |
Building Linux Kernel
This section presents instructions on how to clone the Linux kernel git tree and compile the Linux kernel. It assumes that you have manually downloaded the build toolchain.
$ cd ~
$ git clone http://git.rocketboards.org/linux-socfpga.git
$ cd linux-socfpga
$ git checkout -b test_branch ACDS14.0_REL_GSRD_PR
$ export CROSS_COMPILE=~/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin/arm-linux-gnueabihf-
$ make ARCH=arm socfpga_defconfig
$ make ARCH=arm zImage
Note: replace
test_branch with the name of the branch you want to use locally.
Some of the files that are created:
File |
Description |
---|
vmlinux |
Linux Kernel ELF file |
arch/arm/boot/zImage |
Linux Kernel image |