Yocto vs Buildroot: A case study of SPEC7 Mamta Shukla, BE-CO-HT 1 SoC Interest Group Meeting : 01/07/2020
Yocto vs Buildroot: A case study of SPEC7
Mamta Shukla, BE-CO-HT
1
SoC Interest Group Meeting : 01/07/2020
Outline:
● Introduction● Parameters for comparison● Case study of SPEC7 (Simple PCI express Carrier 7)
2
Outline:
● Introduction● Parameters for comparison● Case study of SPEC7 (Simple PCI express Carrier 7)
3
Buildroot
4
● Simple and easy-to-use tool to generate embedded linux systems using cross-compilation.
● Output is a root file system● Uses existing technologies - make and kconfig● Supports ~1200 packages● Focuses more on simplified and minimalistic build
Yocto and Open Embedded Core
5
● It is an umbrella project/ecosystem focusing on - open-embedded core - poky distribution● Output is a linux distribution● Uses Packages to create all basic blocks of
embedded distribution● Doesn’t maintain/build support for each device,
rather support is provided by vendors by upstreaming vendor-specific meta-layers
● Focuses more on versatility
Outline:
● Introduction● Parameters for comparison● Case study of SPEC7 (Simple PCI express Carrier 7)
6
7
Parameters Buildroot Yocto
Complexity Simple and easy to start with. Requires steep learning curve.
Reconfiguration/Flexibility
Needs complete rebuild for each change in package.
Incremental builds allowed with sstate-cache
Size and Build Time requirements
5MB, For minimum build requires 15 minutes
50GB required for complete distro, Takes 2-3 hrs and few minutes if sstate-cache is available for rebuild
Test Environment Custom Tests with LAVA, run-tests pTest , LAVA, Fuego
Support Community specific Community +Vendor
8
Parameters Buildroot Yocto
Reproducibility Good with config files Quite better because of meta-layers
Release Cycles Once in three months LTS version available with 2 years support
Maintainability -Using branches in Buildroot tree-BR2_EXTERNAL
Easy with a separate meta-layers
Outline:
● Introduction● Parameters for comparison● Case study of SPEC7 (Simple PCI express Carrier 7)
9
SPEC7
10
● SPEC7 stands for Simple PCIe FMC Carrier, based on Xilinx 7-series
FPGAs
● Follow up of SPEC (Simple PCI Express Carrier)
● Can hold one FMC card and an SFP connector
● Zynq 7000 Family SoC (XC7Z030-1FBG676C)
● Dual-Core ARM processor integrated
● It is optimised for low jitter for White Rabbit deployment
● A collaboration between NIKHEF (NL) and CERN
13
Configuration: Buildroot
● Uses Kconfig from Linux Kernel● Availability of menuconfig,
oldconfig, defconfig● Easy to build using make and
gives an upstart● Independent build for each
machine
14
Configuration: Yocto
● Distribution configuration● Machine configuration● Image Recipes● meta layers● bblayers.conf and local.conf● Uses bitbake for build ● In this case added meta-spec7
layer
Source: Yocto Project Mega Manual
15
● Buildroot configuration for SPEC7 done by declaring config file and using buildroot defconfigs: BR2_arm=yBR2_cortex_a9=yBR2_ARM_EABIHF=yBR2_ARM_ENABLE_NEON=y
BR2_ARM_FPU_VFPV3=y
● Toolchain and Kernel configuration and similarly for U-boot :BR2_TOOLCHAIN_BUILDROOT_CXX=yBR2_TARGET_GENERIC_GETTY_PORT="ttyPS0"BR2_LINUX_KERNEL=yBR2_LINUX_KERNEL_CUSTOM_GIT=yBR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/Xilinx/linux-xlnx"BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="xlnx_rebase_v4.14_2018.3"BR2_LINUX_KERNEL_DEFCONFIG="xilinx_zynq"
● For external layers/packages use:BR2_EXTERNAL
Configuration: SPEC7
16
● Yocto configuration requires addition of meta layers in bblayers.conf and values in local.conf.Build configuration after bitbake core-image-minimal:
Configuration: SPEC7
17
Adding custom layer and custom package:
package
<my_package>
<Buildroot>
-Config.in-my_packge.mk-01_package.patch
18
Adding custom layer and custom package:
<meta_layer>
recipe_*
<Yocto>
-conf -my_recipe.bb-my_recipe.bbappend-files -01_layer.patch
19
Adding external HDF/XSA:
● Create new packages for example: bitstream
● Add required files, dependencies in .mk file and update with config.in file
● Other methods include: - Store bitstream in separate file or flash address - fpga load command from uboot - load it from Linux using cat bitstream.bit > /dev/xdevcfg
Buildroot
20
Adding external HDF/XSA:
● Create new packages for example: bitstream
● Add required files, dependencies in .mk file and update with config.in file
● Other methods include: - Store bitstream in separate file or flash address - fpga load command from uboot - load it from Linux using cat bitstream.bit > /dev/xdevcfg
Buildroot
● meta-xilinx-tools layer● Add in your meta-layer:
- conf/machine/spec7.confHDF_BASE = "file://"HDF_PATH = "/path-to/spec7_wr_ref.hdf"
- from 2019.2, HDF_BASE = "file://"
HDF_PATH = "/path-to/spec7_wr_ref.xsa"
Yocto
21
Customizing Kernel:
Yocto Buildroot
● Adding path to custom kernel repository in config file
BR2_LINUX_KERNELBR2_LINUX_KERNEL_CUSTOM_GITBR2_LINUX_KERNEL_CUSTOM_REPO_URLBR2_LINUX_KERNEL_CUSTOM_REPO_VERSIONBR2_LINUX_KERNEL_DEFCONFIG
● Adding recipes-kernel and adding path in .bb file
SRC_URILINUX_VERSIONLINUX_VERSION_EXTENSION_append = "-custom"SRCREV_machinePV = "${LINUX_VERSION}+git${SRCPV}"
22
Build Process and Time:
● Buildroot uses make and options available with make are :
make menuconfigmake busybox-menuconfigmake linux-menuconfigmake [all]
● Yocto uses bitbake :
bitbake core-image-minimalbitbake core-image-satobitbake -c clean worldbitbake busybox
Buildroot Yocto
23
Build Process and Time:
Buildroot
source
extract
patch
configure
compile
install target
install staging
install images
24
Build Process and Time:
24
Build Process and Time:
Buildroot
source
extract
patch
configure
compile
install target
install staging
install images
Yocto
fetch
source
patch
configure
install deploy
compile
25
Visualizing the Build dependencies:
● Buildroot: ● To generate a dependency graph:
make graph-dependsmake <pkg>-graph-depends
● To generate the build time graph make graph-build
● To generate filesystem size contributionmake graph-size
● Yocto:● To observe build dependencies
bitbake -g <target_name>bitbake -g -u taskexp <target_name>
● Scripts available to generate buildtstats: bb-matrix.sh
pybootchartgui Buildstats.diff
28
Conclusion:
● Complete system build from source with choice of kernel and bootloader
● Allow modifying packages with patches or custom configuration files● Can build cross-toolchains for development ● For package manager based approach with frequent upgrades -
choose Yocto ● For less customizations and easy start - choose Buildroot
30
Links and Resources:
[1] https://ohwr.org/project/spec7
[2] https://buildroot.org/
[3] https://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html
[4] https://gitlab.cern.ch/mshukla/meta-spec7
[5] https://wiki.yoctoproject.org/wiki/Ptest
33
Building embedded systems for SoC:
● Build everything from scratch
● Build using tools like Yocto, Buildroot, OpenWrt
● Build using Distro