Yocto vs Buildroot: A case study of SPEC7
Mamta Shukla, BE-CO-HT SoC Interest Group Meeting : 01/07/2020
1 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
● 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
4 Yocto and Open Embedded Core
● 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
5 Outline:
● Introduction ● Parameters for comparison ● Case study of SPEC7 (Simple PCI express Carrier 7)
6 Parameters Buildroot Yocto
Complexity Simple and easy to start with. Requires steep learning curve.
Reconfiguration/ Needs complete rebuild for each Incremental builds allowed Flexibility change in package. with sstate-cache
Size and Build 5MB, For minimum build requires 50GB required for complete Time requirements 15 minutes 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
7 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 Easy with a separate meta-layers -BR2_EXTERNAL
8 Outline:
● Introduction ● Parameters for comparison ● Case study of SPEC7 (Simple PCI express Carrier 7)
9 SPEC7
● 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
10 Block Diagram
11 [1] https://ohwr.org/project/spec7
12 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
13 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
14 Configuration: SPEC7
● Buildroot configuration for SPEC7 done by declaring config file and using buildroot defconfigs: BR2_arm=y BR2_cortex_a9=y BR2_ARM_EABIHF=y BR2_ARM_ENABLE_NEON=y BR2_ARM_FPU_VFPV3=y ● Toolchain and Kernel configuration and similarly for U-boot : BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_TARGET_GENERIC_GETTY_PORT="ttyPS0" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_GIT=y BR2_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
15 Configuration: SPEC7
● Yocto configuration requires addition of meta layers in bblayers.conf and values in local.conf. Build configuration after bitbake core-image-minimal:
16 Adding custom layer and custom package:
package
-Config.in -my_packge.mk -01_package.patch
17 Adding custom layer and custom package:
recipe_*
-conf -my_recipe.bb -my_recipe.bbappend -files -01_layer.patch
18 Adding external HDF/XSA:
Buildroot
● 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
19 Adding external HDF/XSA:
Buildroot Yocto
● Create new packages for example: ● meta-xilinx-tools layer bitstream ● Add in your meta-layer: ● Add required files, dependencies in .mk - conf/machine/spec7.conf file and update with config.in file HDF_BASE = "file://" ● Other methods include: HDF_PATH = "/path-to/spec7_wr_ref.hdf" - Store bitstream in separate file or - from 2019.2, flash address HDF_BASE = "file://" - fpga load command from uboot HDF_PATH = "/path-to/spec7_wr_ref.xsa" - load it from Linux using cat bitstream.bit > /dev/xdevcfg
20 Customizing Kernel:
Buildroot Yocto
● Adding path to custom kernel repository in ● Adding recipes-kernel and adding path in .bb config file file
BR2_LINUX_KERNEL SRC_URI BR2_LINUX_KERNEL_CUSTOM_GIT LINUX_VERSION BR2_LINUX_KERNEL_CUSTOM_REPO_URL LINUX_VERSION_EXTENSION_append = "-custom" BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION SRCREV_machine BR2_LINUX_KERNEL_DEFCONFIG PV = "${LINUX_VERSION}+git${SRCPV}"
21 Build Process and Time:
Buildroot Yocto
● Buildroot uses make and options ● Yocto uses bitbake : available with make are :
make menuconfig make busybox-menuconfig bitbake core-image-minimal make linux-menuconfig bitbake core-image-sato make [all] bitbake -c clean world bitbake busybox
22 Build Process and Time:
Buildroot
source
extract
patch
configure
compile
install install install target staging images
23 Build Process and Time:
Buildroot Yocto
source fetch
extract source
patch patch
configure configure
compile compile
install install install install deploy target staging images
24 Visualizing the Build dependencies:
● Buildroot: ● Yocto: ● To generate a dependency graph: ● To observe build dependencies make graph-depends bitbake -g
25 ● make graph-depends ● Sequence and structure of all dependencies of SPEC7 config in Buildroot
26 ● bitbake -g
27 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
28 Thank you !
29 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
30 Back up….
31 Testing the Embedded system:
● Boot Up Time ● Tests with frameworks like LAVA ● pTest ● Fuego
32 Building embedded systems for SoC:
● Build everything from scratch
● Build using tools like Yocto, Buildroot, OpenWrt
● Build using Distro
33 WhiteRabbit PLL and Clocks
34 SFP and HPC for Mezzanine
35