Introduction

This describes adding the meta-altera layer to the vanilla Yocto sources. I opted to delete the old Jethro instructions which are ancient. Please note that there is plenty of documentation available for Yocto, a great starting place is https://www.yoctoproject.org/documentation. This site only documents the SoC specific instructions.

Yocto 2.5 Sumo

Please be sure to read the Quick Start Guide for any host dependencies. https://www.yoctoproject.org/docs/2.5.1/brief-yoctoprojectqs/brief-yoctoprojectqs.html

Known Issues

At this time, the yocto built toolchain is unable to build the 2017.09 u-boot for Stratix10. There is a linker error at the end of the build. Please build u-boot separately at this time. To remove the u-boot dependency, please remove the wic output as a default output for the rootfs in the stratix10 machine configuration

  • Follow the instructions to check out the required repositories
  • Open the machine configuration file in the meta-altera repo

vi meta-altera/conf/machine/stratix10.conf

  • Remove "wic" from the following entry

IMAGE_FSTYPES ?= "cpio ext3 tar.gz wic"

Setup Repos

First we need to checkout all of the relevant repositories

git clone -b sumo git://git.yoctoproject.org/poky.git
git clone -b master git://github.com/kraj/meta-altera.git

Prepare for and configure the build

Here we source the oe setup script, and configure the local.conf and bblayers.conf
source poky/oe-init-build-env ./build

You should see something like
### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'

Configure bblayers.conf

vi conf/bblayers.conf

Change the file from (and yes, the path should reflect the path to your source files)
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  /data/yocto-builds/2.5-clean/poky/meta \
  /data/yocto-builds/2.5-clean/poky/meta-poky \
  /data/yocto-builds/2.5-clean/poky/meta-yocto-bsp \
  "

to
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  /data/yocto-builds/2.5-clean/poky/meta \
  /data/yocto-builds/2.5-clean/poky/meta-poky \
  /data/yocto-builds/2.5-clean/poky/meta-yocto-bsp \
  ${TOPDIR}/../meta-altera \
  "

Configure local.conf

The only edit NEEDED is to change the machine, but here we will add support for compiling and using the linaro toolchain
vi conf/local.conf

Add
MACHINE = "stratix10"

to the bottom of the file (use "arria5" for the Arria5 SoC or "arria10" for the Arria 10 SoC or "cyclone5" for the Cyclone5 SoC)

Building the kernel and filesystem

Please note that this does NOT build the altera-image rootfs added in the poky-socfpga git repository on rocketboards.org

First, consider explicitly setting the kernel you wish to build. You can do this by editing conf/local.conf. There are a few kernels available in meta-altera:

  • linux-altera → released kernel versions (currently 4.17) tied to a specific tested hash
  • linux-altera-ltsi → Released LTSI kernels (4.9.78) tied to a specific tested hash
  • linux-altera-ltsi-rt → LTSI kernel with Real Time patches (4.9.76) tied to a specific tested hash

The specify use of the 4.17 linux-altera kernel, add the following to conf/local.conf:
PREFERRED_PROVIDER_virtual/kernel = "linux-altera"
PREFERRED_VERSION_linux-altera = "4.17%"

To specify the 4.9.78 LTSI kernel:
PREFERRED_PROVIDER_virtual/kernel = "linux-altera-ltsi"
PREFERRED_VERSION_linux-altera-ltsi = "4.9.78%"

My test build configuration looked like this:
MACHINE = "stratix10"

PREFERRED_PROVIDER_virtual/kernel = "linux-altera"
PREFERRED_VERSION_linux-altera = "4.17%"

NB: By default, the Cyclone5/Arria5 and Stratix10 image builds will automatically build the bootloader. This is because a default output is a wic image, which is an sdcard image. The image creation has dependencies on the kernel and bootloader.

The following build the bootloader, the rootfs, and the kernel.The first one takes a while b/c it will build to toolchain and all prerequisites.
bitbake virtual/bootloader
WARNING: Host distribution "fedora-28" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Parsing recipes: 100% |##########################################| Time: 0:00:27
Parsing of 915 .bb files complete (0 cached, 915 parsed). 1427 targets, 75 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.38.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "fedora-28"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "stratix10"
DISTRO               = "poky"
DISTRO_VERSION       = "2.5.1"
TUNE_FEATURES        = "aarch64"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "sumo:51872d3f99e38f9d883ab0a8782ceecb41822fd0"
meta-altera          = "master:988cc5463525cdabc18b2a015a902de3fc08489f"

NOTE: Fetching uninative binary shim from http://downloads.yoctoproject.org/releases/uninative/2.2/x86_64-nativesdk-libc.tar.bz2;sha256sum=e3b77208169bf1ac4e89496f3cdbf27695f5b18a2694a908a793390f28b67f83
Initialising tasks: 100% |#######################################| Time: 0:00:00

.......

and the rest
bitbake virtual/kernel

lastly,
bitbake core-image-minimal

In Conclusion

The results of your hard work can be found in tmp/deploy/images.You can follow any of the other guides on rocketboards.org to create the preloader and sdcard images specific to your design. Again, for Cyclone5/Arria5 and Stratix10, the wic file is an entire sdcard image and can simply be dd'ed to an SDCard.

NB: For this stratix10 build i removed wic as a rootfs ouptut

/data/yocto-builds/2.5-clean/build/tmp/deploy/images/stratix10
[dwesterg@dwesterg-mobl stratix10]$ ls
core-image-minimal-stratix10-20180914182151.rootfs.cpio      core-image-minimal-stratix10-20180914182151.testdata.json  core-image-minimal-stratix10.tar.gz                                        Image--4.17+git0+b7a0b88d86-r0-stratix10-20180914171143.bin
core-image-minimal-stratix10-20180914182151.rootfs.ext3      core-image-minimal-stratix10.cpio                          core-image-minimal-stratix10.testdata.json                                 Image-socfpga_stratix10_socdk.dtb
core-image-minimal-stratix10-20180914182151.rootfs.manifest  core-image-minimal-stratix10.ext3                          Image                                                                      Image-stratix10.bin
core-image-minimal-stratix10-20180914182151.rootfs.tar.gz    core-image-minimal-stratix10.manifest                      Image--4.17+git0+b7a0b88d86-r0-socfpga_stratix10_socdk-20180914171143.dtb  socfpga_stratix10_socdk.dtb
[dwesterg@dwesterg-mobl stratix10]$

Please note that there is a plethora of literature on yoctoproject.org that describes adding, modifying, and extending layers.

Notes

Thanks,dw

© 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