Compiling Linux - Arrow SoCKit Edition
How to build U-Boot, Kernel and Rootfs

This page needs tagging. Please add keywords describing what this page is about.

Overview

This page presents instructions on how to build the following Linux items:
  • U-Boot
  • Linux Kernel
  • Linux Root Filesystem

Host Setup for Angstrom

The Altera Linux Angstrom distribution were tested to build correctly with Ubuntu 12.04 and CentOS 6.5 It may also work with other distributions. For a list of distributions against which Angstrom distribution was tested see https://wiki.yoctoproject.org/wiki/Distribution_Support. Altera Linux Angstrom distribution is officially built and tested using Ubuntu 12.04.

This section presents the packages that need to be installed on the host PC to allow the Angstrom distribution 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.

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

On Ubuntu 12.04 you will also need to make /bin/sh point to bash instead of dash. You can accomplish this by running:
sudo dpkg-reconfigure dash

and selecting "No". (Alternatively, you can run:
sudo ln -sf bash /bin/sh

however this is not recommended, as it may get undone by Ubuntu software updates.)

CentOS 6.5

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 sqlite-devel

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 

On CentOS 6.5 newer version of Python, Git and Tar need to be downloaded, compiled, then added to the current search path. Note that the new packages will not be actually installed on the system, since that would break existing packages that depend on specific tool versions. Instead they will be added to the search path of the current console session.

These are the instructions for downloading and compiling the tools (only needs to be done once):
# python
cd ~
wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz 
tar xf Python-2.7.8.tgz
cd Python-2.7.8
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make

# git
cd ~
wget https://git-core.googlecode.com/files/git-1.7.8.tar.gz 
tar xf git-1.7.8.tar.gz
cd git-1.7.8
./configure  --prefix=/usr/local
make

# tar
cd ~
wget http://ftp.gnu.org/gnu/tar/tar-1.28.tar.gz 
tar xf tar-1.28.tar.gz
cd tar-1.28
./configure  --prefix=/usr/local
make

These are the instructions for adding the new tools to the search path. It needs to be done just before invoking the 'bitbake' commands:
export set PATH=~/Python-2.7.8:~/git-1.7.8:~/tar-1.28/src:$PATH

Build U-Boot, Kernel and Rootfs Using Angstrom distribution

The U-Boot, Kernel and Rootfs can be built using the Angstrom recipes that are provided as a Git tree.

Component Git address Tag
Yocto Angstrom Recipes angstrom-socfpga ACDS15.0.1_REL_GSRD_UPDATE1_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 https://github.com/altera-opensource/angstrom-socfpga
$ cd angstrom-socfpga/
$ git checkout -b test_branch ACDS15.0.1_REL_GSRD_UPDATE1_PR
$ sed -i 's@meta-openembedded,git://github.com/openembedded/meta-oe.git,dizzy,HEAD@meta-openembedded,git://git.openembedded.org/meta-openembedded.git,dizzy,HEAD@' ./sources/layers.txt
$ sed -i 's@openembedded-core,git://github.com/openembedded/oe-core.git,dizzy,HEAD@openembedded-core,git://git.openembedded.org/openembedded-core.git,dizzy,HEAD@' ./sources/layers.txt
$ sed -i /.*kde4.*/d sources/layers.txt ← temporal fix for gitorious being down
$ sed -i /.*gumstix.*/d sources/layers.txt  ← temporal fix for gitorious being down
$ sed -i /.*kde4.*/d conf/bblayers.conf  ← temporal fix for gitorious being down
$ sed -i /.*gumstix.*/d conf/bblayers.conf  ← temporal fix for gitorious being down
$ MACHINE=cyclone5 ./oebb.sh config cyclone5
$ source ./environment-angstrom-v2014.12
$ export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE KERNEL_TAG UBOOT_TAG UBOOT_PROT UBOOT_REPO"
$ export KERNEL_TAG=refs/heads/socfpga-3.10-ltsi
$ export UBOOT_TAG=refs/tags/ACDS15.0.1_REL_GSRD_UPDATE1_PR
$ export UBOOT_REPO=git://github.com/altera-opensource/u-boot-socfpga
$ export UBOOT_PROT=http
$ export set PATH=~/Python-2.7.8:~/git-1.7.8:~/tar-1.28/src:$PATH ← only on CentOS 6.5
$ MACHINE=cyclone5 bitbake virtual/kernel gsrd-console-image virtual/bootloader 

