khem raj yocto project/open embeddeddeploy linux using yocto project/openembedded working with yocto...

30
YOCTO PROJECT/OPEN EMBEDDED KHEM RAJ

Upload: others

Post on 06-Apr-2020

18 views

Category:

Documents


0 download

TRANSCRIPT

YOCTO PROJECT/OPEN EMBEDDEDKHEM RAJ

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

AGENDA

▸ Introduction to OE and Yocto Project

▸ Why Yocto Project

▸ Building Embedded Linux using Yocto Project

▸ Customizing Embedded Linux Distribution

▸ Developer workflows

▸ Application Development

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

A BRIEF HISTORY2003 merged OpenZaurus, OpenSIMpad, Familiar Linux, Created OpenEmbedded inspired by Gentoo Portage, handhelds.org

2003

Split into bitbake and OpenEmbedded metadata, poky distribution, a subset of OE

2004

Angstrom Distribution uses OpenEmbedded many other Derivatives, SlugOS

2005

Switches SCM from Monotone -> git, BeagleBoard.org announced wth Angstrom As base Linux provider

2008

Yocto Project Launched, Many big Companies join the project2010

OpenEmbedded Layered Architecture, birth of OE-Core, Switcher to pull model for development, Yocto project uses OE-Core

2011

More OSV adopt OpenEmbedded/Yocto e.g. Wind River, Mentor, Enea …, IVI layer

2012

GENIVI alliance adopts,Freescale, Dell, LSI, Renesas joins Yocto Project

2013

Commercial OSVs e.g. Montavista adopts OpenEmbedded, Palm WebOS, ArchOS

2009

Intel Galileo Programs use Yocto Project, LG, AMD Joins

2014

Launched workflow tools, Image creator, Extensible SDKs

2015

IT'S NOT AN EMBEDDED LINUX DISTRIBUTION – IT CREATES A CUSTOM ONE FOR YOU

yoctoproject.org

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

WHAT IS YOCTO PROJECT?

▸ Umbrella Project to help Embedded Linux Development

▸ OpenEmbedded - Build system

▸ Poky distribution - Reference Yocto Project Distribution

▸ Sato - Reference GTK based UI

▸ Auto builder Templates

▸ Cross prelink

▸ Pseudo - root user emulation

▸ Swagger - Cross Build system contamination tool

▸ Linux-yocto

▸ Build appliance

▸ Toaster

▸ Eclipse IDE plugins for OpenEmbedded

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

HORIZONTAL SCALE

OPENEMBEDDED/YOCTO PROJECT INFRASTRUCTURE

WIFI ROUTER

ARM/32MB FLASH/128MB DRAM

USE UCLIBC/MUSL BUSYBOX/MDEV IMAGE SIZE 9MB

SET TOP BOX

MIPS32/128MB FLASH/512MB

DRAM USE QT5/WEBKIT/

GSTREAMER

ROBOTICS

ATOM/8GB EMMC/1GB DRAM

USE WAYLAND/WESTON, OPENCV

SECURITY CAMERA

28MB/FLASH/128MB DRAM ARM/WEBRTC/

STREAMING

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

YOCTO INFRASTRUCTURE

▸ Build on top of same infrastructure

▸ Reduce cost

▸ Trainings in different systems

▸ Common infra, provides easy cross pollination

▸ Integrated solutions across product lines

BUILD SYSTEMS ARE NECESSARY EVIL, NOBODY WANTS THEM, BUT EVERYONE NEEDS ONE

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

WORKING WITH YOCTO PROJECT

▸ Prerequisites

▸ A “beefy” system running Linux ( Other OSes are not supported for platform builds)

▸ Minimum 50GB Free Disk, Fedora, openSuSE, Centos, Debian, Ubuntu, Archlinux

▸ http://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#detailed-supported-distros

▸ Pre-Built buildtools Tarball

▸ http://downloads.yoctoproject.org/releases/yocto/yocto-2.0/buildtools

▸ Appropriate packages installed

▸ bitbake will tell you first time

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

GETTING OPENEMBEDDED/YOCTO ELEMENTS

$ git clone git://github.com/openembedded/openembedded-core

$ cd openembedded-core

