Videolösungen © DResearch 2009 The build framework for embedded Linux Thilo Fromm, März 2010
Videolösungen © DResearch 2009 Agenda Classification and Overview Technology Build Commands Recipes “research agenda” by “optimal tweezers”, cc-by-a, from
Videolösungen © DResearch 2009 Classification: what is OpenEmbedded? “Fruit on Parade” by davekentuk, cc-by-a-nd, from
Videolösungen © DResearch 2009 OpenEmbedded != make OpenEmbedded != autotools OpenEmbedded > ant OpenEmbedded ≈ maven Classification: what is OpenEmbedded?
Videolösungen © DResearch 2009 Powerful build system + comprehensive collection of recipes “Construction” by cyrillicus, cc-by-a-nd, “Cookbooks” by Jami Dwyer, cc-by-a, Classification: what is OpenEmbedded?
Videolösungen © DResearch 2009 Overview – what does it do? “Men at work sign” by Jeremy Burgin, cc-by-a, from
Videolösungen © DResearch 2009 Provide a Cross Toolchain “Studley Tool Chest” by “public.resource.org”, cc-by-a, from cross compiler, cross development sandbox from scratch
Videolösungen © DResearch 2009 Resolve Build Dependencies “Ruby grammar dependency graph” by nicksieger, cc-by-a, from Application → High Level Libraries → Base System Libraries
Videolösungen © DResearch 2009 Automated Source Package Download “Fully Loaded Bike” by “vipworld”, cc-by-a, from Releases via HTTP, Snapshots from SVN, etc.
Videolösungen © DResearch 2009 Software (cross) Build “Construction site” by Matti Mattila, cc-by-a, from Autotools configure, make, then installation in a sandbox
Videolösungen © DResearch 2009 Binary Software Packaging “Books in Hall — So Many!” by “Editor B”, cc-by-a, from With dependency tracking
Videolösungen © DResearch 2009 Technology “Atlas” by Ethan Hein, cc-by-a, from
Videolösungen © DResearch 2009 bitbake bb recipes
Videolösungen © DResearch 2009 bitbake bb recipes
Videolösungen © DResearch 2009 bitbake bb recipes GNU autotools GNU make qmake
Videolösungen © DResearch 2009 bitbake bb recipes GNU autotools GNU make qmake opkg
Videolösungen © DResearch 2009 bitbake bb recipes GNU autotools GNU make #!/bin/bash qmake opkg
Videolösungen © DResearch 2009 It's a Build Framework And a Distribution Builder Highly FOSS Project compatible (autotools etc.) Numerous FOSS Applications already integrated
Videolösungen © DResearch 2009 Build Commands “USACE continues construction on forward operating site in Bulgaria” by “USACE Europe District”, cc-by-a,
Videolösungen © DResearch 2009 Full Build w/ Dependencies $ bitbake bacula-client NOTE: Handling BitBake files: - (8091/8091) [100 %] NOTE: Parsing finished cached, 340 parsed, 333 skipped, 0 masked... NOTE: Running task 525 of 526 (ID: 14, /.../bacula/bacula-client_ bb, do_package_stage_all) NOTE: Running task 526 of 526 (ID: 0, /.../bacula/bacula-client_ bb, do_build) NOTE: Tasks Summary: Attempted 526 tasks of which 509 didn't need to be rerun and 0 failed.
Videolösungen © DResearch 2009 Direct Build w/o Dependencies $ bitbake -b recipes/bacula/bacula-client_ bb NOTE: Preparing runqueue NOTE: Executing runqueue NOTE: Tasks Summary: Attempted 17 tasks of which 17 didn't need to be rerun and 0 failed.
Videolösungen © DResearch 2009 Run a specific Build Stage $ bitbake bacula-client -c fetch $ bitbake -b recipes/bacula/bacula-client_ bb -c build $ bitbake -b recipes/bacula/bacula-client_ bb -c clean $ bitbake linux -c devshell
Videolösungen © DResearch 2009 Build a portable Cross Toolchain for Compile Hosts $ bitbake meta-toolchain
Videolösungen © DResearch 2009 Recipes (“metadata”) “IMGP2863” by “AlphaTangoBravo / Adam Baker”, cc-by-a, from
Videolösungen © DResearch 2009 simple bitbake recipe 1 DESCRIPTION = "Bacula file daemon. Bacula is a network based backup program" 2 SECTION = "console/network" 3 PRIORITY = "optional" 4 HOMEPAGE = " 5 LICENSE = "GPL" 6 PR ="r1" 7 DEPENDS = "gmp openssl zlib readline" 8 9 SRC_URI = " \ 10 file://findlib-attribs.patch;patch=1;pnum=1 \ 11 file://bacula-fd.init" S = "${WORKDIR}/bacula " CCACHE = "" inherit autotools update-rc.d EXTRA_OECONF = "--enable-client-only --with-fd-user=root --with-fd-group=bacula" 20 INITSCRIPT_NAME = "bacula-fd"
Videolösungen © DResearch DESCRIPTION = "Bacula file daemon. Bacula is a network based backup program" 2 SECTION = "console/network" 3 PRIORITY = "optional" 4 HOMEPAGE = " 5 LICENSE = "GPL" 6 PR ="r1" 7 DEPENDS = "gmp openssl zlib readline" 8 9 SRC_URI = " \ 10 file://findlib-attribs.patch;patch=1;pnum=1 \ 11 file://bacula-fd.init" S = "${WORKDIR}/bacula " CCACHE = "" inherit autotools update-rc.d EXTRA_OECONF = "--enable-client-only --with-fd-user=root --with-fd-group=bacula" 20 INITSCRIPT_NAME = "bacula-fd" Dependency Definition
Videolösungen © DResearch DESCRIPTION = "Bacula file daemon. Bacula is a network based backup program" 2 SECTION = "console/network" 3 PRIORITY = "optional" 4 HOMEPAGE = " 5 LICENSE = "GPL" 6 PR ="r1" 7 DEPENDS = "gmp openssl zlib readline" 8 9 SRC_URI = " \ 10 file://findlib-attribs.patch;patch=1;pnum=1 \ 11 file://bacula-fd.init" S = "${WORKDIR}/bacula " CCACHE = "" inherit autotools update-rc.d EXTRA_OECONF = "--enable-client-only --with-fd-user=root --with-fd-group=bacula" 20 INITSCRIPT_NAME = "bacula-fd" Package Source
Videolösungen © DResearch DESCRIPTION = "Bacula file daemon. Bacula is a network based backup program" 2 SECTION = "console/network" 3 PRIORITY = "optional" 4 HOMEPAGE = " 5 LICENSE = "GPL" 6 PR ="r1" 7 DEPENDS = "gmp openssl zlib readline" 8 9 SRC_URI = " \ 10 file://findlib-attribs.patch;patch=1;pnum=1 \ 11 file://bacula-fd.init" S = "${WORKDIR}/bacula " CCACHE = "" inherit autotools update-rc.d EXTRA_OECONF = "--enable-client-only --with-fd-user=root --with-fd-group=bacula" 20 INITSCRIPT_NAME = "bacula-fd" “configure” stage extra parameters
Videolösungen © DResearch 2009 Some popular Build Stages fetch unpack patch configure compile populate_staging install package package_write
Videolösungen © DResearch 2009 $ bitbake -b common/recipes/drstorage/drstorage_svn.bb -c listtasks do_build do_devshell do_fetchall do_recipe_sanity_all do_cleanall do_distclean do_qa_staging do_distsrcall do_listtasks do_package_update_index_ipk do_package_stage_all do_mrproper do_fetch do_checkuri do_clean do_populate_staging do_package do_package_stage do_install do_recipe_sanity do_package_write_ipk do_rebuild do_configure do_setscene do_distribute_sources do_qa_configure do_patch do_compile do_buildall do_unpack do_distribute_sources_all do_package_write do_checkuriall Build Stage Tasks
Videolösungen © DResearch 2009 So where are the task definitions? 1 DESCRIPTION = "Bacula file daemon. Bacula is a network based backup program" 2 SECTION = "console/network" 3 PRIORITY = "optional" 4 HOMEPAGE = " 5 LICENSE = "GPL" 6 PR ="r1" 7 DEPENDS = "gmp openssl zlib readline" 8 9 SRC_URI = " \ 10 file://findlib-attribs.patch;patch=1;pnum=1 \ 11 file://bacula-fd.init" S = "${WORKDIR}/bacula " CCACHE = "" inherit autotools update-rc.d EXTRA_OECONF = "--enable-client-only --with-fd-user=root --with-fd-group=bacula" 20 INITSCRIPT_NAME = "bacula-fd"
Videolösungen © DResearch DESCRIPTION = "Bacula file daemon. Bacula is a network based backup program" 2 SECTION = "console/network" 3 PRIORITY = "optional" 4 HOMEPAGE = " 5 LICENSE = "GPL" 6 PR ="r1" 7 DEPENDS = "gmp openssl zlib readline" 8 9 SRC_URI = " \ 10 file://findlib-attribs.patch;patch=1;pnum=1 \ 11 file://bacula-fd.init" S = "${WORKDIR}/bacula " CCACHE = "" inherit autotools update-rc.d EXTRA_OECONF = "--enable-client-only --with-fd-user=root --with-fd-group=bacula" 20 INITSCRIPT_NAME = "bacula-fd" In a base class. Recipes are inheritable.
Videolösungen © DResearch do_configure () { 2 echo "configure step" 3 } Writing custom tasks - shell
Videolösungen © DResearch python do_configure () { 2 print "configure step" 3 } Writing custom tasks - python
Videolösungen © DResearch python do_annoy () { 2 print "BOOOOOOO!!!!" 3 } 4 5 addtask annoy before do_fetch Insert a task into the build stages
Videolösungen © DResearch 2009 Recipes are universal
Videolösungen © DResearch 2009 Simple Tasks (.bb) Doggie picture by “sruthi…N. Lol ”, from
Videolösungen © DResearch 2009 Whole Applications (.bb) Remixed “PowerBook applications” by Don Nunn, cc-by-sa, from
Videolösungen © DResearch 2009 Classes (.class) “grade7 class11” by “Rivard”, cc-by-a-nd, from
Videolösungen © DResearch 2009 Cross Toolchains “Studley Tool Chest” by “public.resource.org”, cc-by-a, from Portable, packaged Cross Compiler Toolchain for Compile Hosts
Videolösungen © DResearch 2009 Whole Platforms / Machines “Borgland Dolphin” by “Kristen462”, cc-by-sa, from
Videolösungen © DResearch 2009 Comprehensive Firmware Images “Freer Gallery Paintings” by “Mr.T in DC”, cc-by-a-nd, from
Videolösungen © DResearch 2009 And so much more “Planet Fort Point Channel (062/365)” by “rawheadrex”, cc-by-sa, from
Videolösungen © DResearch RTFM “R.T.F.M” by “zteamie”, cc-by-a, from
Videolösungen © DResearch 2009 Ready – Set – Go ! “Starting line” by Jon Marshall, cc-by-a, from Run some software package builds Adopt a bitbake recipe for a FOSS project you need Add a recipe for your own FOSS project