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 14.04. 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 14.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 14.04

These are the required packages that need to be installed:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install phablet-tools 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 lib32z1

On Ubuntu 14.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.)

Rootfs Using Angstrom 2015.12 distribution

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

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 ~
$ mkdir angstrom-build
$ cd angstrom-build
$ wget http://releases.rocketboards.org/release/2017.10/gsrd/src/altera.xml
$ wget http://commondatastorage.googleapis.com/git-repo-downloads/repo
$ chmod 777 repo
$ export PATH=$PATH:~/angstrom-build
$ repo init -u git://github.com/Angstrom-distribution/angstrom-manifest -b angstrom-v2015.12-yocto2.0
$ mkdir -p .repo/local_manifests
$ mv altera.xml .repo/local_manifests/
$ repo sync
$ MACHINE=stratix10swvp . ./setup-environment
$ sed -i '/meta-altera/a \ \ ${TOPDIR}\/sources\/meta-altera-refdes \\' conf/bblayers.conf # This is to add the meta-altera-refdes layer to conf/bblayers.conf
$ sed -i '/meta-atmel/d' conf/bblayers.conf # This is currently unavailable in  angstrom-v2015.12-yocto2.0
$ export KERNEL_PROVIDER=linux-altera-ltsi
$ export KERNEL_TAG=refs/tags/ACDS17.1_REL_GSRD_PR # Tentatively for EAP we are using this tag
$ export UBOOT_TAG=refs/tags/ACDS17.1_REL_GSRD_PR # Tentatively for EAP we are using this tag
$ export KBRANCH=socfpga-4.1.33-ltsi # we are temporarily using this branch but we use different zImage which is documented in the later sections
$ bitbake gsrd-console-image 

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 GSRD, by replacing bitbake gsrd-console-image with bitbake console-image in the above commands.

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-build/deploy/glibc/images/<family_name>/. Some of the most important files created are:
File Description
u-boot-* U-Boot ELF file
u-boot-*.bin U-Boot binary file
u-boot-*.img U-Boot image
vmlinux Kernel ELF file
zImage Compressed kernel image
gsrd-console-image-*.cpio GSRD Root Filesystem in cpio archive format
gsrd-console-image-*.ext3 GSRD Root Filesystem as ext3 image
gsrd-console-image-*.tar.gz GSRD Root Filesystem in tar gzip archive format
console-image-*.cpio Standard Angstrom Root Filesystem in cpio archive format
console-image-*.ext3 Standard Angstrom Root Filesystem as ext3 image
console-image-*.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.

Building Kernel and 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 branch
Linux linux-socfpga.git socfpga-4.12
U-Boot u-boot-socfpga.git socfpga_v2017.09

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.

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:

Tarball method
$ cd ~
$ wget https://releases.linaro.org/archive/14.04/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.8-2014.04_linux.tar.bz2
$ tar xjf gcc-linaro-aarch64-linux-gnu-4.8-2014.04_linux.tar.bz2
$ export CROSS_COMPILE=~/gcc-linaro-aarch64-linux-gnu-4.8-2014.04_linux/bin/aarch64-linux-gnu-
$ export ARCH=arm64

Apt-get method
$ sudo add-apt-repository ppa:linaro-maintainers/tools
$ sudo apt-get update
$ sudo apt-get install gcc-4.8-aarch64-linux-gnu
$ export CROSS_COMPILE=aarch64-linux-gnu-
$ export ARCH=arm64
$ sudo ln -s /usr/bin/aarch64-linux-gnu-gcc-4.8 /usr/bin/aarch64-linux-gnu-

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 socfpga_v2017.09#
$ make mrproper
$ make  socfpga_stratix10_defconfig
$ make

File Description
u-boot U-boot ELF file
u-boot.bin U-boot binary file
u-boot.img U-boot image file

Crafting Device Tree Manually for FPGA bridge enablement

In the device tree under linux-socfpga/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts

under the "soc {" section add the following lines to enable GPIO toggling

led_pio: gpio@0x1080 {
		compatible = "altr,pio-1.0";
		reg = <0xf9001080 0x8>;
		altr,gpio-bank-width = <4>;
		#gpio-cells = <2>;
		resetvalue = <0>;

button_pio: gpio@0x1060 {
		compatible = "altr,pio-1.0";
		reg = <0xf9001060 0x10>;
		altr,gpio-bank-width = <4>;
		#gpio-cells = <2>;
		resetvalue = <0>;

dipsw_pio: gpio@0x1070 {
		compatible = "altr,pio-1.0";
		reg = <0xf9001070 0x10>;
		altr,gpio-bank-width = <4>;
		#gpio-cells = <2>;
		resetvalue = <0>;

trigger_pio: gpio@0x1040 {
		compatible = "altr,pio-1.0";
		reg = <0xf9001040 0x20>;
		altr,gpio-bank-width = <4>;
		#gpio-cells = <2>;
		resetvalue = <0>;

soc_leds: leds {
	compatible = "gpio-leds";       /* appended from boardinfo */

	led_fpga0: fpga0 {
			label = "fpga_led0";    /* appended from boardinfo */
			gpios = <&led_pio 0 0>; /* appended from boardinfo */
	}; //end fpga0 (led_fpga0)

	led_fpga1: fpga1 {
			label = "fpga_led1";    /* appended from boardinfo */
			gpios = <&led_pio 1 0>; /* appended from boardinfo */
	}; //end fpga1 (led_fpga1)

	led_fpga2: fpga2 {
			label = "fpga_led2";    /* appended from boardinfo */
			gpios = <&led_pio 2 0>; /* appended from boardinfo */
	}; //end fpga2 (led_fpga2)

	led_fpga3: fpga3 {
			label = "fpga_led3";    /* appended from boardinfo */
			gpios = <&led_pio 3 0>; /* appended from boardinfo */
	}; //end fpga3 (led_fpga3)

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 socfpga-4.12#
$ make s10_devkit_defconfig
$ make menuconfig

**To enable the soft IP for GPIO perform the following:
**In menuconfig Find the GPIO_ALTERA Soft IP kernel module and change the status from [n] to [y]
**Save the .config and exit menuconfig

gpio altera.png

$ make 
# this includes the creation of the device tree blob

You can find all the supported dts from {linux-socfpga}/arch/arm64/boot/dts/altera

Some of the files that are created:
File Description
vmlinux Linux Kernel ELF file
arch/arm64/boot/Image Linux Kernel image
arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dtb Device Tree blob for Linux

Give us your feedback

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