10.06.2015 Views

Presentation: "Emdedded distro shootout: buildroot vs. Debian" - Mind

Presentation: "Emdedded distro shootout: buildroot vs. Debian" - Mind

Presentation: "Emdedded distro shootout: buildroot vs. Debian" - Mind

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Emdebbed <strong>distro</strong> <strong>shootout</strong>:<br />

Debian <strong>vs</strong> Buildroot<br />

© 2013 Essensium N.V.<br />

Parts © Thomas Petazzoni, Free Electrons<br />

This work is licensed under a<br />

Creative Commons Attribution-ShareAlike 3.0<br />

Unported License<br />

http://www.mind.be/content/<strong>Presentation</strong>_<strong>Emdedded</strong>-<strong>distro</strong>-<strong>shootout</strong>.pdf


Image © Coolblue N.V.


Image © Atmel<br />

Deploy a board<br />

into the system


Deploy software<br />

on the board


Emdebbed <strong>distro</strong> <strong>shootout</strong>:<br />

Debian <strong>vs</strong> Buildroot<br />

© 2013 Essensium N.V.<br />

Parts © Thomas Petazzoni, Free Electrons<br />

This work is licensed under a<br />

Creative Commons Attribution-ShareAlike 3.0<br />

Unported License<br />

http://www.mind.be/content/Buildroot-<strong>vs</strong>-Debian.pdf


Debian <strong>vs</strong> Buildroot<br />

1.Embedded systems are different<br />

2.How to use Debian<br />

for embedded systems<br />

3.How to use <strong>buildroot</strong>


Why are embedded systems different<br />

●<br />

Controllable<br />

– fine-tune services configuration<br />

– fast boot<br />

– custom kernel<br />

●<br />

Reproducible<br />

– re-create after a year<br />

– different copies as much as possible alike<br />

●<br />

●<br />

Small (128MB Flash, 1GB eMMC)<br />

Non-x86 processor (ARM, PowerPC, MIPS, ARC,<br />

Xtensa, Blackfin, Microblaze)


Why are embedded systems different<br />

●<br />

Controllable<br />

– fine-tune services configuration<br />

– fast boot<br />

– custom kernel<br />

Linux<br />

from<br />

Scratch<br />

●<br />

Reproducible<br />

– re-create after a year<br />

– different copies as much as possible alike<br />

●<br />

●<br />

Small (128MB Flash, 1GB eMMC)<br />

Non-x86 processor (ARM, PowerPC, MIPS, ARC,<br />

Xtensa, Blackfin, Microblaze)


System build infrastructure<br />

is needed for fast deployment<br />

●<br />

●<br />

●<br />

●<br />

●<br />

●<br />

●<br />

Initial default deployment in no time<br />

Fast building<br />

Easy to change configuration<br />

Share with colleagues<br />

Reproducible<br />

Produce a distributable image<br />

(for production and for upgrade)<br />

Easy to add new (custom) packages


Embedded development with Debian<br />

●<br />

●<br />

●<br />

●<br />

Start with installer or minimal tar, play around with it,<br />

see if your application works<br />

Reuse bootloader and kernel from vendor<br />

Install to permanent media, keeping track of all the<br />

modifications you made<br />

Create an image creator script<br />

Write image to target


Creating a Debian image<br />

●<br />

●<br />

●<br />

●<br />

●<br />

pdebuild custom packages<br />

debootstrap target root directory<br />

chroot install required packages<br />

make filesystem modifications<br />

create target image file


Cross-creating a Debian image<br />

●<br />

●<br />

debootstrap cross-build root directory<br />

qemu-boot<br />

●<br />

install build-required packages<br />

●<br />

build custom packages<br />

●<br />

●<br />

●<br />

●<br />

debootstrap target root directory<br />

qemu-boot install required packages<br />

make filesystem modifications<br />

create target image file


Cross-creating a Debian image<br />

● multistrap cross-build root directory<br />

