Advanced Customizations Khem Raj Embedded Linux Conference 2013 Yocto Project Developer Day San Francisco 19 FEB 2013
Starting Point Poky The Reference Distro Poky Policies in meta-yocto/conf/distro poky.conf poky-lsb.conf poky-tiny.conf 2
Customize Poky The Reference Distro Variable to Adapt DISTRO DISTRO_NAME MAINTAINER TARGET_VENDOR SDK_VENDOR DISTROOVERRIDES. 3
Add Own Layers bblayers.conf.sample Add new layers to BBLAYERS variable First level 2 BBLAYERS?= " \ ##COREBASE##/meta \ ##COREBASE##/meta-yocto \ ##COREBASE##/meta-yocto-bsp \ ##COREBASE##/meta-foo \ 4
Customize Local Configuration (local.conf) local.conf.sample Local customization e.g. USER_CLASSES USER_CLASSES?= "buildstats image-mklibs image-prelink" USER_CLASSES?= "buildstats image-mklibs 5
Building multiple BSPs e.g. Supporting Intel and PowerPC machine together In bblayers.conf.sample Add meta-intel to BBLAYERS Add meta-fsl-ppc to BBLAYERS ##COREBASE##/meta-fsl-ppc \ ##COREBASE##/meta-intel \ ##COREBASE##/meta-intel/meta-crystalforest \ 6
Tweak recipes If you need to adapt metadata recipe In layer meta-foo write a bbappend file e.g. netbase_5.0.bbappend PRINC := "${@int(princ) + 1}" # Disable network manager on machines that commonly do NFS booting do_install_append () { case "${MACHINE}" in "mymachine") touch ${D}${sysconfdir}/network/nm-disabled-eth0;; *);; esac } 7
e.g. Supporting Intel and PowerPC machine together In bblayers.conf.sample Add meta-intel to BBLAYERS Add meta-fsl-ppc to BBLAYERS ##COREBASE##/meta-fsl-ppc \ ##COREBASE##/meta-intel \ ##COREBASE##/meta-intel/meta-crystalforest \ 8
SDK Generate SDKs Build meta-toolchain for basic C/C++ SDK MACHINE=p5020ds-64b bitbake meta-toolchain Customize SDK contents (via meta-toolchain.bbappend) TOOLCHAIN_HOST_TASK += "nativesdk-dtc nativesdk-flex nativesdk-bison" TOOLCHAIN_TARGET_TASK += "boost-dev" TOOLCHAIN_TARGET_TASK_append_powerpc64 = " dtc " 9
SDK Generate image SDK Build SDK customized to image MACHINE=p5020ds-64b bitbake cpopulate_sdk my-custom-image 10
SSTATE Setup Shared State Add following to local.conf.sample or your own distro.conf (http or NFS) SSTATE_MIRRORS?= "\ file://.* http://dontexist.juniper.net/sstate/ \n" SSTATE_MIRRORS?= "\ file://.* ///net/dontexist.juniper.net/sstate/ \n" 11
Customize Download Mirror don t want bitbake to ever go out to wild wild web Set BB_NO_NETWORK Setup internal source mirror BB_NO_NETWORK?= "1" SOURCE_MIRROR_URL?= "file:///net/dontexist/downloads/" INHERIT += "own-mirrors" BB_GENERATE_MIRROR_TARBALLS = "1" 12
Online Package Management Add to image recipe IMAGE_FEATURES += "package-management" 13
Online Package Management Adapt zypper config zypper/juniper-updates.repo [rpms] name=rpms enabled=1 autorefresh=1 baseurl=http://dontexist.juniper.net/feeds/rpm type=none keeppackages=0 14
Online Package Management Write a zypper bbappend FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" PRINC := "${@int(princ) + 1}" SRC_URI += "file://juniper-updates.repo" do_install_append () { install -d ${D}${sysconfdir}/zypp/repos.d install -m 0644 ${WORKDIR}/juniper-updates.repo ${D}${sysconfdir}/zypp/repos.d } 15
Multilib Making it work for multiple architectures Append to distro.conf Notice the include instead of require include conf/distro/include/multilib- ${DEFAULTTUNE}.conf 16
Multilib Multilib Contents conf/distro/include/multilib-ppc64e5500.conf require conf/multilib.conf MULTILIBS = "multilib:lib32" DEFAULTTUNE_virtclass-multilib-lib32 = "ppce5500" conf/distro/include/multilib-x86-64.conf require conf/multilib.conf MULTILIBS = "multilib:lib32" DEFAULTTUNE_virtclass-multilib-lib32 = "x86" 17
Customizing EGLIBC System C library Customization Supports kernel like kconfig interface Customized using DISTRO_FEATURES_LIBC Long list described in metayocto/conf/local.conf.sample.extended Default builds all features into eglibc 18
I don t want Busybox Create own images Build using basic building blocks provided by Yocto metadata PACKAGEGROUPS - packagegroup-core-boot IMAGE_FEATURES - ssh-server-openessh Create your own task (replacement for busybox) packagegroup-proper-tools 19
Thank you for your participation!