$ git clone git://github.com/openembedded/bitbake

$ . . ./oe-init-build-env

$ bitbake core-image-minimal

$ git clone git://git.yoctoproject.org/poky

$ cd poky

$ . . ./oe-init-build-env

$ bitbake core-image-minimal

OE-Core Poky - Yocto Project Reference Distro

OpenEmbedded-Core has “nodistro” policies

QEMU machine, arm,aarch64,mips,mips64,ppc,ia32,x86_64

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

BUILD PROCESS FLOW

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

BUILD PROCESS FLOW

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

CUSTOMIZING EMBEDDED LINUX - CONFIG METADATA

kraj@arch:~BUILDDIR/ > tree conf

conf

!"" bblayers.conf !"" local.conf #"" templateconf.cfg

kraj@arch:~BUILDDIR/ > cat conf/bblayers.conf

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf

# changes incompatibly

LCONF_VERSION = "5"

BBPATH = "${TOPDIR}"

BBFILES ?= ""

BBLAYERS ?= " \

/home/kraj/work/openembedded-core/meta \

"

BBLAYERS_NON_REMOVABLE ?= " \

/home/kraj/work/openembedded-core/meta \

"

#

# Machine Selection

#

# You need to select a specific machine to target the build with.

There are a selection

# of emulated machines available which can boot and run in the QEMU emulator:

#

#MACHINE ?= "qemuarm"

#MACHINE ?= "qemuarm64"

#MACHINE ?= "qemumips"

#MACHINE ?= "qemuppc"

#MACHINE ?= "qemux86"

#MACHINE ?= "qemux86-64"

#

# This sets the default machine to be qemux86 if no other machine is selected:

MACHINE ??= "qemux86"

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

CUSTOMIZING EMBEDDED LINUX - MACHINE

▸ Building for RaspberryPI machine

▸ Add machine layer to bblayers.conf

▸ Find RPi layer on http://layers.openembedded.org

▸ Clone it into project

▸ cd openembedded-core; git clone git://git.yoctoproject.org/meta-raspberrypi

▸ Add layer to BBLAYERS, bitbake can then parse it

▸ Add MACHINE = “raspberrypi2” to local.conf

▸ Now on you can build images for raspberrypi2 machine

BBLAYERS ?= “/home/kraj/work/meta-raspberrypi\”

/home/kraj/work/openembedded-core/meta”

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

CUSTOMIZING EMBEDDED LINUX - ADD/REMOVE PACKAGE

▸ Add <package> name to IMAGE_INSTALL

▸ local.conf

▸ image recipes (openembedded-core/meta/recipes-core/images/)

▸ Removing a package

▸ IMAGE_INSTALL_remove = “<package>”

▸ Hard way - Edit the place where its added

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

CUSTOMIZING EMBEDDED LINUX - CHANGE INIT SYSTEM

▸ Supports sysvinit ( default ), systemd and busybox/init

▸ Choosing systemd, Add following to config metadata

DISTRO_FEATURES_append = " systemd"

DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"

VIRTUAL-RUNTIME_init_manager = "systemd"

VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"

VIRTUAL-RUNTIME_graphical_init_manager = "bec-xinit"

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

CUSTOMIZING EMBEDDED LINUX - IMAGES, PREFERRED PACKAGES

▸ Generating additional image types

▸ IMAGE_FSTYPES += “ext4”

▸ Choosing from Multiple choices ( jpeg e.g.)

PREFERRED_PROVIDER_jpeg = “libjpeg-turbo"

PREFERRED_PROVIDER_jpeg-native = "libjpeg-turbo-native"

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

YOCTO PROJECT - DEVELOPMENT MODELS AND FLOWS

▸ Read through http://www.yoctoproject.org/docs/latest/dev-manual/dev-manual.html#dev-manual-model

▸ Application Development Workflows - App Developers

▸ System Development - BSPs, kernel development - Platform Developers

▸ Temporary Changes - All

▸ Image Development - System Integrators

▸ Component Source modification - Application/System component Developers

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

COMPONENT DEVELOPMENT WORKFLOW - DEVTOOL

▸ Provides provisions to work on a single component at source level

▸ more or less traditional workflow, with power of Yocto around it