● qemu-boot<br />

Simplified with<br />

●<br />

install build-required packages scratchbox2<br />

●<br />

build custom packages<br />

● multistrap target root directory<br />

● qemu-boot install required packages<br />

● make filesystem modifications<br />

● create target image file


Problems with Debian for embedded<br />

●<br />

●<br />

●<br />

●<br />

●<br />

Cross compilation<br />

No exotic architectures (blackfin, xtensa)<br />

Results in a large system (>100MB)<br />

Not reproducible<br />

Not very controllable


Cross-compilation issues<br />

●<br />

●<br />

Fake native build with qemu<br />

cross-compilation toolchain is hard to use<br />

– Need cross-build-depends installed<br />

– Will be solved with multiarch in Emdebian 3.0<br />

●<br />

some packages need to be patched for crosscompilation


Debian results in a large system<br />

●<br />

●<br />

●<br />

●<br />

Minimal install > 100MB<br />

Remove documentation, translations, …<br />

Remove “essential” packages: perl<br />

Split packages more aggressively<br />

Remove dpkg support files<br />

Still more than 20MB for minimal system


Emdebian: debian for embedded


Emdebian: Debian for embedded<br />

Goals<br />

●<br />

Make smaller Debian<br />

– 100MB → 20MB<br />

●<br />

Support cross-building


Emdebian: Debian for embedded<br />

Tools<br />

●<br />

●<br />

●<br />

●<br />

●<br />

●<br />

●<br />

xcontrol files that produce smaller packages<br />

Tools to automatically create xcontrol files<br />

Separate packages for translations<br />

Emdebian-specific 'Required' & 'Essential' packages<br />

Debian packages for cross-compilation toolchains<br />

Tools supporting cross-installation<br />

dpkg-cross, xapt, pdebuild-cross<br />

Many emdebian tools creep into core debian


Debian builds are not reproducible<br />

Packages are removed from debian.org<br />

when updates are available<br />

● Use snapshot.debian.org or<br />

●<br />

Create a local cache (including source & build-deps!)<br />

Create a top-level build script for custom packages


Debian is not very controllable<br />

●<br />

●<br />

●<br />

Predefined configuration choices<br />

⇒ Build from source, modify debian/rules, …<br />

Difficult to integrate fixes or new features<br />

⇒ Get package from unstable/experimental<br />

⇒ Build from source, with additional patches<br />

System integration (initialization scripts, package dependencies)<br />

⇒ Add/remove files from generated rootfs<br />

But additional complexity to understand them<br />

Various tools: kernel-package, initramfs-tools, fsprotect, …<br />

⇒ Learn to be a system administrator


System build infrastructure<br />

is needed for fast deployment<br />

●<br />

●<br />

●<br />

●<br />

●<br />

●<br />

●<br />

Initial default deployment in no time<br />

Fast building<br />

Easy to change configuration<br />

Share with colleagues<br />

Reproducible<br />

Produce a distributable image<br />

(for production and for upgrade)<br />

Easy to add new (custom) packages


http://<strong>buildroot</strong>.org<br />

●<br />

●<br />

●<br />

Kconfig-based interactive configuration<br />

Makefile-based build system<br />

Download, patch, build and install<br />

– Toolchain (compiler, library)<br />

– Packages + dependencies<br />

– Boot loader (U-Boot, barebox, grub, ...)<br />

– Linux kernel<br />

– Host tools (openocd, dfu-util, ...)<br />

● Create root filesystem (ext2, jffs2, ubi, ...)


Buildroot has a simple workflow<br />

/etc/init.d/S80startapp<br />

/etc/network/interfaces<br />

Makefiles<br />

Kconfigs<br />

patches make xconfig;<br />

make<br />

libraries<br />

kernel<br />

packages<br />

root<br />

filesystem<br />

Image © Marcello Jo


Buildroot deploys on EVM<br />

in no time


Buildroot makes it easy<br />

to change the configuration


