SlideShare une entreprise Scribd logo
1  sur  133
Télécharger pour lire hors ligne
Poky meets Debian:
Understanding How to Make an
Embedded Linux by Using an
Existing Distribution's Source Code
Embedded Linux Conference 2015
Yoshitake Kobayashi, TOSHIBA
2Embedded Linux Conference 2015Embedded Linux Conference 2015
Information
 All source code are available at the following
URL:
 https://github.com/ystk
 Poky-debian
 https://github.com/ystk/poky-debian
 Branch: master
 Meta-debian
 https://github.com/ystk/meta-debian
 Branch: daisy
3Embedded Linux Conference 2015Embedded Linux Conference 2015
Can we create a
“Standard Embedded Linux Distribution”?
Embedded Linux Conference Europe 2014
It is really difficult!
4Embedded Linux Conference 2015Embedded Linux Conference 2015
How to choose a suitable distribution for you?
 There are a lot of Linux distributions
 Need to be considered the following
 Usecases
 Supported CPU architectures
 X86, ARM, PowerPC, etc.
 Number of packages
 How many packages are enough?
 Security fix support period for some distributions
 Centos 10 years
 OpenSUSE 3 years
 Debian 3 years+2years(LTS)
 Ubuntu 5 years
 Gentoo Incremental update (rolling release)
5Embedded Linux Conference 2015Embedded Linux Conference 2015
Why Debian?
 Would like to use Desktop and Embedded with a
same source code base
 Would like to build embedded Linux environment
for the following CPUs
 X86(32bit and 64bit)
 ARM
 PowerPC
 might be others
 Would like to use same package version in one
major release
6Embedded Linux Conference 2015Embedded Linux Conference 2015
Why not Emdebian?
 http://www.emdebian.org/
 As of July 2014, updates to the Emdebian distributions
ceased. There will be no further updates and no further stable
releases.
 Would like to customize more than Emdebian’s
way
7Embedded Linux Conference 2015Embedded Linux Conference 2015
Why Poky?
 Poky is one of the most popular reference
distribution for embedded Linux
 Would like to share the knowledge
 Bitbake
 Recipes
 Tools
8Embedded Linux Conference 2015Embedded Linux Conference 2015
What we want?
 Use Debian’s source code
 Make custom embedded Linux environments
 Would like to change it to open
 Share knowledge with Yocto Project
9Embedded Linux Conference 2015Embedded Linux Conference 2015
Scope of this presentation
 Introducing of the following two implementation
 Poky-debian (BAD manners)
 Meta-debian (GOOD manners)
 Out of scope
 What is the Yocto Project
10Embedded Linux Conference 2015
Compareing Poky-debian and Meta-debian
Poky-debian Meta-debian
Poky version Edison Daisy
Debian version 6 (Squeeze) 8 (Jessie)
Kernel LTSI + RT patch LTSI + RT patch
Distribution Support Debian 6 Debian 8
11Embedded Linux Conference 2015
poky-debian
12Embedded Linux Conference 2015Embedded Linux Conference 2015
Introduction of Poky-debian
 Replacing meta layer to adapt Debian source
 Source code
 https://github.com/ystk/poky-debian.git
13Embedded Linux Conference 2015Embedded Linux Conference 2015
What is "poky-debian" ?
 Based on
 Poky (Edison)
 Debian 6 (squeeze-lts)
 Generate Linux environment for embedded
systems (x86, ARM, PowerPC, etc.)
 Based on "poky" developed by Yocto Project
 Kernel, rootfs and toolchain only from Debian source codes
 Common sources + board-specific customization
 Support distro
 Debian 6 LTS (squeeze-lts) only
 All build test has been done on x86-32bit environment
14Embedded Linux Conference 2015Embedded Linux Conference 2015
Goal of poky-debian
 Build Debian based Linux environment for many
embedded systems as quickly as possible
 Generate "minimal" environemt for each requirement
 Ex: Consists only busybox and libc
 Share problems between all systems generated by it
 Share know-how for embedded Linux system
implementation
 Improve traceability of all sources & customization
15Embedded Linux Conference 2015Embedded Linux Conference 2015
Packaging system structure
Debian
Package
git repo.
Kernel
git repo.
apt archive
poky-debian
Common recipes
Auto builder
(buildd)
fetch
build
kernel A
rootfs A
fetch
For generic system For embedded system
Source pkgs
Binary pkgs (.deb)
fetch
build
kernel B
rootfs B
kernel C
rootfs C
Recipes
for A
Recipes
for B
Recipes
for C
16Embedded Linux Conference 2015Embedded Linux Conference 2015
Build flow
Build native tools
Build target binaries
(Applications and kernel)
Build cross-compiling tools
Build rootfs
17Embedded Linux Conference 2015Embedded Linux Conference 2015
Directory structure of poky-debian
bitbake/
meta/
classes/
recipes-kernel/
recipes-core/
linux/
linux-libc-
headers
*.bb*.bb
*.bbclass*.bbclass
*.bb*.bb
busybox/ *.bb*.bb
Bitbake binaries & libraries
Recipes & local files
conf/ *.conf
configuration
meta-bsp1/ conf/
recipes-core/
meta-bsp2/
*.conf
Board specific
busybox/
bsp-app/ *.bb*.bb
*.bbappend*.bbappend
override
meta/recipes-debian-squeeze/busybox/busybox_git.bb
meta/recipes-debian-squeeze/busybox/busybox_git.bbappend
Common functions
( Added debian-squeeze*.conf )
18Embedded Linux Conference 2015Embedded Linux Conference 2015
Core components
 bitbake
 Core build tool of poky
 Parse all recipes and run all build actions
 Ex: To build busybox, run $ bitbake busybox
 Recipes (*.bb)
 Defines how to build each package, kernel, rootfs, toolchain,
etc.
 Written in shell & python based script
 Actions in some recipes depend on other recipes
 Configuration (.conf)
 Defines machine or build environment-specific values
19Embedded Linux Conference 2015Embedded Linux Conference 2015
The relation of core components
*.conf
eglibc.bb
busybox.bb
openssh.bb
openssl.bb
gcc-cross.bb
binutils-cross.bb
rootfs.bb
xxx.bbxxx.bbxxx.bb
$ bitbake rootfs
depend
target
cross
depend
native
depend
*.conf*.conf
load
xxx.bbxxx.bbxxx
eglibc openssh
rootfs
build
build
build
build
busybox openssl
gcc-cross
binutils-cross
Added debian-squeeze*.conf
20Embedded Linux Conference 2015Embedded Linux Conference 2015
Build tasks
 Each recipe has the following "task":
1. do_fetch*: Fetch source to the download directory
2. do_unpack*: Checkout git, unpack archives, etc.
3. do_patch*: Apply local patches
4. do_configure: Do $ ./configure
5. do_compile: Do $ make
6. do_install: Do $ make install
……..
 Each task is defined
as a function in a recipe
do_unpack() {
tar xzf …
}
do_compile() {
export ARG1=…
export ARG2=…
make
}
do_install() {
install -d …
install -m 0755 …
}
……
21Embedded Linux Conference 2015
Developing recipes for poky-debian
22Embedded Linux Conference 2015Embedded Linux Conference 2015
Issues
 At least 200-300 packages are required to apply
poky-debian to embedded systems
 Social Infrastructure, power system, train/highway, medical,
…
 Need to implement & update many "common"
recipes for Poky-debian
 "common" means "not depend on target system"
 All recipes for board X are created based on "common" recipes
23Embedded Linux Conference 2015Embedded Linux Conference 2015
Packaging system structure (target)
Package
git repo.
Kernel
git repo.
apt archive
poky-debian
Common recipes
Auto builder
(buildd)
fetch
build
kernel A
rootfs A
fetch
For generic system For embedded system
Source pkgs
Binary pkgs (.deb)
fetch
build
kernel B
rootfs B
kernel C
rootfs C
Recipes
for A
Recipes
for B
Recipes
for C
24Embedded Linux Conference 2015Embedded Linux Conference 2015
Why BAD manners?
 First step
 Move all original recipes to somewhere… 
25Embedded Linux Conference 2015Embedded Linux Conference 2015
Directory structure
bitbake binaries and libraries
Common recipes
& configurations
Common configurations
bitbake/
meta-pandaboard/
meta-qemux86/
meta-yocto/
meta/ recipes-debian-
squeeze/
recipes-yocto/
recipes-kernel/
recipes-poky/
pkg1/
pkg2/
pkg1.bb
classes/
pkg1.bbpkg1.bb
pkg1.bbpkg1.bbpkg2.bb
Recipe files & directory
for each package
Board-specific recipes
: Target
26Embedded Linux Conference 2015Embedded Linux Conference 2015
How to implement a recipe for "xyz" (modify)
1. Copy recipes from original poky directory
 $ cp –r meta/ORIGINAL/recipes-*/xyz meta/recipes-debian-
squeeze
2. Modify recipe files
 Change to fetch all sources from git repository
