esercitazione su yocto project -...
TRANSCRIPT
Esercitazione su Yocto Project
Stefano Cordibella
EDALab s.r.l. – Networked Embedded Systems
January 15, 2015
Stefano Cordibella Esercitazione su Yocto Project 1/31
Outline
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 2/31
Purpose of the exercise
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 3/31
Purpose of the exercise
Purpose
• Scopo dell’esercitazione e quello di fare pratica con Yocto e con ilflusso di lavoro per ottenere un’immagine di linux embedded dapoter eseguire su un nostro target.
Stefano Cordibella Esercitazione su Yocto Project 4/31
Download Yocto
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 5/31
Download Yocto Git setup
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 6/31
Download Yocto Git setup
Configure git
1 $ git config --global user.email "[email protected]"
• Definisce l’indirizzo email associato all’utente git.
Stefano Cordibella Esercitazione su Yocto Project 7/31
Download Yocto Git setup
Configure git
1 $ git config --global user.email "[email protected]"
• Definisce l’indirizzo email associato all’utente git.
User Name
1 $ git config --global user.name "Your Name"
• Definisce lo User Name dell’utente git.
Stefano Cordibella Esercitazione su Yocto Project 7/31
Download Yocto Freescale Yocto
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 8/31
Download Yocto Freescale Yocto
Checkout Yocto Freescale (http://freescale.github.io/)
Install the repo utility
1 $ mkdir ~/bin
2 $ curl http:// commondatastorage.googleapis.com/git -
repo -downloads/repo > ~/bin/repo
3 $ chmod a+x ~/bin/repo
Stefano Cordibella Esercitazione su Yocto Project 9/31
Download Yocto Freescale Yocto
Checkout Yocto Freescale (http://freescale.github.io/)
Install the repo utility
1 $ mkdir ~/bin
2 $ curl http:// commondatastorage.googleapis.com/git -
repo -downloads/repo > ~/bin/repo
3 $ chmod a+x ~/bin/repo
Download the BSP source code
1 $ export PATH=$PATH :~/bin
2 $ cd /tmp
3 $ mkdir fsl -community -bsp
4 $ cd fsl -community -bsp
5 $ repo init -u https:// github.com/Freescale/fsl -
community -bsp -platform -b dizzy
6 $ repo sync
Stefano Cordibella Esercitazione su Yocto Project 9/31
Download Yocto Freescale Yocto
Checkout Yocto Freescale (http://freescale.github.io/)
Spazio di lavoro
• Che directory ha creato?
1 $ ls -l
2 $ ls -l sources
Stefano Cordibella Esercitazione su Yocto Project 10/31
Download Yocto Freescale Yocto
Checkout Yocto Freescale (http://freescale.github.io/)
Spazio di lavoro
• Che directory ha creato?
1 $ ls -l
2 $ ls -l sources
Stefano Cordibella Esercitazione su Yocto Project 10/31
Download Yocto Qt5
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 11/31
Download Yocto Qt5
Checkout Qt5
Checkout Qt5• Aggiungiamo il layer per Qt5 ai sorgenti.
1 $ cd sources
2 $ git clone https:// github.com/meta -qt5/meta -qt5.git
Stefano Cordibella Esercitazione su Yocto Project 12/31
Configure Yocto
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 13/31
Configure Yocto Setup environment
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 14/31
Configure Yocto Setup environment
Setup environment
Creazione di una shell di build
1 $ cd fsl -community -bsp
2 $ . ./setup -environment build
• Mostra la licenza d’uso e ne chiede l’autorizzazione
• Crea la cartella build e ne inizializza il contenuto con files utili allacreazione dell’immagine per il target.
• Da questo momento in poi si puo usare il comando bitbake.
Stefano Cordibella Esercitazione su Yocto Project 15/31
Configure Yocto Create meta-soa layer
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 16/31
Configure Yocto Create meta-soa layer
Create soa layer
Create layer using yocto-layer
• Creazione della directory del nostro layer meta-soa.
1 $ cd fsl -community -bsp/sources
2 $ yocto -layer create soa
yocto-layer
• Che struttura di directory ha creato?
1 $ ls -l meta -soa
Stefano Cordibella Esercitazione su Yocto Project 17/31
Configure Yocto Create meta-soa layer
Create soa layer
Contents of conf/layer.conf
1 # We have a conf and classes directory
2 BBPATH .= ":${LAYERDIR}"
3
4 # We have a recipes directory , add to BBFILES
5 BBFILES += "${LAYERDIR }/recipes -*/*/*.bb ${LAYERDIR }/
recipes -*/*/*. bbappend"
6
7 BBFILE_COLLECTIONS += "soa -layer"
8 BBFILE_PATTERN_soa -layer := "^${LAYERDIR }/"
9
10 # Define the priority for recipes (.bb files)
11 BBFILE_PRIORITY_soa -layer = "6"
12
13 LAYERVERSION_soa -layer = "1"
14 LAYERDEPENDS_soa -layer = "core"
Stefano Cordibella Esercitazione su Yocto Project 18/31
Configure Yocto Create soa image recipe
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 19/31
Configure Yocto Create soa image recipe
Create soa image recipe
Create image recipe
1 $ cd meta -soa
2 $ mkdir recipes -soa
3 $ cd recipes -soa
4 $ mkdir image
5 $ vim image/soa -image.bb
Stefano Cordibella Esercitazione su Yocto Project 20/31
Configure Yocto Create soa image recipe
Contents of image/soa-image.bb
image/soa-image.bb
1 DESCRIPTION = "Qt test image"
2 LICENSE = "CLOSED"
3 PR = "r1"
4 inherit core -image
5 IMAGE_FEATURES += "splash"
6 IMAGE_INSTALL += "cinematicexperience"
Stefano Cordibella Esercitazione su Yocto Project 21/31
Configure Yocto Customize build files
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 22/31
Configure Yocto Customize build files
Edit conf/local.conf
Target
• Specificare il target della nostra build.
1 MACHINE ??= ’imx6qsabresd’
Stefano Cordibella Esercitazione su Yocto Project 23/31
Configure Yocto Customize build files
Edit conf/local.conf
Target
• Specificare il target della nostra build.
1 MACHINE ??= ’imx6qsabresd’
Load• Bilanciare il carico di task e parallelismo rispetto alla cpu host.
1 BB_NUMBER_THREADS = ’4’
2 PARALLEL_MAKE = ’-j 4’
Stefano Cordibella Esercitazione su Yocto Project 23/31
Configure Yocto Customize build files
Edit conf/bblayers.conf
Qt5• Aggiungere il layer per le Qt5
1 ${BSPDIR}/ sources/meta -qt5 \
Stefano Cordibella Esercitazione su Yocto Project 24/31
Configure Yocto Customize build files
Edit conf/bblayers.conf
Qt5• Aggiungere il layer per le Qt5
1 ${BSPDIR}/ sources/meta -qt5 \
SOA• Aggiungere il layer soa
1 ${BSPDIR}/ sources/meta -soa \
Stefano Cordibella Esercitazione su Yocto Project 24/31
Build Yocto image
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 25/31
Build Yocto image
Build soa image
Run bitbake• A questo punto possiamo lanciare bitbake.
1 $ bitbake soa -image
Stefano Cordibella Esercitazione su Yocto Project 26/31
Build Yocto image
Congratulazioni!!!
Stefano Cordibella Esercitazione su Yocto Project 27/31
Build Yocto image
Ora possiamo rilassarci...
Stefano Cordibella Esercitazione su Yocto Project 28/31
Deploy all to target
1 Purpose of the exercise
2 Download YoctoGit setupFreescale YoctoQt5
3 Configure YoctoSetup environmentCreate meta-soa layerCreate soa image recipeCustomize build files
4 Build Yocto image
5 Deploy all to target
Stefano Cordibella Esercitazione su Yocto Project 29/31
Deploy all to target
Deploy soa image
Deploy folder
• Alla fine del processo di build sara creata la cartella deploy inbuild/tmp .
• La cartella conterra tutto il necessario per eseguire la nostraimmagine sul target (boot loader e kernel).
Stefano Cordibella Esercitazione su Yocto Project 30/31
Deploy all to target
Deploy soa image
Deploy folder
• Alla fine del processo di build sara creata la cartella deploy inbuild/tmp .
• La cartella conterra tutto il necessario per eseguire la nostraimmagine sul target (boot loader e kernel).
Deploy steps
• Il deploy fisico sul target puo essere fatto attraverso microSD o viarete (tftp).
• In produzione posso accordarmi con il fornitore per avere gia a bordouna specifica versione del bootloader.
Stefano Cordibella Esercitazione su Yocto Project 30/31
Deploy all to target
Grazie per l’attenzione
Domande?
Stefano Cordibella Esercitazione su Yocto Project 31/31