Introduction

This page presents the instructions on how to rebuild Linux by using the Yocto Source Package.

The Yocto Source package is an installer file provided by Altera that contains the Yocto build system, Yocto recipes and also the necessary dependencies to compile the Altera Linux bootloader, kernel and root filesystem.

For more details about Yocto see GSRDYoctoUserManual.

Host Setup

The Altera Linux Yocto Source package was tested to build correctly with CentOS 6.3 and Ubuntu 12.04. 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 Source Package 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.3

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

These 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

SoC EDS

The Altera SoC EDS needs to also be installed.

SoC EDS provides the following:
  • Preloader Generator
  • Device Tree Generator

The SoC EDS can be obtained from https://www.altera.com/download/software/soc-eds.

Obtaining Yocto Source Package

The Altera Yocto Source Package can be downloaded from https://releases.rocketboards.org/2013.11/gsrd.
$ wget https://releases.rocketboards.org/2013.11/gsrd/src/linux-socfpga-gsrd-13.1-src.bsx

Setting Up Yocto

First step is to make sure the source package can be executed. Run the following command to achieve this:
$ chmod +x linux-socfpga-gsrd-13.1-src.bsx

The Yocto Source Package may be installed in a publicly accessible location, as this step can be shared by all the users on the system (or on the filesystem if your company uses a network share). The default location is /opt/altera-linux. If you wish to use this location, you will likely need root access in order to access this directory. This is why the command shown below is ran using sudo.
$ sudo ./linux-socfpga-gsrd-13.1-src.bsx

The next step is to install a local set of Yocto recipes. This could be done in a shared location, but if someone wants or needs to modify them they should have their own version. The default install location for this is within your home directory:
$ /opt/altera-linux/bin/install_altera_socfpga_src.sh ~/yocto

Last step is to create a build directory. By keeping this separate from your yocto source you can erase your entire build without fear of deleting your yocto sources. Also, you can have several build directories, each with its own configuration, all based on the same yocto source. The script serves 2 purposes. First, it creates the new build directory using Altera’s default configuration. Secondly, it sets some shell variables that are required for building.
$ source ~/yocto/altera-init ~/yocto/build

Note: If you start a new shell you will need to run the above command to set the shell variables again.

Building U-Boot/Kernel/Rootfs

In order to build u-boot from within the build directory you need to execute this command:
$ bitbake virtual/bootloader

or the equivalent:
$ bitbake u-boot
  1. The Arrow SoCKit board GHRD has differences relative to the Altera CV SoC kit. The following steps need to be implemented in order to create a working version of u-boot for the SoCKit using yocto
  2. Build the SoCKit GHRD using the instructions on this page. Compiling the Hardware Design
  3. Build the preloader using the instructions on this page. Generating and Compiling the Preloader
  4. Copy the entire contents from the /sockit_ghrd/software/spl-bsp/generated folder to the /build/tmp/work/armv7ahf-vfp-neon-poky-linux-gnueabi/u-boot-altera-dist-1.0-r0/uboot-socfpga/board/altera/socfpga folder. Overwrite the existing files.
  5. You can customize u-boot for he SoCKit board using the instructions found on this page. Preloader and U-Boot Customization
  6. Build u-boot again
$ bitbake u-boot

In order to build linux from within the build directory:
$ bitbake virtual/kernel

or the equivalent:
$ bitbake linux-altera

In order to build the GSRD root filesystem:
$ bitbake altera-gsrd-image

In order to build a minimal root filesystem, ti be used for example when booting from QSPI:
$ bitbake altera-image-minimal

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 ~/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-image-socfpga_cyclone5.jffs2 Root Filesystem as jffs2 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.

Build Toolchain

The Yocto Source Package installer also includes the Linaro toolchain. This is installed by default in /opt/altera-linux/linaro/.

See the following settings in ~/yocto/build/conf/site.conf:
TCLIBC = "external-linaro-toolchain"
TCMODE = "external-linaro"
EXTERNAL_TOOLCHAIN = "/opt/altera-linux/linaro/gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_linux"

© 1999-2024 RocketBoards.org by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Privacy Policy - Terms Of Use

This website is using cookies. More info. That's Fine