(Original recipes fetch sources from upstream site or Yocto
Project source repository)
3. Build test => Usually error occurs :(
 Because of lack of source repositories, patch rejects, missing
source files, build-dependency, include / link problems, …...
4. Re-modify recipe files to fix errors
27Embedded Linux Conference 2015Embedded Linux Conference 2015
Example: Recipe for "sed"
#
# sed_4.2.1.bb
#
DESCRIPTION = "sed is a Stream EDitor."
HOMEPAGE = "http://www.gnu.org/software/sed/"
...
#SRC_URI = "${GNU_MIRROR}/sed/sed-${PV}.tar.gz"
#SRC_URI[md5sum] = "f0fd4d7da574d4707e442285fd2d3b86"
#SRC_URI[sha256sum] =
"8773541ce097fdc4c5b9e7da12a82dffbb30cd91f7bc169f52f05f93b7fc3060"
inherit autotools update-alternatives gettext
...
BBCLASSEXTEND = "native"
#
# debian
#
inherit debian-squeeze
28Embedded Linux Conference 2015Embedded Linux Conference 2015
How to implement a recipe for "xyz" (create)
 Implement a recipe for "xyz" from scratch if
there is no original poky recipe
 Need to check the following:
 Proper configure & make options
 Build dependency
 Run-time dependency
 How to split output binaries to packages (.debs)
 And more…
29Embedded Linux Conference 2015
Poky-debian Quick Start
30Embedded Linux Conference 2015Embedded Linux Conference 2015
Setup poky-debian source tree
 Disable dash on Debian
 Select "no" in menu
 Download poky-debian
 Install dependent packages
$ sudo dpkg-reconfigure dash
$ mkdir $WORKDIR; cd $WORKDIR
$ git clone git://github.com/ystk/poky-debian.git
$ cd poky-debian
$ ./scripts/install-deps.sh
31Embedded Linux Conference 2015Embedded Linux Conference 2015
Setup poky-debian (Need to do every time)
 Setup build environment for target board
 This command means that we use "qemu for x86" as the
target board
 Build
 Output directory: build-qemux86/tmp/deploy/
$ . ./poky-debian/setup.sh qemux86
$ bitbake core-image-base
32Embedded Linux Conference 2015
Meta-debian
33Embedded Linux Conference 2015
Lessons learned from Poky-debian development
 Poky-debian has a lot of local rules
 As the result
 poky-debian cannot follow the Poky’s development tree
 Difficult to make it open
 Next time, we would like to create more friendly
one with Poky
Meta-debian
34Embedded Linux Conference 2015
What is meta-debian?
 Extending poky recipes to use Debian sources
 Based on newer Poky provided by Yocto Project
 Provide "meta-debian“ only
 All recipes and configuration are included in it
 Completely separated from OE-core (meta) and other layers
 Source code
 https://github.com/ystk/meta-debian.git
35Embedded Linux Conference 2015
Purpose
 Make everyone to be able to use Debian source
through Poky
 Would like to contribute something to Debian
long term support and use the source code with
Poky
 Keep reproducibility of each build
 Output more detail information about package
and license
36Embedded Linux Conference 2015
meta-debian : Basic information
 Debian version
 Debian GNU/Linux 8 (jessie)
 Poky version
 Yocto Project 1.6 Daisy
37Embedded Linux Conference 2015
Directory structure of poky and meta-debian
meta recipes-xxx pkg_1.0.bbpkg
classes
conf
files
meta-debian recipes-xxx pkg_debian.bbpkg
classes
conf
files
debian-package.bbclass
layer.conf
debian.confdistro
poky
38Embedded Linux Conference 2015
Directory structure of meta-debian
meta recipes-xxx pkg_1.0.bbpkg
classes
conf
files
meta-debian recipes-xxx pkg_debian.bbpkg
classes
conf
files
debian-package.bbclass
layer.conf
distro
poky
Defines Debian related global variables
ex: URI of mirror servers
debian.conf
Exported to recipes
39Embedded Linux Conference 2015
Directory structure of meta-debian
meta recipes-xxx pkg_1.0.bbpkg
classes
conf
files
meta-debian recipes-xxx pkg_debian.bbpkg
classes
conf
files
debian-package.bbclass
layer.conf
debian.confdistro
poky
Add debian dependent functions and variables
Inherited by
each recipe
40Embedded Linux Conference 2015
Directory structure of meta-debian
meta recipes-xxx pkg_1.0.bbpkg
classes
conf
files
meta-debian recipes-xxx pkg_debian.bbpkg
classes
conf
files
debian-package.bbclass
layer.conf
debian.confdistro
poky
Extract all definitions in a base recipe in meta by "require"
and
Overwrite basic variables and functions
"require" a base recipe
41Embedded Linux Conference 2015
Build directory structure
downloads
tmp
build
(file or archive)
git2 (git bare repo)
deploy images
licenses
deb
${PN}work ${PV}-${PR}(target) ${S}
image (${D})
packages-split
deploy-debs
temp
42Embedded Linux Conference 2015
Build directory structure
downloads
${PN}
tmp
build
(file or archive)
work ${PV}-${PR}
git2 (git bare repo)
deploy images
licenses
deb
(target) ${S}
image (${D})
packages-split
deploy-debs
temp
All sources required by recipes that inherits
debian-package.bbclass are fetched here
debian-package.bbclass always provides the following format:
gitAUTOINC+5ae5c2a7e8-r0deb0
original ${PR}git commit ID ${DPR}
43Embedded Linux Conference 2015
Build flow
bitbake tasks
(initialize)
do_fetch()
do_unpack()
do_debian_patch()
do_patch()
... ( same as original)
...
bitbake variables
PN = quilt-native
PV = debian
PR = r0
DPN = N/A
DPR = N/A
quilt.git
${DL_DIR}
poky
${WORKDIR}
localfileslocalfileslocalfiles
44Embedded Linux Conference 2015
Build flow
bitbake tasks
(initialize)
do_fetch()
do_unpack()
do_debian_patch()
do_patch()
... ( same as original)
...
bitbake variables
PN = quilt-native
PV = git${SRCPV}
PR = r0
DPN = quilt (${BPN})
DPR = 0
quilt.git
${DL_DIR}
poky
${WORKDIR}
gitAUTOINC+5ae5c2a7e8-r0deb0
original ${PR}git commit ID ${DPR}
Check target commit ID
before do_fetch
localfileslocalfileslocalfiles
45Embedded Linux Conference 2015
Build flow
bitbake tasks
(initialize)
do_fetch()
do_unpack()
do_debian_patch()
do_patch()
... ( same as original)
...
bitbake variables
PN = quilt-native
PV = git${SRCPV}
PR = r0
DPN = quilt (${BPN})
DPR = 0
quilt.git
${DL_DIR}
poky
${WORKDIR}
git2
quilt.git
git clone --bare
localfileslocalfileslocalfiles
localfileslocalfileslocalfiles.done
Check files
quilt.git.done
46Embedded Linux Conference 2015
Build flow
bitbake tasks
(initialize)
do_fetch()
do_unpack()
do_debian_patch()
do_patch()
... ( same as original)
...
quilt.git
${DL_DIR}
poky
${WORKDIR}
git2
quilt.git
localfileslocalfileslocalfiles
localfileslocalfileslocalfiles.done
quilt.git.done
Copy
localfileslocalfileslocalfilesgit
git checkout
bitbake variables
PN = quilt-native
PV = git${SRCPV}
PR = r0
DPN = quilt (${BPN})
DPR = 0
47Embedded Linux Conference 2015
Build flow
bitbake tasks
(initialize)
do_fetch()
do_unpack()
do_debian_patch()
do_patch()
... ( same as original)
...
quilt.git
${DL_DIR}
poky
${WORKDIR}
git2
quilt.git
localfileslocalfileslocalfiles
localfileslocalfileslocalfiles.done
quilt.git.done
localfileslocalfileslocalfilesgit
Apply debian/patches/*
bitbake variables
PN = quilt-native
PV = git${SRCPV}
PR = r0
DPN = quilt (${BPN})
DPR = 0
48Embedded Linux Conference 2015
Build flow
quilt.git
${DL_DIR}
poky
${WORKDIR}
git2
quilt.git
localfileslocalfileslocalfiles
localfileslocalfileslocalfiles.done
quilt.git.done
localfileslocalfileslocalfilesgit
Apply patches if exist
bitbake variables
PN = quilt-native
PV = git${SRCPV}
PR = r0
DPN = quilt (${BPN})
DPR = 0
bitbake tasks
(initialize)
do_fetch()
do_unpack()
do_debian_patch()
do_patch()
... ( same as original)
...
49Embedded Linux Conference 2015
Creating a recipe
50Embedded Linux Conference 2015
Sample recipe: quilt-native
 meta-debian/recipe-debian/quilt/quilt-
native_debian.bb
require recipes-devtools/quilt/${PN}_0.61.bb
FILESEXTRAPATHS_prepend = "${COREBASE}/meta/recipes-devtools/quilt/quilt:"
inherit debian-package
DPR = "0"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
SRC_URI = " ¥
file://install.patch ¥
file://run-ptest ¥
file://Makefile ¥
"
debian_patch_quilt() {
...
}
51Embedded Linux Conference 2015
Step 1: Create files and directories
 Create directory meta-debian/recipe-debian/quilt
 Same path as the base recipe in poky/meta
 Touch ${PN}_debian.bb
 PN = quilt-native
 PV = debian
 Create sub directories including local files if
needed
 Ex: files, ${PN}, ${BPN}, etc.
52Embedded Linux Conference 2015
Step 2: Define a base recipe
 Require a base recipe included in meta
 Find a base recipe from poky’s tree
 Sometimes ${PN} is not the same name as Debian source
package
 Ex: libusb
 PN = "libusb1"
 Debian source package name: "libusb-1.0"
 Add directories to FILESEXTRAPATHS if needed
 By default, bitbake doesn’t search files from the directory that
includes the base recipe which requires
require recipes-devtools/quilt/${PN}_0.61.bb
FILESEXTRAPATHS_prepend = "${COREBASE}/meta/recipes-devtools/quilt/quilt:"
53Embedded Linux Conference 2015
Step 3: Inherit debian-package
 Added/overwritten variables
 PN = quilt-native
 PV = git${SRCPV}
 PR = r0 (Same as PR in the base recipe)
 DPN ?= quilt (${BPN})
 DEBIAN_UNPACK_DIR ?= "${WORKDIR}/git"
 S = "${DEBIAN_UNPACK_DIR}"
 etc.
 Exported functions
 do_debian_patch
require recipes-devtools/quilt/${PN}_0.61.bb
FILESEXTRAPATHS_prepend = "${COREBASE}/meta/recipes-devtools/quilt/quilt:"
inherit debian-package
54Embedded Linux Conference 2015
Step 4: Add PR
 "0": Initial version
 Don’t forget to add 1 to this value when you
modified
 0 -> 1 -> 2 …
require recipes-devtools/quilt/${PN}_0.61.bb
FILESEXTRAPATHS_prepend = "${COREBASE}/meta/recipes-devtools/quilt/quilt:"
inherit debian-package
DPR = "0"
55Embedded Linux Conference 2015
Step 5: Add license information
 Always investigate source tree and set correct
values
 Don’t copy them from the base recipe
 Usually license information can be found in COPYING*,
LICENSE*
 Choose a license name from
meta/files/common-licenses if exists
require recipes-devtools/quilt/${PN}_0.61.bb
FILESEXTRAPATHS_prepend = "${COREBASE}/meta/recipes-devtools/quilt/quilt:"
inherit debian-package
DPR = "0"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
56Embedded Linux Conference 2015
Step 6: Overwrite SRC_URI
 Exclude the upstream source code
 Ex: http://download.savannah.gnu.org/releases/quilt/quilt-${PV}.tar.gz
 Add all local files (scripts, patches, etc.) to SRC_URI
 Need to solve problems if theses files conflict with Debian source
require recipes-devtools/quilt/${PN}_0.61.bb
FILESEXTRAPATHS_prepend = "${COREBASE}/meta/recipes-devtools/quilt/quilt:"
inherit debian-package
DPR = "0"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
SRC_URI = " ¥
file://install.patch ¥
file://run-ptest ¥
file://Makefile ¥
"
57Embedded Linux Conference 2015
Other rules about modifying recipes
 Don’t modify all files except meta-debian
 Don’t include specific hardware, company or
project related name and functions into meta-
debian
 Add only really essential DEPENDS and
RDEPENDS
 Always leave comments
 Why did you modify so? Nobody knows, you will forget it 
 (... And more, I’ll add them in future ... : TBD)
58Embedded Linux Conference 2015
Build
59Embedded Linux Conference 2015
Preparation
 Setup Poky and Meta-debian sources
$ cd $WORKDIR
(checkout poky)
$ git clone git://git.yoctoproject.org/poky.git
$ cd poky
$ git checkout daisy
(checkout meta-debian)
$ git clone git://github.com/ystk/meta-debian.git
$ cd meta-debian
$ git checkout daisy
60Embedded Linux Conference 2015
How to build recipes
 Run startup script
 Add "meta-debian" layer to conf/bblayers.conf
 Run bitbake
BBLAYERS ?= " ¥
/path/to/poky/meta ¥
/path/to/poky/meta-debian ¥
"
$ cd $WORKDIR
$ source /path/to/poky/oe-init-build-env
$ bitbake <build_target>
61Embedded Linux Conference 2015
Compareing Poky-debian and Meta-debian
Poky-debian Meta-debian
Poky version Edison Daisy
Debian version 6 (Squeeze) 8 (Jessie)
Kernel LTSI + RT patch LTSI + RT patch
Distribution Support Debian 6 Debian 8
Status Stable Under development
Number of packages 440 70
Number of BSPs 10 1
Debian binary compatibility NO NO
Yocto project compatible Absolutely not -
62Embedded Linux Conference 2015
 Please send your feedback
 E-mail: yoshitake.kobayashi@toshiba.co.jp
63Embedded Linux Conference 2015
 Thank you!
Thank you
64Embedded Linux Conference 2015Embedded Linux Conference 2015
Appendix
65Embedded Linux Conference 2015
More details for poky-debian
66Embedded Linux Conference 2015Embedded Linux Conference 2015
Poky-debian Overview
Poky
Common recipes
Recipes for A
(BSP-A)
Recipes for B
(BSP-B)
Recipes for C
(BSP-C)
kernel A
rootfs A
toolchain A
kernel B
rootfs B
toolchain B
kernel C
rootfs C
toolchain C
Kernel repo.
fetch
build build build
debian repo.
fetch
Other repo.
fetch
Upstream repo.
67Embedded Linux Conference 2015Embedded Linux Conference 2015
Directory structure
bitbake/
meta/
classes/
recipes-kernel/
recipes-core/
linux/
linux-libc-
headers
*.bb*.bb
*.bbclass*.bbclass
*.bb*.bb
busybox/ *.bb*.bb
Bitbake binaries & libraries
Common functions
Recipes & local files
conf/ *.conf
configuration
meta-bsp1/ conf/
recipes-core/
meta-bsp2/
*.conf
Board specific
busybox/
bsp-app/ *.bb*.bb
*.bbappend*.bbappend
override
meta/recipes-debian-squeeze/busybox/busybox_git.bb
meta/recipes-debian-squeeze/busybox/busybox_git.bbappend
68Embedded Linux Conference 2015Embedded Linux Conference 2015
Layeis (meta-*)
meta-X
meta-hoge
Common recipes (meta, meta-yocto)
meta-qemuarm meta-qemuarm meta-pandaboard
meta-Y meta-YOverride
hoge qemuarm + X qemuarm + Y panda + Y + Z
meta-Z 8
7
6
5
BBFILE_PRIORITY_xxx
69Embedded Linux Conference 2015Embedded Linux Conference 2015
Directory rules
 recipes-debian-squeeze
 All recipes in this directory fetch all sources from “Git server”
 DEBIAN_SQUEEZE_GIT_APP ?= git://github.com/ystk/debian-
 All recipes need to “inherit debian-squeeze”
 recipes-kernel
 All recipes in this directory fetch all sources from “Git server”
 DEBIAN_SQUEEZE_GIT_KERNEL ?= "git://github.com/ystk/linux-poky-debian.git”
 recipes-yocto
 All recipes in this directory fetch all sources from “Git server”
 DEBIAN_SQUEEZE_GIT_YOCTO ?= git://github.com/ystk/tools-yocto1-“
 These repositories are imported from non-Debian upstream used by original Poky
without modification
 All recipes need to “inherit debian-squeeze-yocto”
 No need to be modified in BSP layers
 recipes-poky
 All recipes in this directory never fetch source from remote servers (use only local file)
 conf
 Layer specific configuration, machine configuration, etc.
 All configuration files define variables applied ONLY to the layer
 classes
 This directory includes only common “class files” inherited by recipes in recipes-*
 No need to be modified in BSP layers
70Embedded Linux Conference 2015Embedded Linux Conference 2015
Contents
 conf/layer.conf
 Layer specific configuration (See later for more details)
 conf/bblayers.conf
 Define which layers are enabled
 Automatically copied to the build directory by setup.sh
 . ./poky-debian/setup.sh foo/bar
meta-foo/meta-bar/conf/bblayers.conf →
BUILD/conf/bblayers.conf
LCONF_VERSION = "4"
BBFILES ?= ""
BBLAYERS = " ¥
##COREBASE##/meta ¥
##COREBASE##/meta-yocto ¥
##COREBASE##/meta-beagleboard ¥
##COREBASE##/meta-target1/meta-sub1 ¥
##COREBASE##/meta-target1/meta-sub2 ¥
"
Don’t modify
Write additional layers
Don’t modify (Always required)
71Embedded Linux Conference 2015Embedded Linux Conference 2015
Contents
 conf/machine/*.conf
 Target board specific settings
 Typical settings are …
require conf/machine/include/tune-cortexa8.inc
IMAGE_FSTYPES += "tar.bz2 jffs2"
SERIAL_CONSOLE = "115200 ttyO2"
KERNEL_IMAGETYPE = "uImage"
EXTRA_IMAGEDEPENDS += "u-boot x-load"
CPU dependent settings
Use temprate .inc files under meta/
Ex: tune-armv7ahf.inc, tune-ppc750.inc
Type of rootfs
Ex: tar.gz, tar.bz2, ext2, ext3, jffs2
Serial console name and baudrate
Used in some core files like /etc/inittab
Additional recipes you want to build with rootfs
(Usually bootloaders are set)
Kernel image type
Ex: vmlinux, vmlinuz, zImage, uImage
72Embedded Linux Conference 2015Embedded Linux Conference 2015
Contents
 files/device-table/*.txt
 Device files which are installed statically
 Add it to IMAGE_DEVICE_TABLES in core-image-*.bb
 IMAGE_DEVICE_TABLES += “files/device-table/hoge.txt”
 Typical lists are already defined in meta/files/device-table
 Please define additional device files required only on target
board
 Structure# path type mode uid gid major minor start inc count
/dev d 755 0 0 - - - - -
/dev/console c 662 0 0 5 1 - - -
/dev/kmem c 640 0 15 1 2 - - -
/dev/mem c 640 0 15 1 1 - - -
/dev/null c 666 0 0 1 3 - - -
/dev/tty c 600 0 5 4 0 0 1 7
...
/dev/ttyO2 c 640 0 5 253 2 - - -
Board dependent device file
73Embedded Linux Conference 2015Embedded Linux Conference 2015
Contents
 recipes-debian-squeeze/xxx/xxx.bb
 recipes-poky/xxx/xxx.bb
 recipes-kernel/xxx/xxx.bb
 Recipes which are required only in this layer
 Please add a recipe under meta(common) if it’s able to be
shared with multiple layers
 recipes-debian-squeeze/xxx/xxx.bbappend
 recipes-poky/xxx/xxx.bbappend
 recipes-kernel/xxx/xxx.bbappend
 All settings in xxx.bbappend are appended to xxx.bb
 Ex: Override functions, add new functions, use another local
file, etc.
74Embedded Linux Conference 2015Embedded Linux Conference 2015
layer.conf
 Essential definitions
 MACHINE
 Name of target machine
 Ex: beagleboard, pandaboard, cubox
 Machine independent layers should not define this value
BBPATH := "${BBPATH}:${LAYERDIR}"
BBFILES := " ${BBFILES} ¥
${LAYERDIR}/recipes-*/*/*.bb ¥
${LAYERDIR}/recipes-*/*/*.bbappend ¥
"
BBFILE_COLLECTIONS += "xxx"
BBFILE_PATTERN_xxx := "^${LAYERDIR}/"
BBFILE_PRIORITY_xxx = "8"
File paths
Layer name and priority
75Embedded Linux Conference 2015Embedded Linux Conference 2015
layer.conf
 Kernel information
 LINUX_REPO: Repository name (linux-poky-debian.git)
 LINUX_SRCREV:
Branch name (the latest commit is used) or Tag name or Commit
ID
 LINUX_CONF: Path to config (arch/arm/configs/hoge_defconfig)
 See meta/classes/debian-squeeze-linux-checkout.bbclass for
more details
 RELEASE_VERSION
 Release version for each target
 Output to /etc/debian_version (See debian-squeeze-files.bb for
more details)
 Format
 ${debian_VERSION}-BOARDNAME-BOARDVERSION
 Ex: 1.0.1-myboard-2.0
76Embedded Linux Conference 2015Embedded Linux Conference 2015
layer.conf
 PREFERRED_PROVIDER_xxx = “x1”
 Bitbake uses “x1” as a ‘real’ recipe of “xxx”
 Ex
 PREFERRED_PROVIDER_gcc = “gcc-default”
 PREFERRED_PROVIDER_gcc = “gcc-linaro”
 PREFERRED_VERSION_xxx = “1.0”
 Bitbake uses “1.0” as a version of recipe “xxx”
 Default version: git (the latest commit is used)
 For example
 PREFERRED_VERSION_qt4-embedded = "4.8.2+dfsg-
2debian1"
77Embedded Linux Conference 2015Embedded Linux Conference 2015
layer.conf
 DISTRO_FEATURES
 DISTRO_FEATURES_append = “x11”
 http://www.yoctoproject.org/docs/1.1/poky-ref-manual/poky-
ref-manual.html#ref-features-distro
 Default value is defined in meta/conf/distro/include/default-
distrovars.inc
 It tells all recipes that specified “features” are enabled
 Examples of features: ipv4, ipv6, x11, etc.
 DEBIAN_SQUEEZE_FEATURES
 DEBIAN_SQUEEZE_FEATURES_append
 Deabin own features
 Default value is defined in meta/conf/distro/debian-
squeeze.conf
78Embedded Linux Conference 2015Embedded Linux Conference 2015
Update BSP
 Update kernel
 Modify the following variables if you update kernel
 LINUX_SRCREV, LINUX_CONF
 Update userland files
 Modify recipes in recipes-debian/*, recipes-poky/*
 Update release version
 First of all, build & install & run on the target system and
confirm that there is no problem
 Update RELEASE_VERSION and build image from nothing
79Embedded Linux Conference 2015Embedded Linux Conference 2015
Build images for release
 Ex: Use meta-foo/meta-bar as target BSP
 NOTE: Please build from nothing (clean build)
 Because all caches and unneeded sources should not be
included in snapshot information
 How to build
$ ls
poky-debian
$ . ./poky-debian/setup.sh foo/bar
$ bitbake core-image-base ← for rootfs
$ bitbake meta-toolchain ← for SDK
80Embedded Linux Conference 2015
Recipe development for
poky-debian
(Some slide has already obsoleted)
81Embedded Linux Conference 2015Embedded Linux Conference 2015
Recipe components
 Each recipe consists of the following three file
types:
 xyz_VERSION.bb
 Core file. It includes or inherits other subfiles
 xyz*.inc
 Included by .bb or other .inc files
 Usage of xyz.inc: include xyz.inc
 Directories (files/, xyz/, xyz-VERSION/)
 Includes local files (patchs, configuration files, etc.)
 Class recipes
 meta/classes/*.bbclass has basic common functions which
shared by all recipes that inherits it Take care to modify !
 Usage of abc.bbclass: inherit abc
82Embedded Linux Conference 2015Embedded Linux Conference 2015
Package's own variables
 PN
 PackageName (Ex: eglibc, busybox, etc.)
 PV
 PackageVersion (Ex: 2.11.2-10, 1.17.1-8)
 PR
 PackageRevesion (r0, r1, r2, ...)
 WORKDIR
 Top of the build directory
 build-$TARGET/tmp/work/$ARCH/${PN}-${PV}-${PV}
 S
 Source code directory path used by do_unpack* and do_patch*
 B
 Build directory path used by do_configure and do_compile
 D
 Destination directory path used by do_install
 These values are automatically set by bitbake
83Embedded Linux Conference 2015Embedded Linux Conference 2015
How to write a recipe for package "hoge"
 A. From scratch with a non-debian source (rare case)
 Add license information
 Add SRC_URI
 Set some variables or functions if needed
 B. From scratch with a debian source (rare case)
 Add license information
 Inherit debian class
 Inherit autotools class if needed
 Add SRC_URI if needed
 C. Use an existing recipe with a debian source
 Copy poky's original recipe
 Modify version
 Modify license information
 Inherit debian class
84Embedded Linux Conference 2015Embedded Linux Conference 2015
A-1. Add license information
 LICENSE: License name
 Usually written in ${S}/COPYING or ${S}/LICENSE
 LIC_FILES_CHKSUM: License filename + its
checksum
 Format: file://FILENAME;md5=CHECKSUM
 Base path of FILENAME is "${S}"
 You need to check the MD5 of COPYING by md5sum
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=1a2b3c..."
85Embedded Linux Conference 2015Embedded Linux Conference 2015
A-2. Add "SRC_URI"
 "SRC_URI" is a list of source codes,
configurations, or other support files
 bitbake fetches, unpacks and patches all files
listed in SRC_URI
 Archives (*.tar.gz, *.tar.bz2, etc.) are automatically unpacked
 Patches (*.diff.gz, *.patch, etc.) are automatically patched
SRC_URI = " ¥
http://url.to.archive/foo.tar.gz ¥
file://default_config ¥
"
86Embedded Linux Conference 2015Embedded Linux Conference 2015
B-1. Add license information
 Same as "A-1"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=1a2b3c..."
87Embedded Linux Conference 2015Embedded Linux Conference 2015
B-2. Inherit debian class
 Debian-squeeze class adds:
 do_fetch_srcpkg, do_unpack_srcpkg and do_patch_srcpkg
 These functions fetch, unpack, patch essential sources
automatically according to ${PN} and ${PV}
 No need to write debian source URI in each package
inherit debian-squeeze
88Embedded Linux Conference 2015Embedded Linux Conference 2015
B-3. Inherit autotools class
 autotools class adds:
 do_configure, do_make, do_install, etc. for autotools-based
sources
 Default functions are already defined in "base.bbclass", but
some functions (do_configure, do_install, etc.) are empty
 Don't inherit autotools if the source code is not
based on autotools
 Please implement do_configure, do_compile, do_install, etc.
from scratch
inherit autotools
89Embedded Linux Conference 2015Embedded Linux Conference 2015
B-4. Add other required files to "SRC_URI"
 Usually, only "inherit debian-squeeze" (source of
package) is required
 Need to add file URIs to "SRC_URI" if the
package requires some support files
 License file (COPYING)
 Default configuration file for "menuconfig"
 "rc" scripts to be installed to the target system
 Ex: /etc/init.d/sshd
SRC_URI = " ¥
file://COPYING ¥
file://default_config ¥
http://uri.to.sourcecode/poky-debian/rc-init.sh
"
90Embedded Linux Conference 2015Embedded Linux Conference 2015
C-1. Copy poky's recipe from ORIGINAL
 Check whether “foo/hoge_1.2.3.bb" is included
in meta/recipes-debian-squeeze/ or not before
copying
$ cp -r meta/ORIGINAL/recipes-???/foo meta/recipes-bar
91Embedded Linux Conference 2015Embedded Linux Conference 2015
C-2. Modify version
 Replace Poky's version (1.2.3) by Debian's
(1.2.1-4)
 The version of debian consists of two elements
separated by "-"
 Format: UpstreamVersion-debianVersion
 UpstreamVersion = 1.2.1
 debianVersion = 4
$ cd meta/recipes-bar/hoe
$ mv hoge_1.2.3.bb hoge_1.2.1-4.bb
92Embedded Linux Conference 2015Embedded Linux Conference 2015
C-3. Modify license information
 Same as "A-1"
 Need to modify license information if Debian's
license differs from poky's
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=1a2b3c..."
93Embedded Linux Conference 2015Embedded Linux Conference 2015
C-4. Inherit debian-squeeze class
 Same as "B-2"
inherit debian-squeeze
94Embedded Linux Conference 2015Embedded Linux Conference 2015
C-5. Modification rule example
 Modifing a recipe according to the following rules
#
# ORIGINAL FILENAME
#
...
...
#...
...
#
# debian
#
OUR DEFINITIONS
Write new definitions at the bottom
Write the original filename not to forget it
Comment out only (Don't add / delete)
95Embedded Linux Conference 2015Embedded Linux Conference 2015
Example A: Recipe for "hello"
 Implement a recipe to build the following
program
(hello.c)
 Makefile
#include <stdio.h>
int main()
{
printf("hello¥n");
return 0;
}
default: clean hello
hello: hello.o
clean:
rm -f hello *.o
96Embedded Linux Conference 2015Embedded Linux Conference 2015
Example A: Setup files
 Make a directory for hello
 Make a source code directory and copy hello.c,
Makefile and COPYING
 Make a recipe file for hello
$ mkdir meta/recipes-test/hello
$ cd meta/recipes-test/hello
$ mkdir -p hello/src
$ cd hello/src
$ emacs hello.c
$ emacs Makefile
$ touch COPYING # dummy
$ emacs meta/recipes-test/hello/hello_1.0.bb
97Embedded Linux Conference 2015Embedded Linux Conference 2015
Example A: Write a recipe
 Add license information
 Add source files ("src") to "SRC_URI"
 Define "S" and "B" for hello
 Define do_install function to install binaries
generated by our Makefile
 Run "bitbake hello"
98Embedded Linux Conference 2015Embedded Linux Conference 2015
Example A: Answer
LICENSE = "tmp"
LIC_FILES_CHKSUM = ¥
"file://COPYING;md5=d41d8cd98f00b204e9800998ecf8427e"
SRC_URI = "file://src"
S = ${WORKDIR}/src
B = ${S}
do_install() {
install -d ${D}/${bindir}
install -m 0755 ${B}/hello ${D}/${bindir}
}
99Embedded Linux Conference 2015Embedded Linux Conference 2015
Example C: Recipe for "sed"
 Copy a recipe from ORIGINAL
 Remove un-required files
 Rename "4.2.1" to the debian version
 Check the version of source archive for Debian
 Inherit debian-squeeze class
 Comment out all "SRC_URI"-related lines
$ cp meta/ORIGINAL/recipes-extended/sed meta/recipes-test
$ rm -f sed_4.1.2.bb sed-4.1.2/
100Embedded Linux Conference 2015Embedded Linux Conference 2015
Example C: Recipe for "sed"
#
# sed_4.2.1.bb
#
DESCRIPTION = "sed is a Stream EDitor."
HOMEPAGE = "http://www.gnu.org/software/sed/"
...
#SRC_URI = "${GNU_MIRROR}/sed/sed-${PV}.tar.gz"
#SRC_URI[md5sum] = "f0fd4d7da574d4707e442285fd2d3b86"
#SRC_URI[sha256sum] =
"8773541ce097fdc4c5b9e7da12a82dffbb30cd91f7bc169f52f05f93b7fc3060"
inherit autotools update-alternatives gettext
...
BBCLASSEXTEND = "native"
#
# debian
#
inherit debian-squeeze
101Embedded Linux Conference 2015
Kernel build
102Embedded Linux Conference 2015Embedded Linux Conference 2015
debian kernel repositories
 Sample kernel sources are able to download by
the following command
 The kernel repository consists:
 Source code branch
 v3.0-rt, etc.
 Modifications for the target board
 Poky-debian estimate to fetch all kernel source
from git reposirtory via git protocol
 Need to prepare sources and configurations using SDK
(toolchain) of poky-debian before build
git clone git://github.com/ystk/linux-poky-debian.git
103Embedded Linux Conference 2015Embedded Linux Conference 2015
Kernel recipes in poky-debian
bitbake binaries and libraries
Common recipes
& configurations
Common configurations
bitbake/
meta-muguet/
meta-qemux86/
meta-yocto/
meta/ recipes-debian-
squeeze/
recipes-yocto/
recipes-kernel/
recipes-poky/
pkg1/
pkg2/
pkg1.bb
classes/
pkg1.bbpkg1.bb
pkg1.bbpkg1.bbpkg2.bb
Recipe files & directory
for each package
Board-specific recipes
104Embedded Linux Conference 2015Embedded Linux Conference 2015
Kernel recipes in poky-debian
 meta/recipes-kernel/linux/linux_git.bb
 A sample recipe to build generic linux kernel
 Fetch linux kernel source from git server
 Inherit "debian-squeeze-linux.bbclass" instead of "debian-
squeeze.bbclass"
 meta/recipes-kernel/linux/linux-libc-
headers_git.bb
 Include kernel headers (Ex: /usr/include/linux/*.h)
 Used to build other userland packages
 Fetch the same file as "linux_git.bb"
 Inherit "debian-squeeze-linux-libc-headers.bbclass“ instead of
"debian-squeeze.bbclass"
105Embedded Linux Conference 2015Embedded Linux Conference 2015
linux_git.bb
 Variables
 LINUX_REPO
 Name of kernel repository (Ex: linux-poky-debian.git)
 Searched from ${DEBIAN_SQUEEZE_GIT}
 LINUX_BRANCH_SRC
 Name of source code branch
 Default: "master"
 LINUX_BRANCH_CONF
 Name of configuration branch
 Default: "configs"
 LINUX_COMMIT_SRC / LINUX_COMMIT_CONF
 Commit ID (hash value) of source code / configuration
 LINUX_CONF
 Name of configuration file in "configs" directory
106Embedded Linux Conference 2015Embedded Linux Conference 2015
linux_git.bb
 Example 1
 Fetch github.com/ystk/linux-debian.git
 Use the newest commit of "v3.0-rt" branch as a source
 Use "versatile_defconfig" in configs branch as a configuration
 Example 2
 Use two commits ("eb2..." and "1ea...") as a source & conf
LINUX_REPO = "linux-poky-debian.git"
LINUX_BRANCH_SRC = "v3.0-rt"
LINUX_BRANCH_CONF = "configs"
LINUX_CONF = "configs/v3.0/arm/versatile_defconfig"
LINUX_REPO = "linux-debian.git"
LINUX_COMMIT_SRC = "eb25ca22426dbaea10a4748c8741ccbc3aaa24c8"
LINUX_COMMIT_CONF = "1ea6b8f48918282bdca0b32a34095504ee65bab5"
LINUX_CONF = "configs/v3.0/arm/versatile_defconfig"
107Embedded Linux Conference 2015Embedded Linux Conference 2015
How to build?
 bitbake kernel
 Build directory
 build-${MACHINE}/tmp/work/${MACHINE}-poky-linux/linux-
git-r0
 Deployment
 build-${MACHINE}/tmp/deploy/images/zImage-
${MACHINE}.bin
$ bitbake virtual/kernel
108Embedded Linux Conference 2015Embedded Linux Conference 2015
How to customize the kernel? (menuconfig)
 Launch "screen"
 You can modify the configuration you choose
 You will get the following message:
 Generate new screen and type:
 Retry bitbake
$ bitbake -c clean virtual/kernel
$ rm -f sstate-cache/sstate-linux-*
$ bitbake -c menuconfig virtual/kernel
WARNING: Screen started. Please connect in another terminal with
"screen -r devshell"
$ screen -r devshell
109Embedded Linux Conference 2015
Debug
110Embedded Linux Conference 2015Embedded Linux Conference 2015
Build directory and deployment
 setup.source generates a build directory which named
"build-$MACHINE"
 bitbake outputs all files only to this directory
 The build directory consists of...
 conf
 Includes configuration files copied by setup.source
 downloads
 Includes all downloaded files fetched by do_fetch*
 tmp/work
 Work directories that bitbake uses to build each recipe
 tmp/sysroots
 Includes tools & libraries shared by all recipes
 Ex: native tools, cross compiler, cross libraries, headers, etc.
 tmp/deploy
 Final outputs are put into this directory
 kernel, rootfs, toolchain, etc.
111Embedded Linux Conference 2015Embedded Linux Conference 2015
Build directory and deployment
$TARGET/
build-$MACHINE/
tmp/downloads/
work/ deploy/
$NATIVE/ $MACHINE/
rootfs/kernel/rootfs/kernel/yyy/
rootfs/kernel/xxx/
sysroots/
112Embedded Linux Conference 2015Embedded Linux Conference 2015
Build directory and deployment
$TARGET/
build-$MACHINE/
tmp/downloads/
work/ deploy/
$NATIVE/ $MACHINE/
rootfs/kernel/rootfs/kernel/yyy/
rootfs/kernel/xxx/
sysroots/
fetch
Source archives
113Embedded Linux Conference 2015Embedded Linux Conference 2015
unpack
& build
Build directory and deployment
$TARGET/
build-$MACHINE/
tmp/downloads/
work/ deploy/
$NATIVE/ $MACHINE/
rootfs/kernel/rootfs/kernel/yyy/
rootfs/kernel/xxx/
sysroots/
114Embedded Linux Conference 2015Embedded Linux Conference 2015
Build directory and deployment
$TARGET/
build-$MACHINE/
tmp/downloads/
work/ deploy/
$NATIVE/ $MACHINE/
rootfs/kernel/rootfs/kernel/yyy/
rootfs/kernel/xxx/
sysroots/
Shared bins/libs/scripts
115Embedded Linux Conference 2015Embedded Linux Conference 2015
Build directory and deployment
$TARGET/
build-$MACHINE/
tmp/downloads/
work/ deploy/
$NATIVE/ $MACHINE/
rootfs/kernel/rootfs/kernel/yyy/
rootfs/kernel/xxx/
sysroots/
116Embedded Linux Conference 2015Embedded Linux Conference 2015
Build directory and deployment
 Each package build directory consists...
 temp
 Includes all log files and 'real' build scripts generated by
bitbake according to recipes
 Please check logs under this directory when some errors
occur
 ${S} = ${PN}-${PV}/
 Source directory unpacked by do_unpack
 ${D}: image/
 All outputs are put into this directory (usually by "make
install")
 deploy-debs
 All packaged files named "*.deb" are put into this directory
117Embedded Linux Conference 2015Embedded Linux Conference 2015
Errors
 Fetch errors caused by repository servers
 Errors caused by source directory structure
 Path-related errors
 libtool-related errors
 Manual-related errors
 Patch failures when we apply some poky's
patches
118Embedded Linux Conference 2015Embedded Linux Conference 2015
Fetch errors caused by repository servers
 Source archives not found
 Some packages don't exist on repository servers
 Please add the package to debian git repository yourself
 debian package name is different from poky's
 Ex: debian="lm-sensors-3" poky="lm-sensors"
 Use “DEBIAN_SQUEEZE_SRCPKG_NAME"
inherit debian
debian_SRCPKG_NAME = "lm-sensors-3"
lm-sensors_xxx.bb
119Embedded Linux Conference 2015Embedded Linux Conference 2015
Errors caused by source directory structure
 Structure of some source directories are different
from poky's source directories
 debian
pkgname-0.1-2/
Makefile, src.c, configure, ...
 poky
pkgname-0.1/
srcdir, support-tools, ...
Makefile, src.c, ...
 Please fix "S" and related functions such as
do_unpack
120Embedded Linux Conference 2015Embedded Linux Conference 2015
Path-related errors
 Sometimes, Makefile is hard-corded
 Ex: CC = gcc
 Cannot use cross compiler in poky in this case
 You may have some patches that resolve this
problem
 Ex: fix-path-xxx.patch
 You need to fix paths if there is no patches in
poky
121Embedded Linux Conference 2015Embedded Linux Conference 2015
libtool-related errors
 Some packages fail with libtool-related errors
 libtool
 One of autotools
 Compile, build, install libraries
 poky-debian uses internal libtool to build each
package
 Some packages need to be patched to use internal libtool
 Please search "libtool-xxx.patch" and apply it when you get
some libtool-related errors
122Embedded Linux Conference 2015Embedded Linux Conference 2015
Manual-related errors
 Some packages fail with manual-related errors
 manpage, documents, etc.
 Ex: help2man
 Please fix Makefile
 Delete rules to build manual or documents in Makefile
 No need to build manual or documents because we are
generating root file systems not for generic PC but for
embedded systems
123Embedded Linux Conference 2015Embedded Linux Conference 2015
Patch failures
 Need to apply some patches included in poky-
debian to build packages
 Usually, some patches reject 
 Because the pacthes assume that it is applied to poky's source
 But we use debian's source now
 Please fix patches by yourself..
124Embedded Linux Conference 2015Embedded Linux Conference 2015
How to create a new patch?
 First, backup (1) the original source files (such as
Makefile)
 Second, do bitbake
 The error occurs
 Third, (2) modify the source files and retry
bitbake
 Create a patch from difference between (1) and
(2) using "diff" command
 Add your patch to SRC_URI
SRC_URI = "my-patch.patch"
125Embedded Linux Conference 2015
Packaging
126Embedded Linux Conference 2015Embedded Linux Conference 2015
Build directory and deployment
 Build directory of each package consist of...
 temp
 Includes all log files and 'real' build scripts generated by
bitbake according to recipes
 Please check logs under this directory when some errors
occur
 ${S} = ${PN}-${PV}/
 Source directory unpacked by do_unpack
 ${D}: image/
 All outputs are put into this directory (usually by "make
install")
 deploy-debs
 All packaged files named "*.deb" are put into this directory
*.deb is a binary package format of Debian
127Embedded Linux Conference 2015Embedded Linux Conference 2015
How *.deb packages are created?
 After do_compile, we have some outputs of the
package under ${B}
build-${MACHINE}/.../${PN}-${PV}-${PR}/
${S}/ ${B}/
Usually same
Ex: ls, cat, su, etc.
128Embedded Linux Conference 2015Embedded Linux Conference 2015
 After do_install, outputs are put into ${D}
according to "make install"
How *.deb packages are created?
build-${MACHINE}/.../${PN}-${PV}-${PR}/
${S}/ ${B}/
Usually same
${D}/ (image/)
usr/bin/ sbin/
bin/ sbin/
Sometimes renamed
129Embedded Linux Conference 2015Embedded Linux Conference 2015
 In do_package* functions, each output file are
installed to "packages" and "packages-split"
directory
How *.deb packages are created?
build-${MACHINE}/.../${PN}-${PV}-${PR}/
${S}/ ${B}/
Usually same
${D}/ (image/)
usr/bin/ sbin/
bin/ sbin/
packages-split
1
130Embedded Linux Conference 2015Embedded Linux Conference 2015
 In do_package* functions, each output file are
installed to "packages" and "packages-split"
directory
How *.deb packages are created?
build-${MACHINE}/.../${PN}-${PV}-${PR}/
${S}/ ${B}/
Usually same
${D}/ (image/)
usr/bin/ sbin/
bin/ sbin/
packages-split
1 2
131Embedded Linux Conference 2015Embedded Linux Conference 2015
 Finally, split *.debs are generated in "deploy-
debs"
How *.deb packages are created?
build-${MACHINE}/.../${PN}-${PV}-${PR}/
${S}/ ${B}/
Usually same
${D}/ (image/)
usr/bin/ sbin/
bin/ sbin/
packages-split
1 2
deploy-
debs
1.deb 2.deb
132Embedded Linux Conference 2015Embedded Linux Conference 2015
How to control packaging?
 We can use the following variables to control
packaging
 PACKAGES
 The list of package name
 Ex: PACKAGES = "busybox busybox-module1 busybox-module2"
 FILES_xxx
 The list of files included in package "xxx"
 Ex: FILES_busybox-module1 = "${bindir}/bin1 ${sbindir}/bin2"
 RDEPENDS_xxx
 The list of packages "xxx" depends on
 Ex: RDEPENDS_busybox-module1 = "busybox-module2 mylib"
 NOTE: "DEPENDS" != "RDEPENDS"
 DEPENDS: "Build-time" dependency
 RDEPENDS: "Runtime" dependency
133Embedded Linux Conference 2015Embedded Linux Conference 2015
Dependency
busybox.deb
mylib_4.5.6.bb mylib.deb
busybox-module1.deb
busybox-module2.deb
Provides PACKAGES
busybox_1.2.3.bb
RDEPENDS
buildlib_7.8.bb
install
DEPENDS
buildlib
Used to build busybox
in sysroots

Contenu connexe

Tendances

PHP development with Docker
PHP development with DockerPHP development with Docker
PHP development with DockerYosh de Vos
 
Jump into Squeak - Integrate Squeak projects with Docker & Github
Jump into Squeak - Integrate Squeak projects with Docker & GithubJump into Squeak - Integrate Squeak projects with Docker & Github
Jump into Squeak - Integrate Squeak projects with Docker & Githubhubx
 
Run Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoRun Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoMarco Cavallini
 
Tutorial contributing to nf-core
Tutorial contributing to nf-coreTutorial contributing to nf-core
Tutorial contributing to nf-coreGisela Gabernet
 
Building a Video Encoding Pipeline at The New York Times
Building a Video Encoding Pipeline at The New York TimesBuilding a Video Encoding Pipeline at The New York Times
Building a Video Encoding Pipeline at The New York TimesMaxwell Dayvson Da Silva
 
Autobuilder2 Yocto Project Summit Lyon 2019
Autobuilder2 Yocto Project Summit Lyon 2019Autobuilder2 Yocto Project Summit Lyon 2019
Autobuilder2 Yocto Project Summit Lyon 2019Marco Cavallini
 
Select, manage, and backport the long term stable kernels
Select, manage, and backport the long term stable kernelsSelect, manage, and backport the long term stable kernels
Select, manage, and backport the long term stable kernelsSZ Lin
 
Distro Recipes 2013: What&rsquo;s new in gcc 4.8?
Distro Recipes 2013: What&rsquo;s new in gcc 4.8?Distro Recipes 2013: What&rsquo;s new in gcc 4.8?
Distro Recipes 2013: What&rsquo;s new in gcc 4.8?Anne Nicolas
 
Building a Video Encoding Pipeline at The New York Times
Building a Video Encoding Pipeline at The New York TimesBuilding a Video Encoding Pipeline at The New York Times
Building a Video Encoding Pipeline at The New York TimesFlávio Ribeiro
 
Distro Recipes 2013 : Upstream management and consequences on the distributi...
Distro Recipes 2013 : Upstream management and consequences on the  distributi...Distro Recipes 2013 : Upstream management and consequences on the  distributi...
Distro Recipes 2013 : Upstream management and consequences on the distributi...Anne Nicolas
 
Yocto Project introduction
Yocto Project introductionYocto Project introduction
Yocto Project introductionYi-Hsiu Hsu
 
Instalando Cacti no CentOS 5
Instalando Cacti no CentOS 5Instalando Cacti no CentOS 5
Instalando Cacti no CentOS 5Carlos Eduardo
 
Linux day 2016 Yocto Project
Linux day 2016 Yocto ProjectLinux day 2016 Yocto Project
Linux day 2016 Yocto ProjectMarco Cavallini
 
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...Marco Cavallini
 
Nuget is easier than you think and you should be using it as both a consumer ...
Nuget is easier than you think and you should be using it as both a consumer ...Nuget is easier than you think and you should be using it as both a consumer ...
Nuget is easier than you think and you should be using it as both a consumer ...Justin James
 
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDKYocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDKMarco Cavallini
 
Yocto project and open embedded training
Yocto project and open embedded trainingYocto project and open embedded training
Yocto project and open embedded trainingH Ming
 

Tendances (20)

PHP development with Docker
PHP development with DockerPHP development with Docker
PHP development with Docker
 
Jump into Squeak - Integrate Squeak projects with Docker & Github
Jump into Squeak - Integrate Squeak projects with Docker & GithubJump into Squeak - Integrate Squeak projects with Docker & Github
Jump into Squeak - Integrate Squeak projects with Docker & Github
 
Run Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoRun Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using Yocto
 
Tutorial contributing to nf-core
Tutorial contributing to nf-coreTutorial contributing to nf-core
Tutorial contributing to nf-core
 
Building a Video Encoding Pipeline at The New York Times
Building a Video Encoding Pipeline at The New York TimesBuilding a Video Encoding Pipeline at The New York Times
Building a Video Encoding Pipeline at The New York Times
 
Autobuilder2 Yocto Project Summit Lyon 2019
Autobuilder2 Yocto Project Summit Lyon 2019Autobuilder2 Yocto Project Summit Lyon 2019
Autobuilder2 Yocto Project Summit Lyon 2019
 
nf-core usage tutorial
nf-core usage tutorialnf-core usage tutorial
nf-core usage tutorial
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Select, manage, and backport the long term stable kernels
Select, manage, and backport the long term stable kernelsSelect, manage, and backport the long term stable kernels
Select, manage, and backport the long term stable kernels
 
Distro Recipes 2013: What&rsquo;s new in gcc 4.8?
Distro Recipes 2013: What&rsquo;s new in gcc 4.8?Distro Recipes 2013: What&rsquo;s new in gcc 4.8?
Distro Recipes 2013: What&rsquo;s new in gcc 4.8?
 
Building a Video Encoding Pipeline at The New York Times
Building a Video Encoding Pipeline at The New York TimesBuilding a Video Encoding Pipeline at The New York Times
Building a Video Encoding Pipeline at The New York Times
 
Distro Recipes 2013 : Upstream management and consequences on the distributi...
Distro Recipes 2013 : Upstream management and consequences on the  distributi...Distro Recipes 2013 : Upstream management and consequences on the  distributi...
Distro Recipes 2013 : Upstream management and consequences on the distributi...
 
Yocto Project introduction
Yocto Project introductionYocto Project introduction
Yocto Project introduction
 
Puppet evolutions
Puppet evolutionsPuppet evolutions
Puppet evolutions
 
Instalando Cacti no CentOS 5
Instalando Cacti no CentOS 5Instalando Cacti no CentOS 5
Instalando Cacti no CentOS 5
 
Linux day 2016 Yocto Project
Linux day 2016 Yocto ProjectLinux day 2016 Yocto Project
Linux day 2016 Yocto Project
 
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
 
Nuget is easier than you think and you should be using it as both a consumer ...
Nuget is easier than you think and you should be using it as both a consumer ...Nuget is easier than you think and you should be using it as both a consumer ...
Nuget is easier than you think and you should be using it as both a consumer ...
 
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDKYocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
 
Yocto project and open embedded training
Yocto project and open embedded trainingYocto project and open embedded training
Yocto project and open embedded training
 

En vedette

Deadline Miss Detection with SCHED_DEADLINE
Deadline Miss Detection with SCHED_DEADLINEDeadline Miss Detection with SCHED_DEADLINE
Deadline Miss Detection with SCHED_DEADLINEYoshitake Kobayashi
 
Funciones de busqueda y referencia
Funciones de busqueda y referenciaFunciones de busqueda y referencia
Funciones de busqueda y referenciagrovere
 
Moving Forward: Overcoming Compatibility Issues BoFs
Moving Forward: Overcoming Compatibility Issues BoFs Moving Forward: Overcoming Compatibility Issues BoFs
Moving Forward: Overcoming Compatibility Issues BoFs Yoshitake Kobayashi
 
3rd March 2017 - Becoming a true Christian
3rd March 2017 - Becoming a true Christian3rd March 2017 - Becoming a true Christian
3rd March 2017 - Becoming a true ChristianThorn Group Pvt Ltd
 
Ineffective and Effective Ways To Find Out Latency Bottlenecks With Ftrace
Ineffective and Effective Ways To Find Out Latency Bottlenecks With FtraceIneffective and Effective Ways To Find Out Latency Bottlenecks With Ftrace
Ineffective and Effective Ways To Find Out Latency Bottlenecks With FtraceYoshitake Kobayashi
 
Cours4.5 opérateurs recherche
Cours4.5 opérateurs rechercheCours4.5 opérateurs recherche
Cours4.5 opérateurs rechercheEvelyne Brémond
 
Grand Format "Jardins Ouverts, Jardins Clos" du 28/02/2017 - Présentation Fre...
Grand Format "Jardins Ouverts, Jardins Clos" du 28/02/2017 - Présentation Fre...Grand Format "Jardins Ouverts, Jardins Clos" du 28/02/2017 - Présentation Fre...
Grand Format "Jardins Ouverts, Jardins Clos" du 28/02/2017 - Présentation Fre...Petit Web
 
Actividades de Mantenimiento de Recipientes Sujetos a Presion
Actividades de Mantenimiento de Recipientes Sujetos a PresionActividades de Mantenimiento de Recipientes Sujetos a Presion
Actividades de Mantenimiento de Recipientes Sujetos a Presionjacobo_et
 
Retaining wall
Retaining wallRetaining wall
Retaining wall51412
 
SonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code QualitySonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code QualityLarry Nung
 
GoodPack_Marketing Deck_AMP for customer visit- USA -W. Wong
GoodPack_Marketing Deck_AMP for customer visit- USA -W. WongGoodPack_Marketing Deck_AMP for customer visit- USA -W. Wong
GoodPack_Marketing Deck_AMP for customer visit- USA -W. WongSo Pun
 
LLamado a arrendamiento de campo ganadero
LLamado a arrendamiento de campo ganaderoLLamado a arrendamiento de campo ganadero
LLamado a arrendamiento de campo ganaderoRenzo Paladino Valdez
 

En vedette (16)

Deadline Miss Detection with SCHED_DEADLINE
Deadline Miss Detection with SCHED_DEADLINEDeadline Miss Detection with SCHED_DEADLINE
Deadline Miss Detection with SCHED_DEADLINE
 
Webinar - "Transformar Oportunidades em Vendas através do Marketing Digital"
Webinar - "Transformar Oportunidades em Vendas através do Marketing Digital"Webinar - "Transformar Oportunidades em Vendas através do Marketing Digital"
Webinar - "Transformar Oportunidades em Vendas através do Marketing Digital"
 
Funciones de busqueda y referencia
Funciones de busqueda y referenciaFunciones de busqueda y referencia
Funciones de busqueda y referencia
 
Moving Forward: Overcoming Compatibility Issues BoFs
Moving Forward: Overcoming Compatibility Issues BoFs Moving Forward: Overcoming Compatibility Issues BoFs
Moving Forward: Overcoming Compatibility Issues BoFs
 
FUNDAMENTOS DE LAS HERRAMIENTAS WEB 2.0
FUNDAMENTOS DE LAS HERRAMIENTAS WEB 2.0FUNDAMENTOS DE LAS HERRAMIENTAS WEB 2.0
FUNDAMENTOS DE LAS HERRAMIENTAS WEB 2.0
 
Port.min
Port.minPort.min
Port.min
 
3rd March 2017 - Becoming a true Christian
3rd March 2017 - Becoming a true Christian3rd March 2017 - Becoming a true Christian
3rd March 2017 - Becoming a true Christian
 
Bioquímica celular
Bioquímica celularBioquímica celular
Bioquímica celular
 
Ineffective and Effective Ways To Find Out Latency Bottlenecks With Ftrace
Ineffective and Effective Ways To Find Out Latency Bottlenecks With FtraceIneffective and Effective Ways To Find Out Latency Bottlenecks With Ftrace
Ineffective and Effective Ways To Find Out Latency Bottlenecks With Ftrace
 
Cours4.5 opérateurs recherche
Cours4.5 opérateurs rechercheCours4.5 opérateurs recherche
Cours4.5 opérateurs recherche
 
Grand Format "Jardins Ouverts, Jardins Clos" du 28/02/2017 - Présentation Fre...
Grand Format "Jardins Ouverts, Jardins Clos" du 28/02/2017 - Présentation Fre...Grand Format "Jardins Ouverts, Jardins Clos" du 28/02/2017 - Présentation Fre...
Grand Format "Jardins Ouverts, Jardins Clos" du 28/02/2017 - Présentation Fre...
 
Actividades de Mantenimiento de Recipientes Sujetos a Presion
Actividades de Mantenimiento de Recipientes Sujetos a PresionActividades de Mantenimiento de Recipientes Sujetos a Presion
Actividades de Mantenimiento de Recipientes Sujetos a Presion
 
Retaining wall
Retaining wallRetaining wall
Retaining wall
 
SonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code QualitySonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code Quality
 
GoodPack_Marketing Deck_AMP for customer visit- USA -W. Wong
GoodPack_Marketing Deck_AMP for customer visit- USA -W. WongGoodPack_Marketing Deck_AMP for customer visit- USA -W. Wong
GoodPack_Marketing Deck_AMP for customer visit- USA -W. Wong
 
LLamado a arrendamiento de campo ganadero
LLamado a arrendamiento de campo ganaderoLLamado a arrendamiento de campo ganadero
LLamado a arrendamiento de campo ganadero
 

Similaire à Understanding How to Make an Embedded Linux Using Debian Source Code

The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project
 The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project
The Latest Status of CE Workgroup Shared Embedded Linux Distribution ProjectYoshitake Kobayashi
 
Install .Net Core, SQL Server V-Next on Linux and deploy .Net core applicatio...
Install .Net Core, SQL Server V-Next on Linux and deploy .Net core applicatio...Install .Net Core, SQL Server V-Next on Linux and deploy .Net core applicatio...
Install .Net Core, SQL Server V-Next on Linux and deploy .Net core applicatio...Ajith Ramawickrama
 
An Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating SystemAn Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating SystemLinaro
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Fabrice Bernhard
 
Generating a Reproducible and Maintainable Embedded Linux Environment with Po...
Generating a Reproducible and Maintainable Embedded Linux Environment with Po...Generating a Reproducible and Maintainable Embedded Linux Environment with Po...
Generating a Reproducible and Maintainable Embedded Linux Environment with Po...LF Events
 
LinuxKit and Moby, News from DockerCon 2017
LinuxKit and Moby, News from DockerCon 2017LinuxKit and Moby, News from DockerCon 2017
LinuxKit and Moby, News from DockerCon 2017Dieter Reuter
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Henry Schreiner
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!Levente Kurusa
 
LinuxKit and Moby, news from DockerCon 2017 - Austin,TX
LinuxKit and Moby, news from DockerCon 2017 - Austin,TXLinuxKit and Moby, news from DockerCon 2017 - Austin,TX
LinuxKit and Moby, news from DockerCon 2017 - Austin,TXDieter Reuter
 
Digital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meetingDigital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meetingHenry Schreiner
 
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data EverywhereApache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data EverywhereGanesh Raju
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
Bringing-it-all-together-overview-of-rpm-packaging-in-fedora
Bringing-it-all-together-overview-of-rpm-packaging-in-fedoraBringing-it-all-together-overview-of-rpm-packaging-in-fedora
Bringing-it-all-together-overview-of-rpm-packaging-in-fedoraLalatendu Mohanty
 
ASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerJürgen Gutsch
 

Similaire à Understanding How to Make an Embedded Linux Using Debian Source Code (20)

The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project
 The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project
The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project
 
Install .Net Core, SQL Server V-Next on Linux and deploy .Net core applicatio...
Install .Net Core, SQL Server V-Next on Linux and deploy .Net core applicatio...Install .Net Core, SQL Server V-Next on Linux and deploy .Net core applicatio...
Install .Net Core, SQL Server V-Next on Linux and deploy .Net core applicatio...
 
An Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating SystemAn Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating System
 
OpenEmbedded
OpenEmbeddedOpenEmbedded
OpenEmbedded
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Generating a Reproducible and Maintainable Embedded Linux Environment with Po...
Generating a Reproducible and Maintainable Embedded Linux Environment with Po...Generating a Reproducible and Maintainable Embedded Linux Environment with Po...
Generating a Reproducible and Maintainable Embedded Linux Environment with Po...
 
빈스톡 첫인상 with Git
빈스톡 첫인상 with Git빈스톡 첫인상 with Git
빈스톡 첫인상 with Git
 
LinuxKit and Moby, News from DockerCon 2017
LinuxKit and Moby, News from DockerCon 2017LinuxKit and Moby, News from DockerCon 2017
LinuxKit and Moby, News from DockerCon 2017
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!
 
LinuxKit and Moby, news from DockerCon 2017 - Austin,TX
LinuxKit and Moby, news from DockerCon 2017 - Austin,TXLinuxKit and Moby, news from DockerCon 2017 - Austin,TX
LinuxKit and Moby, news from DockerCon 2017 - Austin,TX
 
Git 101
Git 101Git 101
Git 101
 
Digital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meetingDigital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meeting
 
CICD_1670665418.pdf
CICD_1670665418.pdfCICD_1670665418.pdf
CICD_1670665418.pdf
 
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data EverywhereApache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
 
Building Embedded Linux UDOONEO
Building Embedded Linux UDOONEOBuilding Embedded Linux UDOONEO
Building Embedded Linux UDOONEO
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Bringing-it-all-together-overview-of-rpm-packaging-in-fedora
Bringing-it-all-together-overview-of-rpm-packaging-in-fedoraBringing-it-all-together-overview-of-rpm-packaging-in-fedora
Bringing-it-all-together-overview-of-rpm-packaging-in-fedora
 
ASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & docker
 

Plus de Yoshitake Kobayashi

InnerSource Learning Path (Japanese)
InnerSource Learning Path (Japanese)InnerSource Learning Path (Japanese)
InnerSource Learning Path (Japanese)Yoshitake Kobayashi
 
Civil Infrastructure Platform: Industrial Grade SLTS Kernel and Base-layer De...
Civil Infrastructure Platform: Industrial Grade SLTS Kernel and Base-layer De...Civil Infrastructure Platform: Industrial Grade SLTS Kernel and Base-layer De...
Civil Infrastructure Platform: Industrial Grade SLTS Kernel and Base-layer De...Yoshitake Kobayashi
 
SLTS kernel and base-layer development in the Civil Infrastructure Platform
SLTS kernel and base-layer development in the Civil Infrastructure PlatformSLTS kernel and base-layer development in the Civil Infrastructure Platform
SLTS kernel and base-layer development in the Civil Infrastructure PlatformYoshitake Kobayashi
 
Time is ready for the Civil Infrastructure Platform
Time is ready for the Civil Infrastructure PlatformTime is ready for the Civil Infrastructure Platform
Time is ready for the Civil Infrastructure PlatformYoshitake Kobayashi
 
Introducing the Civil Infrastructure Platform Project
Introducing the Civil Infrastructure Platform ProjectIntroducing the Civil Infrastructure Platform Project
Introducing the Civil Infrastructure Platform ProjectYoshitake Kobayashi
 
Introducing the Civil Infrastructure Platform
Introducing the Civil Infrastructure PlatformIntroducing the Civil Infrastructure Platform
Introducing the Civil Infrastructure PlatformYoshitake Kobayashi
 
Applying Linux to the Civil Infrastructure
Applying Linux to the Civil InfrastructureApplying Linux to the Civil Infrastructure
Applying Linux to the Civil InfrastructureYoshitake Kobayashi
 
Using Embedded Linux for Infrastructure Systems
Using Embedded Linux for Infrastructure SystemsUsing Embedded Linux for Infrastructure Systems
Using Embedded Linux for Infrastructure SystemsYoshitake Kobayashi
 
Using Real-Time Patch with LTSI Kernel
Using Real-Time Patch with LTSI KernelUsing Real-Time Patch with LTSI Kernel
Using Real-Time Patch with LTSI KernelYoshitake Kobayashi
 
An Essential Relationship between Real-time and Resource Partitioning
An Essential Relationship between Real-time and Resource PartitioningAn Essential Relationship between Real-time and Resource Partitioning
An Essential Relationship between Real-time and Resource PartitioningYoshitake Kobayashi
 
Improvement of Scheduling Granularity for Deadline Scheduler
Improvement of Scheduling Granularity for Deadline Scheduler Improvement of Scheduling Granularity for Deadline Scheduler
Improvement of Scheduling Granularity for Deadline Scheduler Yoshitake Kobayashi
 
Evaluation of Data Reliability on Linux File Systems
Evaluation of Data Reliability on Linux File SystemsEvaluation of Data Reliability on Linux File Systems
Evaluation of Data Reliability on Linux File SystemsYoshitake Kobayashi
 

Plus de Yoshitake Kobayashi (12)

InnerSource Learning Path (Japanese)
InnerSource Learning Path (Japanese)InnerSource Learning Path (Japanese)
InnerSource Learning Path (Japanese)
 
Civil Infrastructure Platform: Industrial Grade SLTS Kernel and Base-layer De...
Civil Infrastructure Platform: Industrial Grade SLTS Kernel and Base-layer De...Civil Infrastructure Platform: Industrial Grade SLTS Kernel and Base-layer De...
Civil Infrastructure Platform: Industrial Grade SLTS Kernel and Base-layer De...
 
SLTS kernel and base-layer development in the Civil Infrastructure Platform
SLTS kernel and base-layer development in the Civil Infrastructure PlatformSLTS kernel and base-layer development in the Civil Infrastructure Platform
SLTS kernel and base-layer development in the Civil Infrastructure Platform
 
Time is ready for the Civil Infrastructure Platform
Time is ready for the Civil Infrastructure PlatformTime is ready for the Civil Infrastructure Platform
Time is ready for the Civil Infrastructure Platform
 
Introducing the Civil Infrastructure Platform Project
Introducing the Civil Infrastructure Platform ProjectIntroducing the Civil Infrastructure Platform Project
Introducing the Civil Infrastructure Platform Project
 
Introducing the Civil Infrastructure Platform
Introducing the Civil Infrastructure PlatformIntroducing the Civil Infrastructure Platform
Introducing the Civil Infrastructure Platform
 
Applying Linux to the Civil Infrastructure
Applying Linux to the Civil InfrastructureApplying Linux to the Civil Infrastructure
Applying Linux to the Civil Infrastructure
 
Using Embedded Linux for Infrastructure Systems
Using Embedded Linux for Infrastructure SystemsUsing Embedded Linux for Infrastructure Systems
Using Embedded Linux for Infrastructure Systems
 
Using Real-Time Patch with LTSI Kernel
Using Real-Time Patch with LTSI KernelUsing Real-Time Patch with LTSI Kernel
Using Real-Time Patch with LTSI Kernel
 
An Essential Relationship between Real-time and Resource Partitioning
An Essential Relationship between Real-time and Resource PartitioningAn Essential Relationship between Real-time and Resource Partitioning
An Essential Relationship between Real-time and Resource Partitioning
 
Improvement of Scheduling Granularity for Deadline Scheduler
Improvement of Scheduling Granularity for Deadline Scheduler Improvement of Scheduling Granularity for Deadline Scheduler
Improvement of Scheduling Granularity for Deadline Scheduler
 
Evaluation of Data Reliability on Linux File Systems
Evaluation of Data Reliability on Linux File SystemsEvaluation of Data Reliability on Linux File Systems
Evaluation of Data Reliability on Linux File Systems
 

Dernier

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 

Dernier (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 

Understanding How to Make an Embedded Linux Using Debian Source Code

  • 1. Poky meets Debian: Understanding How to Make an Embedded Linux by Using an Existing Distribution's Source Code Embedded Linux Conference 2015 Yoshitake Kobayashi, TOSHIBA
  • 2. 2Embedded Linux Conference 2015Embedded Linux Conference 2015 Information  All source code are available at the following URL:  https://github.com/ystk  Poky-debian  https://github.com/ystk/poky-debian  Branch: master  Meta-debian  https://github.com/ystk/meta-debian  Branch: daisy
  • 3. 3Embedded Linux Conference 2015Embedded Linux Conference 2015 Can we create a “Standard Embedded Linux Distribution”? Embedded Linux Conference Europe 2014 It is really difficult!
  • 4. 4Embedded Linux Conference 2015Embedded Linux Conference 2015 How to choose a suitable distribution for you?  There are a lot of Linux distributions  Need to be considered the following  Usecases  Supported CPU architectures  X86, ARM, PowerPC, etc.  Number of packages  How many packages are enough?  Security fix support period for some distributions  Centos 10 years  OpenSUSE 3 years  Debian 3 years+2years(LTS)  Ubuntu 5 years  Gentoo Incremental update (rolling release)
  • 5. 5Embedded Linux Conference 2015Embedded Linux Conference 2015 Why Debian?  Would like to use Desktop and Embedded with a same source code base  Would like to build embedded Linux environment for the following CPUs  X86(32bit and 64bit)  ARM  PowerPC  might be others  Would like to use same package version in one major release
  • 6. 6Embedded Linux Conference 2015Embedded Linux Conference 2015 Why not Emdebian?  http://www.emdebian.org/  As of July 2014, updates to the Emdebian distributions ceased. There will be no further updates and no further stable releases.  Would like to customize more than Emdebian’s way
  • 7. 7Embedded Linux Conference 2015Embedded Linux Conference 2015 Why Poky?  Poky is one of the most popular reference distribution for embedded Linux  Would like to share the knowledge  Bitbake  Recipes  Tools
  • 8. 8Embedded Linux Conference 2015Embedded Linux Conference 2015 What we want?  Use Debian’s source code  Make custom embedded Linux environments  Would like to change it to open  Share knowledge with Yocto Project
  • 9. 9Embedded Linux Conference 2015Embedded Linux Conference 2015 Scope of this presentation  Introducing of the following two implementation  Poky-debian (BAD manners)  Meta-debian (GOOD manners)  Out of scope  What is the Yocto Project
  • 10. 10Embedded Linux Conference 2015 Compareing Poky-debian and Meta-debian Poky-debian Meta-debian Poky version Edison Daisy Debian version 6 (Squeeze) 8 (Jessie) Kernel LTSI + RT patch LTSI + RT patch Distribution Support Debian 6 Debian 8
  • 11. 11Embedded Linux Conference 2015 poky-debian
  • 12. 12Embedded Linux Conference 2015Embedded Linux Conference 2015 Introduction of Poky-debian  Replacing meta layer to adapt Debian source  Source code  https://github.com/ystk/poky-debian.git
  • 13. 13Embedded Linux Conference 2015Embedded Linux Conference 2015 What is "poky-debian" ?  Based on  Poky (Edison)  Debian 6 (squeeze-lts)  Generate Linux environment for embedded systems (x86, ARM, PowerPC, etc.)  Based on "poky" developed by Yocto Project  Kernel, rootfs and toolchain only from Debian source codes  Common sources + board-specific customization  Support distro  Debian 6 LTS (squeeze-lts) only  All build test has been done on x86-32bit environment
  • 14. 14Embedded Linux Conference 2015Embedded Linux Conference 2015 Goal of poky-debian  Build Debian based Linux environment for many embedded systems as quickly as possible  Generate "minimal" environemt for each requirement  Ex: Consists only busybox and libc  Share problems between all systems generated by it  Share know-how for embedded Linux system implementation  Improve traceability of all sources & customization
  • 15. 15Embedded Linux Conference 2015Embedded Linux Conference 2015 Packaging system structure Debian Package git repo. Kernel git repo. apt archive poky-debian Common recipes Auto builder (buildd) fetch build kernel A rootfs A fetch For generic system For embedded system Source pkgs Binary pkgs (.deb) fetch build kernel B rootfs B kernel C rootfs C Recipes for A Recipes for B Recipes for C
  • 16. 16Embedded Linux Conference 2015Embedded Linux Conference 2015 Build flow Build native tools Build target binaries (Applications and kernel) Build cross-compiling tools Build rootfs
  • 17. 17Embedded Linux Conference 2015Embedded Linux Conference 2015 Directory structure of poky-debian bitbake/ meta/ classes/ recipes-kernel/ recipes-core/ linux/ linux-libc- headers *.bb*.bb *.bbclass*.bbclass *.bb*.bb busybox/ *.bb*.bb Bitbake binaries & libraries Recipes & local files conf/ *.conf configuration meta-bsp1/ conf/ recipes-core/ meta-bsp2/ *.conf Board specific busybox/ bsp-app/ *.bb*.bb *.bbappend*.bbappend override meta/recipes-debian-squeeze/busybox/busybox_git.bb meta/recipes-debian-squeeze/busybox/busybox_git.bbappend Common functions ( Added debian-squeeze*.conf )
  • 18. 18Embedded Linux Conference 2015Embedded Linux Conference 2015 Core components  bitbake  Core build tool of poky  Parse all recipes and run all build actions  Ex: To build busybox, run $ bitbake busybox  Recipes (*.bb)  Defines how to build each package, kernel, rootfs, toolchain, etc.  Written in shell & python based script  Actions in some recipes depend on other recipes  Configuration (.conf)  Defines machine or build environment-specific values
  • 19. 19Embedded Linux Conference 2015Embedded Linux Conference 2015 The relation of core components *.conf eglibc.bb busybox.bb openssh.bb openssl.bb gcc-cross.bb binutils-cross.bb rootfs.bb xxx.bbxxx.bbxxx.bb $ bitbake rootfs depend target cross depend native depend *.conf*.conf load xxx.bbxxx.bbxxx eglibc openssh rootfs build build build build busybox openssl gcc-cross binutils-cross Added debian-squeeze*.conf
  • 20. 20Embedded Linux Conference 2015Embedded Linux Conference 2015 Build tasks  Each recipe has the following "task": 1. do_fetch*: Fetch source to the download directory 2. do_unpack*: Checkout git, unpack archives, etc. 3. do_patch*: Apply local patches 4. do_configure: Do $ ./configure 5. do_compile: Do $ make 6. do_install: Do $ make install ……..  Each task is defined as a function in a recipe do_unpack() { tar xzf … } do_compile() { export ARG1=… export ARG2=… make } do_install() { install -d … install -m 0755 … } ……
  • 21. 21Embedded Linux Conference 2015 Developing recipes for poky-debian
  • 22. 22Embedded Linux Conference 2015Embedded Linux Conference 2015 Issues  At least 200-300 packages are required to apply poky-debian to embedded systems  Social Infrastructure, power system, train/highway, medical, …  Need to implement & update many "common" recipes for Poky-debian  "common" means "not depend on target system"  All recipes for board X are created based on "common" recipes
  • 23. 23Embedded Linux Conference 2015Embedded Linux Conference 2015 Packaging system structure (target) Package git repo. Kernel git repo. apt archive poky-debian Common recipes Auto builder (buildd) fetch build kernel A rootfs A fetch For generic system For embedded system Source pkgs Binary pkgs (.deb) fetch build kernel B rootfs B kernel C rootfs C Recipes for A Recipes for B Recipes for C
  • 24. 24Embedded Linux Conference 2015Embedded Linux Conference 2015 Why BAD manners?  First step  Move all original recipes to somewhere… 
  • 25. 25Embedded Linux Conference 2015Embedded Linux Conference 2015 Directory structure bitbake binaries and libraries Common recipes & configurations Common configurations bitbake/ meta-pandaboard/ meta-qemux86/ meta-yocto/ meta/ recipes-debian- squeeze/ recipes-yocto/ recipes-kernel/ recipes-poky/ pkg1/ pkg2/ pkg1.bb classes/ pkg1.bbpkg1.bb pkg1.bbpkg1.bbpkg2.bb Recipe files & directory for each package Board-specific recipes : Target
  • 26. 26Embedded Linux Conference 2015Embedded Linux Conference 2015 How to implement a recipe for "xyz" (modify) 1. Copy recipes from original poky directory  $ cp –r meta/ORIGINAL/recipes-*/xyz meta/recipes-debian- squeeze 2. Modify recipe files  Change to fetch all sources from git repository (Original recipes fetch sources from upstream site or Yocto Project source repository) 3. Build test => Usually error occurs :(  Because of lack of source repositories, patch rejects, missing source files, build-dependency, include / link problems, …... 4. Re-modify recipe files to fix errors
  • 27. 27Embedded Linux Conference 2015Embedded Linux Conference 2015 Example: Recipe for "sed" # # sed_4.2.1.bb # DESCRIPTION = "sed is a Stream EDitor." HOMEPAGE = "http://www.gnu.org/software/sed/" ... #SRC_URI = "${GNU_MIRROR}/sed/sed-${PV}.tar.gz" #SRC_URI[md5sum] = "f0fd4d7da574d4707e442285fd2d3b86" #SRC_URI[sha256sum] = "8773541ce097fdc4c5b9e7da12a82dffbb30cd91f7bc169f52f05f93b7fc3060" inherit autotools update-alternatives gettext ... BBCLASSEXTEND = "native" # # debian # inherit debian-squeeze
  • 28. 28Embedded Linux Conference 2015Embedded Linux Conference 2015 How to implement a recipe for "xyz" (create)  Implement a recipe for "xyz" from scratch if there is no original poky recipe  Need to check the following:  Proper configure & make options  Build dependency  Run-time dependency  How to split output binaries to packages (.debs)  And more…
  • 29. 29Embedded Linux Conference 2015 Poky-debian Quick Start
  • 30. 30Embedded Linux Conference 2015Embedded Linux Conference 2015 Setup poky-debian source tree  Disable dash on Debian  Select "no" in menu  Download poky-debian  Install dependent packages $ sudo dpkg-reconfigure dash $ mkdir $WORKDIR; cd $WORKDIR $ git clone git://github.com/ystk/poky-debian.git $ cd poky-debian $ ./scripts/install-deps.sh
  • 31. 31Embedded Linux Conference 2015Embedded Linux Conference 2015 Setup poky-debian (Need to do every time)  Setup build environment for target board  This command means that we use "qemu for x86" as the target board  Build  Output directory: build-qemux86/tmp/deploy/ $ . ./poky-debian/setup.sh qemux86 $ bitbake core-image-base
  • 32. 32Embedded Linux Conference 2015 Meta-debian
  • 33. 33Embedded Linux Conference 2015 Lessons learned from Poky-debian development  Poky-debian has a lot of local rules  As the result  poky-debian cannot follow the Poky’s development tree  Difficult to make it open  Next time, we would like to create more friendly one with Poky Meta-debian
  • 34. 34Embedded Linux Conference 2015 What is meta-debian?  Extending poky recipes to use Debian sources  Based on newer Poky provided by Yocto Project  Provide "meta-debian“ only  All recipes and configuration are included in it  Completely separated from OE-core (meta) and other layers  Source code  https://github.com/ystk/meta-debian.git
  • 35. 35Embedded Linux Conference 2015 Purpose  Make everyone to be able to use Debian source through Poky  Would like to contribute something to Debian long term support and use the source code with Poky  Keep reproducibility of each build  Output more detail information about package and license
  • 36. 36Embedded Linux Conference 2015 meta-debian : Basic information  Debian version  Debian GNU/Linux 8 (jessie)  Poky version  Yocto Project 1.6 Daisy
  • 37. 37Embedded Linux Conference 2015 Directory structure of poky and meta-debian meta recipes-xxx pkg_1.0.bbpkg classes conf files meta-debian recipes-xxx pkg_debian.bbpkg classes conf files debian-package.bbclass layer.conf debian.confdistro poky
  • 38. 38Embedded Linux Conference 2015 Directory structure of meta-debian meta recipes-xxx pkg_1.0.bbpkg classes conf files meta-debian recipes-xxx pkg_debian.bbpkg classes conf files debian-package.bbclass layer.conf distro poky Defines Debian related global variables ex: URI of mirror servers debian.conf Exported to recipes
  • 39. 39Embedded Linux Conference 2015 Directory structure of meta-debian meta recipes-xxx pkg_1.0.bbpkg classes conf files meta-debian recipes-xxx pkg_debian.bbpkg classes conf files debian-package.bbclass layer.conf debian.confdistro poky Add debian dependent functions and variables Inherited by each recipe
  • 40. 40Embedded Linux Conference 2015 Directory structure of meta-debian meta recipes-xxx pkg_1.0.bbpkg classes conf files meta-debian recipes-xxx pkg_debian.bbpkg classes conf files debian-package.bbclass layer.conf debian.confdistro poky Extract all definitions in a base recipe in meta by "require" and Overwrite basic variables and functions "require" a base recipe
  • 41. 41Embedded Linux Conference 2015 Build directory structure downloads tmp build (file or archive) git2 (git bare repo) deploy images licenses deb ${PN}work ${PV}-${PR}(target) ${S} image (${D}) packages-split deploy-debs temp
  • 42. 42Embedded Linux Conference 2015 Build directory structure downloads ${PN} tmp build (file or archive) work ${PV}-${PR} git2 (git bare repo) deploy images licenses deb (target) ${S} image (${D}) packages-split deploy-debs temp All sources required by recipes that inherits debian-package.bbclass are fetched here debian-package.bbclass always provides the following format: gitAUTOINC+5ae5c2a7e8-r0deb0 original ${PR}git commit ID ${DPR}
  • 43. 43Embedded Linux Conference 2015 Build flow bitbake tasks (initialize) do_fetch() do_unpack() do_debian_patch() do_patch() ... ( same as original) ... bitbake variables PN = quilt-native PV = debian PR = r0 DPN = N/A DPR = N/A quilt.git ${DL_DIR} poky ${WORKDIR} localfileslocalfileslocalfiles
  • 44. 44Embedded Linux Conference 2015 Build flow bitbake tasks (initialize) do_fetch() do_unpack() do_debian_patch() do_patch() ... ( same as original) ... bitbake variables PN = quilt-native PV = git${SRCPV} PR = r0 DPN = quilt (${BPN}) DPR = 0 quilt.git ${DL_DIR} poky ${WORKDIR} gitAUTOINC+5ae5c2a7e8-r0deb0 original ${PR}git commit ID ${DPR} Check target commit ID before do_fetch localfileslocalfileslocalfiles
  • 45. 45Embedded Linux Conference 2015 Build flow bitbake tasks (initialize) do_fetch() do_unpack() do_debian_patch() do_patch() ... ( same as original) ... bitbake variables PN = quilt-native PV = git${SRCPV} PR = r0 DPN = quilt (${BPN}) DPR = 0 quilt.git ${DL_DIR} poky ${WORKDIR} git2 quilt.git git clone --bare localfileslocalfileslocalfiles localfileslocalfileslocalfiles.done Check files quilt.git.done
  • 46. 46Embedded Linux Conference 2015 Build flow bitbake tasks (initialize) do_fetch() do_unpack() do_debian_patch() do_patch() ... ( same as original) ... quilt.git ${DL_DIR} poky ${WORKDIR} git2 quilt.git localfileslocalfileslocalfiles localfileslocalfileslocalfiles.done quilt.git.done Copy localfileslocalfileslocalfilesgit git checkout bitbake variables PN = quilt-native PV = git${SRCPV} PR = r0 DPN = quilt (${BPN}) DPR = 0
  • 47. 47Embedded Linux Conference 2015 Build flow bitbake tasks (initialize) do_fetch() do_unpack() do_debian_patch() do_patch() ... ( same as original) ... quilt.git ${DL_DIR} poky ${WORKDIR} git2 quilt.git localfileslocalfileslocalfiles localfileslocalfileslocalfiles.done quilt.git.done localfileslocalfileslocalfilesgit Apply debian/patches/* bitbake variables PN = quilt-native PV = git${SRCPV} PR = r0 DPN = quilt (${BPN}) DPR = 0
  • 48. 48Embedded Linux Conference 2015 Build flow quilt.git ${DL_DIR} poky ${WORKDIR} git2 quilt.git localfileslocalfileslocalfiles localfileslocalfileslocalfiles.done quilt.git.done localfileslocalfileslocalfilesgit Apply patches if exist bitbake variables PN = quilt-native PV = git${SRCPV} PR = r0 DPN = quilt (${BPN}) DPR = 0 bitbake tasks (initialize) do_fetch() do_unpack() do_debian_patch() do_patch() ... ( same as original) ...
  • 49. 49Embedded Linux Conference 2015 Creating a recipe
  • 50. 50Embedded Linux Conference 2015 Sample recipe: quilt-native  meta-debian/recipe-debian/quilt/quilt- native_debian.bb require recipes-devtools/quilt/${PN}_0.61.bb FILESEXTRAPATHS_prepend = "${COREBASE}/meta/recipes-devtools/quilt/quilt:" inherit debian-package DPR = "0" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" SRC_URI = " ¥ file://install.patch ¥ file://run-ptest ¥ file://Makefile ¥ " debian_patch_quilt() { ... }
  • 51. 51Embedded Linux Conference 2015 Step 1: Create files and directories  Create directory meta-debian/recipe-debian/quilt  Same path as the base recipe in poky/meta  Touch ${PN}_debian.bb  PN = quilt-native  PV = debian  Create sub directories including local files if needed  Ex: files, ${PN}, ${BPN}, etc.
  • 52. 52Embedded Linux Conference 2015 Step 2: Define a base recipe  Require a base recipe included in meta  Find a base recipe from poky’s tree  Sometimes ${PN} is not the same name as Debian source package  Ex: libusb  PN = "libusb1"  Debian source package name: "libusb-1.0"  Add directories to FILESEXTRAPATHS if needed  By default, bitbake doesn’t search files from the directory that includes the base recipe which requires require recipes-devtools/quilt/${PN}_0.61.bb FILESEXTRAPATHS_prepend = "${COREBASE}/meta/recipes-devtools/quilt/quilt:"
  • 53. 53Embedded Linux Conference 2015 Step 3: Inherit debian-package  Added/overwritten variables  PN = quilt-native  PV = git${SRCPV}  PR = r0 (Same as PR in the base recipe)  DPN ?= quilt (${BPN})  DEBIAN_UNPACK_DIR ?= "${WORKDIR}/git"  S = "${DEBIAN_UNPACK_DIR}"  etc.  Exported functions  do_debian_patch require recipes-devtools/quilt/${PN}_0.61.bb FILESEXTRAPATHS_prepend = "${COREBASE}/meta/recipes-devtools/quilt/quilt:" inherit debian-package
  • 54. 54Embedded Linux Conference 2015 Step 4: Add PR  "0": Initial version  Don’t forget to add 1 to this value when you modified  0 -> 1 -> 2 … require recipes-devtools/quilt/${PN}_0.61.bb FILESEXTRAPATHS_prepend = "${COREBASE}/meta/recipes-devtools/quilt/quilt:" inherit debian-package DPR = "0"
  • 55. 55Embedded Linux Conference 2015 Step 5: Add license information  Always investigate source tree and set correct values  Don’t copy them from the base recipe  Usually license information can be found in COPYING*, LICENSE*  Choose a license name from meta/files/common-licenses if exists require recipes-devtools/quilt/${PN}_0.61.bb FILESEXTRAPATHS_prepend = "${COREBASE}/meta/recipes-devtools/quilt/quilt:" inherit debian-package DPR = "0" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
  • 56. 56Embedded Linux Conference 2015 Step 6: Overwrite SRC_URI  Exclude the upstream source code  Ex: http://download.savannah.gnu.org/releases/quilt/quilt-${PV}.tar.gz  Add all local files (scripts, patches, etc.) to SRC_URI  Need to solve problems if theses files conflict with Debian source require recipes-devtools/quilt/${PN}_0.61.bb FILESEXTRAPATHS_prepend = "${COREBASE}/meta/recipes-devtools/quilt/quilt:" inherit debian-package DPR = "0" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" SRC_URI = " ¥ file://install.patch ¥ file://run-ptest ¥ file://Makefile ¥ "
  • 57. 57Embedded Linux Conference 2015 Other rules about modifying recipes  Don’t modify all files except meta-debian  Don’t include specific hardware, company or project related name and functions into meta- debian  Add only really essential DEPENDS and RDEPENDS  Always leave comments  Why did you modify so? Nobody knows, you will forget it   (... And more, I’ll add them in future ... : TBD)
  • 59. 59Embedded Linux Conference 2015 Preparation  Setup Poky and Meta-debian sources $ cd $WORKDIR (checkout poky) $ git clone git://git.yoctoproject.org/poky.git $ cd poky $ git checkout daisy (checkout meta-debian) $ git clone git://github.com/ystk/meta-debian.git $ cd meta-debian $ git checkout daisy
  • 60. 60Embedded Linux Conference 2015 How to build recipes  Run startup script  Add "meta-debian" layer to conf/bblayers.conf  Run bitbake BBLAYERS ?= " ¥ /path/to/poky/meta ¥ /path/to/poky/meta-debian ¥ " $ cd $WORKDIR $ source /path/to/poky/oe-init-build-env $ bitbake <build_target>
  • 61. 61Embedded Linux Conference 2015 Compareing Poky-debian and Meta-debian Poky-debian Meta-debian Poky version Edison Daisy Debian version 6 (Squeeze) 8 (Jessie) Kernel LTSI + RT patch LTSI + RT patch Distribution Support Debian 6 Debian 8 Status Stable Under development Number of packages 440 70 Number of BSPs 10 1 Debian binary compatibility NO NO Yocto project compatible Absolutely not -
  • 62. 62Embedded Linux Conference 2015  Please send your feedback  E-mail: yoshitake.kobayashi@toshiba.co.jp
  • 63. 63Embedded Linux Conference 2015  Thank you! Thank you
  • 64. 64Embedded Linux Conference 2015Embedded Linux Conference 2015 Appendix
  • 65. 65Embedded Linux Conference 2015 More details for poky-debian
  • 66. 66Embedded Linux Conference 2015Embedded Linux Conference 2015 Poky-debian Overview Poky Common recipes Recipes for A (BSP-A) Recipes for B (BSP-B) Recipes for C (BSP-C) kernel A rootfs A toolchain A kernel B rootfs B toolchain B kernel C rootfs C toolchain C Kernel repo. fetch build build build debian repo. fetch Other repo. fetch Upstream repo.
  • 67. 67Embedded Linux Conference 2015Embedded Linux Conference 2015 Directory structure bitbake/ meta/ classes/ recipes-kernel/ recipes-core/ linux/ linux-libc- headers *.bb*.bb *.bbclass*.bbclass *.bb*.bb busybox/ *.bb*.bb Bitbake binaries & libraries Common functions Recipes & local files conf/ *.conf configuration meta-bsp1/ conf/ recipes-core/ meta-bsp2/ *.conf Board specific busybox/ bsp-app/ *.bb*.bb *.bbappend*.bbappend override meta/recipes-debian-squeeze/busybox/busybox_git.bb meta/recipes-debian-squeeze/busybox/busybox_git.bbappend
  • 68. 68Embedded Linux Conference 2015Embedded Linux Conference 2015 Layeis (meta-*) meta-X meta-hoge Common recipes (meta, meta-yocto) meta-qemuarm meta-qemuarm meta-pandaboard meta-Y meta-YOverride hoge qemuarm + X qemuarm + Y panda + Y + Z meta-Z 8 7 6 5 BBFILE_PRIORITY_xxx
  • 69. 69Embedded Linux Conference 2015Embedded Linux Conference 2015 Directory rules  recipes-debian-squeeze  All recipes in this directory fetch all sources from “Git server”  DEBIAN_SQUEEZE_GIT_APP ?= git://github.com/ystk/debian-  All recipes need to “inherit debian-squeeze”  recipes-kernel  All recipes in this directory fetch all sources from “Git server”  DEBIAN_SQUEEZE_GIT_KERNEL ?= "git://github.com/ystk/linux-poky-debian.git”  recipes-yocto  All recipes in this directory fetch all sources from “Git server”  DEBIAN_SQUEEZE_GIT_YOCTO ?= git://github.com/ystk/tools-yocto1-“  These repositories are imported from non-Debian upstream used by original Poky without modification  All recipes need to “inherit debian-squeeze-yocto”  No need to be modified in BSP layers  recipes-poky  All recipes in this directory never fetch source from remote servers (use only local file)  conf  Layer specific configuration, machine configuration, etc.  All configuration files define variables applied ONLY to the layer  classes  This directory includes only common “class files” inherited by recipes in recipes-*  No need to be modified in BSP layers
  • 70. 70Embedded Linux Conference 2015Embedded Linux Conference 2015 Contents  conf/layer.conf  Layer specific configuration (See later for more details)  conf/bblayers.conf  Define which layers are enabled  Automatically copied to the build directory by setup.sh  . ./poky-debian/setup.sh foo/bar meta-foo/meta-bar/conf/bblayers.conf → BUILD/conf/bblayers.conf LCONF_VERSION = "4" BBFILES ?= "" BBLAYERS = " ¥ ##COREBASE##/meta ¥ ##COREBASE##/meta-yocto ¥ ##COREBASE##/meta-beagleboard ¥ ##COREBASE##/meta-target1/meta-sub1 ¥ ##COREBASE##/meta-target1/meta-sub2 ¥ " Don’t modify Write additional layers Don’t modify (Always required)
  • 71. 71Embedded Linux Conference 2015Embedded Linux Conference 2015 Contents  conf/machine/*.conf  Target board specific settings  Typical settings are … require conf/machine/include/tune-cortexa8.inc IMAGE_FSTYPES += "tar.bz2 jffs2" SERIAL_CONSOLE = "115200 ttyO2" KERNEL_IMAGETYPE = "uImage" EXTRA_IMAGEDEPENDS += "u-boot x-load" CPU dependent settings Use temprate .inc files under meta/ Ex: tune-armv7ahf.inc, tune-ppc750.inc Type of rootfs Ex: tar.gz, tar.bz2, ext2, ext3, jffs2 Serial console name and baudrate Used in some core files like /etc/inittab Additional recipes you want to build with rootfs (Usually bootloaders are set) Kernel image type Ex: vmlinux, vmlinuz, zImage, uImage
  • 72. 72Embedded Linux Conference 2015Embedded Linux Conference 2015 Contents  files/device-table/*.txt  Device files which are installed statically  Add it to IMAGE_DEVICE_TABLES in core-image-*.bb  IMAGE_DEVICE_TABLES += “files/device-table/hoge.txt”  Typical lists are already defined in meta/files/device-table  Please define additional device files required only on target board  Structure# path type mode uid gid major minor start inc count /dev d 755 0 0 - - - - - /dev/console c 662 0 0 5 1 - - - /dev/kmem c 640 0 15 1 2 - - - /dev/mem c 640 0 15 1 1 - - - /dev/null c 666 0 0 1 3 - - - /dev/tty c 600 0 5 4 0 0 1 7 ... /dev/ttyO2 c 640 0 5 253 2 - - - Board dependent device file
  • 73. 73Embedded Linux Conference 2015Embedded Linux Conference 2015 Contents  recipes-debian-squeeze/xxx/xxx.bb  recipes-poky/xxx/xxx.bb  recipes-kernel/xxx/xxx.bb  Recipes which are required only in this layer  Please add a recipe under meta(common) if it’s able to be shared with multiple layers  recipes-debian-squeeze/xxx/xxx.bbappend  recipes-poky/xxx/xxx.bbappend  recipes-kernel/xxx/xxx.bbappend  All settings in xxx.bbappend are appended to xxx.bb  Ex: Override functions, add new functions, use another local file, etc.
  • 74. 74Embedded Linux Conference 2015Embedded Linux Conference 2015 layer.conf  Essential definitions  MACHINE  Name of target machine  Ex: beagleboard, pandaboard, cubox  Machine independent layers should not define this value BBPATH := "${BBPATH}:${LAYERDIR}" BBFILES := " ${BBFILES} ¥ ${LAYERDIR}/recipes-*/*/*.bb ¥ ${LAYERDIR}/recipes-*/*/*.bbappend ¥ " BBFILE_COLLECTIONS += "xxx" BBFILE_PATTERN_xxx := "^${LAYERDIR}/" BBFILE_PRIORITY_xxx = "8" File paths Layer name and priority
  • 75. 75Embedded Linux Conference 2015Embedded Linux Conference 2015 layer.conf  Kernel information  LINUX_REPO: Repository name (linux-poky-debian.git)  LINUX_SRCREV: Branch name (the latest commit is used) or Tag name or Commit ID  LINUX_CONF: Path to config (arch/arm/configs/hoge_defconfig)  See meta/classes/debian-squeeze-linux-checkout.bbclass for more details  RELEASE_VERSION  Release version for each target  Output to /etc/debian_version (See debian-squeeze-files.bb for more details)  Format  ${debian_VERSION}-BOARDNAME-BOARDVERSION  Ex: 1.0.1-myboard-2.0
  • 76. 76Embedded Linux Conference 2015Embedded Linux Conference 2015 layer.conf  PREFERRED_PROVIDER_xxx = “x1”  Bitbake uses “x1” as a ‘real’ recipe of “xxx”  Ex  PREFERRED_PROVIDER_gcc = “gcc-default”  PREFERRED_PROVIDER_gcc = “gcc-linaro”  PREFERRED_VERSION_xxx = “1.0”  Bitbake uses “1.0” as a version of recipe “xxx”  Default version: git (the latest commit is used)  For example  PREFERRED_VERSION_qt4-embedded = "4.8.2+dfsg- 2debian1"
  • 77. 77Embedded Linux Conference 2015Embedded Linux Conference 2015 layer.conf  DISTRO_FEATURES  DISTRO_FEATURES_append = “x11”  http://www.yoctoproject.org/docs/1.1/poky-ref-manual/poky- ref-manual.html#ref-features-distro  Default value is defined in meta/conf/distro/include/default- distrovars.inc  It tells all recipes that specified “features” are enabled  Examples of features: ipv4, ipv6, x11, etc.  DEBIAN_SQUEEZE_FEATURES  DEBIAN_SQUEEZE_FEATURES_append  Deabin own features  Default value is defined in meta/conf/distro/debian- squeeze.conf
  • 78. 78Embedded Linux Conference 2015Embedded Linux Conference 2015 Update BSP  Update kernel  Modify the following variables if you update kernel  LINUX_SRCREV, LINUX_CONF  Update userland files  Modify recipes in recipes-debian/*, recipes-poky/*  Update release version  First of all, build & install & run on the target system and confirm that there is no problem  Update RELEASE_VERSION and build image from nothing
  • 79. 79Embedded Linux Conference 2015Embedded Linux Conference 2015 Build images for release  Ex: Use meta-foo/meta-bar as target BSP  NOTE: Please build from nothing (clean build)  Because all caches and unneeded sources should not be included in snapshot information  How to build $ ls poky-debian $ . ./poky-debian/setup.sh foo/bar $ bitbake core-image-base ← for rootfs $ bitbake meta-toolchain ← for SDK
  • 80. 80Embedded Linux Conference 2015 Recipe development for poky-debian (Some slide has already obsoleted)
  • 81. 81Embedded Linux Conference 2015Embedded Linux Conference 2015 Recipe components  Each recipe consists of the following three file types:  xyz_VERSION.bb  Core file. It includes or inherits other subfiles  xyz*.inc  Included by .bb or other .inc files  Usage of xyz.inc: include xyz.inc  Directories (files/, xyz/, xyz-VERSION/)  Includes local files (patchs, configuration files, etc.)  Class recipes  meta/classes/*.bbclass has basic common functions which shared by all recipes that inherits it Take care to modify !  Usage of abc.bbclass: inherit abc
  • 82. 82Embedded Linux Conference 2015Embedded Linux Conference 2015 Package's own variables  PN  PackageName (Ex: eglibc, busybox, etc.)  PV  PackageVersion (Ex: 2.11.2-10, 1.17.1-8)  PR  PackageRevesion (r0, r1, r2, ...)  WORKDIR  Top of the build directory  build-$TARGET/tmp/work/$ARCH/${PN}-${PV}-${PV}  S  Source code directory path used by do_unpack* and do_patch*  B  Build directory path used by do_configure and do_compile  D  Destination directory path used by do_install  These values are automatically set by bitbake
  • 83. 83Embedded Linux Conference 2015Embedded Linux Conference 2015 How to write a recipe for package "hoge"  A. From scratch with a non-debian source (rare case)  Add license information  Add SRC_URI  Set some variables or functions if needed  B. From scratch with a debian source (rare case)  Add license information  Inherit debian class  Inherit autotools class if needed  Add SRC_URI if needed  C. Use an existing recipe with a debian source  Copy poky's original recipe  Modify version  Modify license information  Inherit debian class
  • 84. 84Embedded Linux Conference 2015Embedded Linux Conference 2015 A-1. Add license information  LICENSE: License name  Usually written in ${S}/COPYING or ${S}/LICENSE  LIC_FILES_CHKSUM: License filename + its checksum  Format: file://FILENAME;md5=CHECKSUM  Base path of FILENAME is "${S}"  You need to check the MD5 of COPYING by md5sum LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=1a2b3c..."
  • 85. 85Embedded Linux Conference 2015Embedded Linux Conference 2015 A-2. Add "SRC_URI"  "SRC_URI" is a list of source codes, configurations, or other support files  bitbake fetches, unpacks and patches all files listed in SRC_URI  Archives (*.tar.gz, *.tar.bz2, etc.) are automatically unpacked  Patches (*.diff.gz, *.patch, etc.) are automatically patched SRC_URI = " ¥ http://url.to.archive/foo.tar.gz ¥ file://default_config ¥ "
  • 86. 86Embedded Linux Conference 2015Embedded Linux Conference 2015 B-1. Add license information  Same as "A-1" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=1a2b3c..."
  • 87. 87Embedded Linux Conference 2015Embedded Linux Conference 2015 B-2. Inherit debian class  Debian-squeeze class adds:  do_fetch_srcpkg, do_unpack_srcpkg and do_patch_srcpkg  These functions fetch, unpack, patch essential sources automatically according to ${PN} and ${PV}  No need to write debian source URI in each package inherit debian-squeeze
  • 88. 88Embedded Linux Conference 2015Embedded Linux Conference 2015 B-3. Inherit autotools class  autotools class adds:  do_configure, do_make, do_install, etc. for autotools-based sources  Default functions are already defined in "base.bbclass", but some functions (do_configure, do_install, etc.) are empty  Don't inherit autotools if the source code is not based on autotools  Please implement do_configure, do_compile, do_install, etc. from scratch inherit autotools
  • 89. 89Embedded Linux Conference 2015Embedded Linux Conference 2015 B-4. Add other required files to "SRC_URI"  Usually, only "inherit debian-squeeze" (source of package) is required  Need to add file URIs to "SRC_URI" if the package requires some support files  License file (COPYING)  Default configuration file for "menuconfig"  "rc" scripts to be installed to the target system  Ex: /etc/init.d/sshd SRC_URI = " ¥ file://COPYING ¥ file://default_config ¥ http://uri.to.sourcecode/poky-debian/rc-init.sh "
  • 90. 90Embedded Linux Conference 2015Embedded Linux Conference 2015 C-1. Copy poky's recipe from ORIGINAL  Check whether “foo/hoge_1.2.3.bb" is included in meta/recipes-debian-squeeze/ or not before copying $ cp -r meta/ORIGINAL/recipes-???/foo meta/recipes-bar
  • 91. 91Embedded Linux Conference 2015Embedded Linux Conference 2015 C-2. Modify version  Replace Poky's version (1.2.3) by Debian's (1.2.1-4)  The version of debian consists of two elements separated by "-"  Format: UpstreamVersion-debianVersion  UpstreamVersion = 1.2.1  debianVersion = 4 $ cd meta/recipes-bar/hoe $ mv hoge_1.2.3.bb hoge_1.2.1-4.bb
  • 92. 92Embedded Linux Conference 2015Embedded Linux Conference 2015 C-3. Modify license information  Same as "A-1"  Need to modify license information if Debian's license differs from poky's LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=1a2b3c..."
  • 93. 93Embedded Linux Conference 2015Embedded Linux Conference 2015 C-4. Inherit debian-squeeze class  Same as "B-2" inherit debian-squeeze
  • 94. 94Embedded Linux Conference 2015Embedded Linux Conference 2015 C-5. Modification rule example  Modifing a recipe according to the following rules # # ORIGINAL FILENAME # ... ... #... ... # # debian # OUR DEFINITIONS Write new definitions at the bottom Write the original filename not to forget it Comment out only (Don't add / delete)
  • 95. 95Embedded Linux Conference 2015Embedded Linux Conference 2015 Example A: Recipe for "hello"  Implement a recipe to build the following program (hello.c)  Makefile #include <stdio.h> int main() { printf("hello¥n"); return 0; } default: clean hello hello: hello.o clean: rm -f hello *.o
  • 96. 96Embedded Linux Conference 2015Embedded Linux Conference 2015 Example A: Setup files  Make a directory for hello  Make a source code directory and copy hello.c, Makefile and COPYING  Make a recipe file for hello $ mkdir meta/recipes-test/hello $ cd meta/recipes-test/hello $ mkdir -p hello/src $ cd hello/src $ emacs hello.c $ emacs Makefile $ touch COPYING # dummy $ emacs meta/recipes-test/hello/hello_1.0.bb
  • 97. 97Embedded Linux Conference 2015Embedded Linux Conference 2015 Example A: Write a recipe  Add license information  Add source files ("src") to "SRC_URI"  Define "S" and "B" for hello  Define do_install function to install binaries generated by our Makefile  Run "bitbake hello"
  • 98. 98Embedded Linux Conference 2015Embedded Linux Conference 2015 Example A: Answer LICENSE = "tmp" LIC_FILES_CHKSUM = ¥ "file://COPYING;md5=d41d8cd98f00b204e9800998ecf8427e" SRC_URI = "file://src" S = ${WORKDIR}/src B = ${S} do_install() { install -d ${D}/${bindir} install -m 0755 ${B}/hello ${D}/${bindir} }
  • 99. 99Embedded Linux Conference 2015Embedded Linux Conference 2015 Example C: Recipe for "sed"  Copy a recipe from ORIGINAL  Remove un-required files  Rename "4.2.1" to the debian version  Check the version of source archive for Debian  Inherit debian-squeeze class  Comment out all "SRC_URI"-related lines $ cp meta/ORIGINAL/recipes-extended/sed meta/recipes-test $ rm -f sed_4.1.2.bb sed-4.1.2/
  • 100. 100Embedded Linux Conference 2015Embedded Linux Conference 2015 Example C: Recipe for "sed" # # sed_4.2.1.bb # DESCRIPTION = "sed is a Stream EDitor." HOMEPAGE = "http://www.gnu.org/software/sed/" ... #SRC_URI = "${GNU_MIRROR}/sed/sed-${PV}.tar.gz" #SRC_URI[md5sum] = "f0fd4d7da574d4707e442285fd2d3b86" #SRC_URI[sha256sum] = "8773541ce097fdc4c5b9e7da12a82dffbb30cd91f7bc169f52f05f93b7fc3060" inherit autotools update-alternatives gettext ... BBCLASSEXTEND = "native" # # debian # inherit debian-squeeze
  • 101. 101Embedded Linux Conference 2015 Kernel build
  • 102. 102Embedded Linux Conference 2015Embedded Linux Conference 2015 debian kernel repositories  Sample kernel sources are able to download by the following command  The kernel repository consists:  Source code branch  v3.0-rt, etc.  Modifications for the target board  Poky-debian estimate to fetch all kernel source from git reposirtory via git protocol  Need to prepare sources and configurations using SDK (toolchain) of poky-debian before build git clone git://github.com/ystk/linux-poky-debian.git
  • 103. 103Embedded Linux Conference 2015Embedded Linux Conference 2015 Kernel recipes in poky-debian bitbake binaries and libraries Common recipes & configurations Common configurations bitbake/ meta-muguet/ meta-qemux86/ meta-yocto/ meta/ recipes-debian- squeeze/ recipes-yocto/ recipes-kernel/ recipes-poky/ pkg1/ pkg2/ pkg1.bb classes/ pkg1.bbpkg1.bb pkg1.bbpkg1.bbpkg2.bb Recipe files & directory for each package Board-specific recipes
  • 104. 104Embedded Linux Conference 2015Embedded Linux Conference 2015 Kernel recipes in poky-debian  meta/recipes-kernel/linux/linux_git.bb  A sample recipe to build generic linux kernel  Fetch linux kernel source from git server  Inherit "debian-squeeze-linux.bbclass" instead of "debian- squeeze.bbclass"  meta/recipes-kernel/linux/linux-libc- headers_git.bb  Include kernel headers (Ex: /usr/include/linux/*.h)  Used to build other userland packages  Fetch the same file as "linux_git.bb"  Inherit "debian-squeeze-linux-libc-headers.bbclass“ instead of "debian-squeeze.bbclass"
  • 105. 105Embedded Linux Conference 2015Embedded Linux Conference 2015 linux_git.bb  Variables  LINUX_REPO  Name of kernel repository (Ex: linux-poky-debian.git)  Searched from ${DEBIAN_SQUEEZE_GIT}  LINUX_BRANCH_SRC  Name of source code branch  Default: "master"  LINUX_BRANCH_CONF  Name of configuration branch  Default: "configs"  LINUX_COMMIT_SRC / LINUX_COMMIT_CONF  Commit ID (hash value) of source code / configuration  LINUX_CONF  Name of configuration file in "configs" directory
  • 106. 106Embedded Linux Conference 2015Embedded Linux Conference 2015 linux_git.bb  Example 1  Fetch github.com/ystk/linux-debian.git  Use the newest commit of "v3.0-rt" branch as a source  Use "versatile_defconfig" in configs branch as a configuration  Example 2  Use two commits ("eb2..." and "1ea...") as a source & conf LINUX_REPO = "linux-poky-debian.git" LINUX_BRANCH_SRC = "v3.0-rt" LINUX_BRANCH_CONF = "configs" LINUX_CONF = "configs/v3.0/arm/versatile_defconfig" LINUX_REPO = "linux-debian.git" LINUX_COMMIT_SRC = "eb25ca22426dbaea10a4748c8741ccbc3aaa24c8" LINUX_COMMIT_CONF = "1ea6b8f48918282bdca0b32a34095504ee65bab5" LINUX_CONF = "configs/v3.0/arm/versatile_defconfig"
  • 107. 107Embedded Linux Conference 2015Embedded Linux Conference 2015 How to build?  bitbake kernel  Build directory  build-${MACHINE}/tmp/work/${MACHINE}-poky-linux/linux- git-r0  Deployment  build-${MACHINE}/tmp/deploy/images/zImage- ${MACHINE}.bin $ bitbake virtual/kernel
  • 108. 108Embedded Linux Conference 2015Embedded Linux Conference 2015 How to customize the kernel? (menuconfig)  Launch "screen"  You can modify the configuration you choose  You will get the following message:  Generate new screen and type:  Retry bitbake $ bitbake -c clean virtual/kernel $ rm -f sstate-cache/sstate-linux-* $ bitbake -c menuconfig virtual/kernel WARNING: Screen started. Please connect in another terminal with "screen -r devshell" $ screen -r devshell
  • 110. 110Embedded Linux Conference 2015Embedded Linux Conference 2015 Build directory and deployment  setup.source generates a build directory which named "build-$MACHINE"  bitbake outputs all files only to this directory  The build directory consists of...  conf  Includes configuration files copied by setup.source  downloads  Includes all downloaded files fetched by do_fetch*  tmp/work  Work directories that bitbake uses to build each recipe  tmp/sysroots  Includes tools & libraries shared by all recipes  Ex: native tools, cross compiler, cross libraries, headers, etc.  tmp/deploy  Final outputs are put into this directory  kernel, rootfs, toolchain, etc.
  • 111. 111Embedded Linux Conference 2015Embedded Linux Conference 2015 Build directory and deployment $TARGET/ build-$MACHINE/ tmp/downloads/ work/ deploy/ $NATIVE/ $MACHINE/ rootfs/kernel/rootfs/kernel/yyy/ rootfs/kernel/xxx/ sysroots/
  • 112. 112Embedded Linux Conference 2015Embedded Linux Conference 2015 Build directory and deployment $TARGET/ build-$MACHINE/ tmp/downloads/ work/ deploy/ $NATIVE/ $MACHINE/ rootfs/kernel/rootfs/kernel/yyy/ rootfs/kernel/xxx/ sysroots/ fetch Source archives
  • 113. 113Embedded Linux Conference 2015Embedded Linux Conference 2015 unpack & build Build directory and deployment $TARGET/ build-$MACHINE/ tmp/downloads/ work/ deploy/ $NATIVE/ $MACHINE/ rootfs/kernel/rootfs/kernel/yyy/ rootfs/kernel/xxx/ sysroots/
  • 114. 114Embedded Linux Conference 2015Embedded Linux Conference 2015 Build directory and deployment $TARGET/ build-$MACHINE/ tmp/downloads/ work/ deploy/ $NATIVE/ $MACHINE/ rootfs/kernel/rootfs/kernel/yyy/ rootfs/kernel/xxx/ sysroots/ Shared bins/libs/scripts
  • 115. 115Embedded Linux Conference 2015Embedded Linux Conference 2015 Build directory and deployment $TARGET/ build-$MACHINE/ tmp/downloads/ work/ deploy/ $NATIVE/ $MACHINE/ rootfs/kernel/rootfs/kernel/yyy/ rootfs/kernel/xxx/ sysroots/
  • 116. 116Embedded Linux Conference 2015Embedded Linux Conference 2015 Build directory and deployment  Each package build directory consists...  temp  Includes all log files and 'real' build scripts generated by bitbake according to recipes  Please check logs under this directory when some errors occur  ${S} = ${PN}-${PV}/  Source directory unpacked by do_unpack  ${D}: image/  All outputs are put into this directory (usually by "make install")  deploy-debs  All packaged files named "*.deb" are put into this directory
  • 117. 117Embedded Linux Conference 2015Embedded Linux Conference 2015 Errors  Fetch errors caused by repository servers  Errors caused by source directory structure  Path-related errors  libtool-related errors  Manual-related errors  Patch failures when we apply some poky's patches
  • 118. 118Embedded Linux Conference 2015Embedded Linux Conference 2015 Fetch errors caused by repository servers  Source archives not found  Some packages don't exist on repository servers  Please add the package to debian git repository yourself  debian package name is different from poky's  Ex: debian="lm-sensors-3" poky="lm-sensors"  Use “DEBIAN_SQUEEZE_SRCPKG_NAME" inherit debian debian_SRCPKG_NAME = "lm-sensors-3" lm-sensors_xxx.bb
  • 119. 119Embedded Linux Conference 2015Embedded Linux Conference 2015 Errors caused by source directory structure  Structure of some source directories are different from poky's source directories  debian pkgname-0.1-2/ Makefile, src.c, configure, ...  poky pkgname-0.1/ srcdir, support-tools, ... Makefile, src.c, ...  Please fix "S" and related functions such as do_unpack
  • 120. 120Embedded Linux Conference 2015Embedded Linux Conference 2015 Path-related errors  Sometimes, Makefile is hard-corded  Ex: CC = gcc  Cannot use cross compiler in poky in this case  You may have some patches that resolve this problem  Ex: fix-path-xxx.patch  You need to fix paths if there is no patches in poky
  • 121. 121Embedded Linux Conference 2015Embedded Linux Conference 2015 libtool-related errors  Some packages fail with libtool-related errors  libtool  One of autotools  Compile, build, install libraries  poky-debian uses internal libtool to build each package  Some packages need to be patched to use internal libtool  Please search "libtool-xxx.patch" and apply it when you get some libtool-related errors
  • 122. 122Embedded Linux Conference 2015Embedded Linux Conference 2015 Manual-related errors  Some packages fail with manual-related errors  manpage, documents, etc.  Ex: help2man  Please fix Makefile  Delete rules to build manual or documents in Makefile  No need to build manual or documents because we are generating root file systems not for generic PC but for embedded systems
  • 123. 123Embedded Linux Conference 2015Embedded Linux Conference 2015 Patch failures  Need to apply some patches included in poky- debian to build packages  Usually, some patches reject   Because the pacthes assume that it is applied to poky's source  But we use debian's source now  Please fix patches by yourself..
  • 124. 124Embedded Linux Conference 2015Embedded Linux Conference 2015 How to create a new patch?  First, backup (1) the original source files (such as Makefile)  Second, do bitbake  The error occurs  Third, (2) modify the source files and retry bitbake  Create a patch from difference between (1) and (2) using "diff" command  Add your patch to SRC_URI SRC_URI = "my-patch.patch"
  • 125. 125Embedded Linux Conference 2015 Packaging
  • 126. 126Embedded Linux Conference 2015Embedded Linux Conference 2015 Build directory and deployment  Build directory of each package consist of...  temp  Includes all log files and 'real' build scripts generated by bitbake according to recipes  Please check logs under this directory when some errors occur  ${S} = ${PN}-${PV}/  Source directory unpacked by do_unpack  ${D}: image/  All outputs are put into this directory (usually by "make install")  deploy-debs  All packaged files named "*.deb" are put into this directory *.deb is a binary package format of Debian
  • 127. 127Embedded Linux Conference 2015Embedded Linux Conference 2015 How *.deb packages are created?  After do_compile, we have some outputs of the package under ${B} build-${MACHINE}/.../${PN}-${PV}-${PR}/ ${S}/ ${B}/ Usually same Ex: ls, cat, su, etc.
  • 128. 128Embedded Linux Conference 2015Embedded Linux Conference 2015  After do_install, outputs are put into ${D} according to "make install" How *.deb packages are created? build-${MACHINE}/.../${PN}-${PV}-${PR}/ ${S}/ ${B}/ Usually same ${D}/ (image/) usr/bin/ sbin/ bin/ sbin/ Sometimes renamed
  • 129. 129Embedded Linux Conference 2015Embedded Linux Conference 2015  In do_package* functions, each output file are installed to "packages" and "packages-split" directory How *.deb packages are created? build-${MACHINE}/.../${PN}-${PV}-${PR}/ ${S}/ ${B}/ Usually same ${D}/ (image/) usr/bin/ sbin/ bin/ sbin/ packages-split 1
  • 130. 130Embedded Linux Conference 2015Embedded Linux Conference 2015  In do_package* functions, each output file are installed to "packages" and "packages-split" directory How *.deb packages are created? build-${MACHINE}/.../${PN}-${PV}-${PR}/ ${S}/ ${B}/ Usually same ${D}/ (image/) usr/bin/ sbin/ bin/ sbin/ packages-split 1 2
  • 131. 131Embedded Linux Conference 2015Embedded Linux Conference 2015  Finally, split *.debs are generated in "deploy- debs" How *.deb packages are created? build-${MACHINE}/.../${PN}-${PV}-${PR}/ ${S}/ ${B}/ Usually same ${D}/ (image/) usr/bin/ sbin/ bin/ sbin/ packages-split 1 2 deploy- debs 1.deb 2.deb
  • 132. 132Embedded Linux Conference 2015Embedded Linux Conference 2015 How to control packaging?  We can use the following variables to control packaging  PACKAGES  The list of package name  Ex: PACKAGES = "busybox busybox-module1 busybox-module2"  FILES_xxx  The list of files included in package "xxx"  Ex: FILES_busybox-module1 = "${bindir}/bin1 ${sbindir}/bin2"  RDEPENDS_xxx  The list of packages "xxx" depends on  Ex: RDEPENDS_busybox-module1 = "busybox-module2 mylib"  NOTE: "DEPENDS" != "RDEPENDS"  DEPENDS: "Build-time" dependency  RDEPENDS: "Runtime" dependency
  • 133. 133Embedded Linux Conference 2015Embedded Linux Conference 2015 Dependency busybox.deb mylib_4.5.6.bb mylib.deb busybox-module1.deb busybox-module2.deb Provides PACKAGES busybox_1.2.3.bb RDEPENDS buildlib_7.8.bb install DEPENDS buildlib Used to build busybox in sysroots