Buildroot makes it easy<br />

to change the configuration<br />

make linux-xconfig


Buildroot makes it easy<br />

to share with colleagues<br />

Set BR2_DEFCONFIG and BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE<br />

make update-all-config


Buildroot is reproducible<br />

●<br />

Configuration files (make update-all-config)<br />

are all that is needed to re-create<br />

exactly the same build<br />

●<br />

Sources can be collected with make source<br />

●<br />

Licenses can be collected with make legal-info


Buildroot makes it easy<br />

to hack a package<br />

LINUX_OVERRIDE_SRCDIR = /home/arnout/src/linux<br />

make linux-rebuild


Buildroot makes it easy<br />

package/foo/foo.mk<br />

to add packages<br />

BR2_PACKAGE_FOO = y<br />

FOO_OVERRIDE_SRCDIR = …/foo<br />

FOO_DEPENDENCIES = opencv libusb<br />

define FOO_BUILD_CMDS<br />

$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)<br />

endef<br />

define FOO_INSTALL_TARGET_CMDS<br />

$(INSTALL) -D -m 0755 $(@D)/foo \<br />

$(TARGET_DIR)/usr/bin/foo<br />

endef<br />

$(eval $(generic-package))


Buildroot makes it easy<br />

to cross-compile your source<br />

Use /output/host/usr/-gcc<br />

as the cross-compiler<br />

– Automatically uses cross-include and library paths<br />

– Use /output/host/usr/pkg-config<br />

to get package-specific CFLAGS and LDFLAGS<br />

Cross-build environment can be shared<br />

by setting BR2_HOST_DIR


●<br />

Documentation:<br />

– make help<br />

– make manual<br />

Buildroot has good support<br />

– http://<strong>buildroot</strong>.net/downloads/manual/manual.html<br />

●<br />

Mailing list:<br />

– <strong>buildroot</strong>@busybox.net<br />

– 40 mails per day (mostly patches)<br />

●<br />

●<br />

●<br />

20 new packages per month<br />

Release every 3 months<br />

<strong>buildroot</strong>-2013.2-rc1 shortly after FOSDEM<br />

Automatic tests: 100 random builds per day


A range of <strong>distro</strong> options for embedded<br />

Buildroot<br />

No package management<br />

Upgrades are system-wide<br />

Fixed-functionality systems<br />

PtxDist<br />

OpenWRT<br />

OpenEmbedded<br />

Yocto<br />

Runtime package management<br />

Upgrades are per-package<br />

Functionality is dynamically added<br />

Gentoo<br />

Debian<br />

Root filesystem<br />

generator<br />

Distribution<br />

generator<br />

Distribution


Problems with <strong>buildroot</strong><br />

●<br />

●<br />

●<br />

●<br />

●<br />

No live CD<br />

Large number of config options<br />

is a bit overwhelming at first<br />

Only 946 packages, <strong>vs</strong>. 18773 in Debian sid<br />

No binary packages<br />

⇒ build sometimes takes longer<br />

No package management<br />

⇒ can only remove a package with a clean rebuild


Choosing Debian or Buildroot<br />

●<br />

●<br />

●<br />

●<br />

●<br />

Full <strong>distro</strong> is nice to get started<br />

if live CD or preinstalled image is available<br />

Reuse vendor-provided bootloader and kernel<br />

Debian is useful to play around with packages<br />

that are not (yet) integrated into <strong>buildroot</strong><br />

Emdebian makes good progress for cross-building,<br />

but still a long way to go<br />

In many cases, <strong>buildroot</strong> is smaller & easier


Bringing up your device is easy<br />

with Buildroot


www.mind.be<br />

www.essensium.com<br />

Essensium NV<br />

<strong>Mind</strong> - Embedded Software Division<br />

Gaston Geenslaan 9, B-3001 Leuven<br />

Tel : +32 16-28 65 00<br />

Fax : +32 16-28 65 01<br />

email : info@essensium.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!