Note: gitorious.org is temporarily down, and therefore some layers are missing. A workaround to this is to run the instruction in red.

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 to tell the Git utility about the proxy:
$ git config --global http.proxy <proxy_name>

Note: You may compile the standard Angstrom filesystem instead of the Golden System Reference Design (GSRD) User Manuals one, by replacing bitbake gsrd-console-image with bitbake console-image in the above commands.

Note: At the end of May 2015 the Gitorious.org site was shut down. As a consequence, all layers hosted by that site (meta-kde4 and meta-gumstix-community) cannot be retrieved any longer and must be edited out from both sources/layers.txt and conf/bblayers.conf. Failure to do so results in a build error when bitbaking.

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 ~/angstrom-socfpga/deploy/glibc/images/cyclone5/. Some of the most important files created are:
File Description
u-boot-cyclone5 U-Boot ELF file
u-boot-cyclone5.bin U-Boot binary file
u-boot-cyclone5.img U-Boot image
vmlinux Kernel ELF file
zImage Compressed kernel image
gsrd-console-image-cyclone5.cpio Golden System Reference Design (GSRD) User Manuals Root Filesystem in cpio archive format
gsrd-console-image-cyclone5.ext3 Golden System Reference Design (GSRD) User Manuals Root Filesystem as ext3 image
gsrd-console-image-cyclone5.tar.gz Golden System Reference Design (GSRD) User Manuals Root Filesystem in tar gzip archive format
console-image-cyclone5.cpio Standard Angstrom Root Filesystem in cpio archive format
console-image-cyclone5.ext3 Standard Angstrom Root Filesystem as ext3 image
console-image-cyclone5.tar.gz Standard Angstrom Root Filesystem in tar gzip archive format
The above files are actually links to the actual build resulted files. Some build files have a timestamp attached to its name and each time it it rebuilt, Yocto updates the link to point to the latest file.


#YoctoArriaV

Targetting Arria V

In order to build the target against Arria V, just replace cyclone5 with arria5 in the above commands.

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 ACDS15.0_REL_GSRD_PR_UPDATE1
U-Boot u-boot-socfpga.git ACDS15.0_REL_GSRD_PR_UPDATE1

Build Toolchain

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.

The lib32z1 and lib32stdc++6 packages are required.

$ sudo apt-get install lib32z1 lib32stdc++6

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 http://releases.linaro.org/archive/13.12/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-4.8-2013.12_linux.tar.bz2
$ tar xjf gcc-linaro-arm-linux-gnueabihf-4.8-2013.12_linux.tar.bz2
$ export CROSS_COMPILE=~/gcc-linaro-arm-linux-gnueabihf-4.8-2013.12_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://github.com/altera-opensource/u-boot-socfpga
$ cd u-boot-socfpga
$ git checkout -b test_branch ACDS15.0.1_REL_GSRD_UPDATE1_PR
$ export CROSS_COMPILE=~/gcc-linaro-arm-linux-gnueabihf-4.8-2013.12_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.
  • replace make socfpga_cyclone5_config with make socfpga_arria5_config to compile the Arria V version.
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 https://github.com/altera-opensource/linux-socfpga
$ cd linux-socfpga
$ git checkout -b test_branch ACDS15.0.1_REL_GSRD_UPDATE1_PR
$ export CROSS_COMPILE=~/gcc-linaro-arm-linux-gnueabihf-4.8-2013.12_linux/bin/arm-linux-gnueabihf-
$ make ARCH=arm socfpga_defconfig
$ make ARCH=arm zImage

Note: replace test_branchwith 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

© 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