▸ Edit/Change existing components

▸ Add new components

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

COMPONENT DEVELOPMENT WORKFLOW - DEVTOOL$ git clone git://git.openwrt.org/project/mdnsd.git

$ devtool add mdnsd mdnsd

NOTE: Creating workspace layer in /home/ubuntu/work/test/workspace

NOTE: Enabling workspace layer in bblayers.conf

NOTE: Recipe /home/ubuntu/work/test/workspace/recipes/mdnsd/mdnsd.bb has been automatically created;

cat workspace/appends/mdnsd.bbappend

inherit externalsrc

EXTERNALSRC = "/home/ubuntu/work/test/mdnsd"

# initial_rev: ae8773477c31b741ba8b47f8898e4c0a1c834b85

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

COMPONENT DEVELOPMENT WORKFLOW - RECIPETOOLcat workspace/recipes/mdnsd/mdnsd.bb

# Recipe created by recipetool

# This is the basis of a recipe and may need further editing in order to be fully functional.

# (Feel free to remove these comments when editing.)

#

# Unable to find any files that looked like license statements. Check the accompanying

# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.

#

# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if

# this is not accurate with respect to the licensing of the software being built (it

# will not be in most cases) you must specify the correct value before using this

# recipe for anything other than initial testing/development!

LICENSE = "CLOSED"

LIC_FILES_CHKSUM = ""

# No information for SRC_URI yet (only an external source tree was specified)

SRC_URI = ""

inherit cmake

# Specify any options you want to pass to cmake using EXTRA_OECMAKE:

EXTRA_OECMAKE = ""

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

COMPONENT DEVELOPMENT WORKFLOW - DEVTOOL

▸ Build component

▸ Add it to image via local.conf

▸ Apply Update to existing package

$ bitbake mdnsd (or) $ devtool build mdnsd

IMAGE_INSTALL_append = " mdnsd "

$ devtool update-recipe mdnsd

NOTE: Updating SRCREV in recipe mdnsd_git.bb

A PLUMBER IS AS GOOD AS HIS DEVTOOLS

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

APPLICATION DEVELOPMENT

▸ Application Developers your goto place

▸ http://www.yoctoproject.org/docs/latest/adt-manual/adt-manual.html

▸ Using (prebuilt SDK) ADT installer

▸ http://downloads.yoctoproject.org/releases/yocto/yocto-1.8/adt-installer/adt_installer.tar.bz2

▸ Run adt_installer ( needs pkgconfig on host)

▸ Installs Toolchains for all cross architectures arm/x86/x86_64/mips/ppc

▸ sato-sdk and minimal profiles sysroolts

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

APPLICATION DEVELOPMENT

▸ Using prebuilt toolchain ( no ADT installer)

▸ http://downloads.yoctoproject.org/releases/yocto/yocto-1.8/toolchain/x86_64/

▸ Choose the Architecture and download the self installer for the SDK e.g.

▸ http://downloads.yoctoproject.org/releases/yocto/yocto-1.8/toolchain/x86_64/poky-glibc-x86_64-core-image-sato-armv7a-vfp-neon-toolchain-1.8.sh

▸ ./poky-glibc-x86_64-core-image-sato-armv7a-vfp-neon-toolchain-1.8.sh

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

APPLICATION DEVELOPMENT

▸ Build your own SDK installer

▸ bitbake -cppulate_sdk core-image-base

▸ Install SDK from deploy/sdk area

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

APPLICATION DEVELOPMENT

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

APPLICATION DEVELOPMENT - ENVIRONMENT SETUP

▸ source /opt/poky/2.0/environment-setup-arch-poky-linux-ifWhere: arch is a string representing the target architecture: i586, x86_64, ppc603e, mips, or armv5te.

if is a string representing an embedded application binary interface. Not all setup scripts include this string.

DEPLOY LINUX USING YOCTO PROJECT/OPENEMBEDDED

APPLICATION DEVELOPMENT - BUILDING APPLICATION

▸ Can build projects using auto tools

▸ Makefile based projects

▸ SDK can also be installed into QTCreator and Eclipse ( plugins are supported)

▸ Find more about them online

THANKS