Designing a distro from scratch
using OpenEmbedded
Part 2
Koen Kooi <koen.kooi@linaro.org>
ELCE Berlin 2016
Overview
Don’t hesitate to interrupt if you have questions or remarks!
Part one slides available at https://goo.gl/HiRhi5
Part two (the one you’re watching) slides available at https://goo.gl/qt3lKp
OpenEmbedded basics (1/2)
OpenEmbedded basics (2/2)
Init systems
Picking systemd
DISTRO_FEATURES_append = " systemd"
DISTRO_FEATURES_remove = "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
PACKAGECONFIG_append_pn-systemd = " resolved networkd"
DISTRO_FEATURES_append = "pam"
C libraries
C libraries
Dealing with BSPs
Wait, actively discouraged?
What’s ‘anti-social’ about my BSP?
DEFAULTTUNE = “Gcc -OMG -noatime”
# This function changes the default tune for machines which
# are based on armv7a to use common tune value, note that we enforce hard-float
# which is default on Ångström for armv7+
# so if you have one of those machines which are armv7a but can't support
# hard-float, please change tune = 'armv7athf' to tune = 'armv7at'
# below but then this is for your own distro, Ångström will not support
# it
# - Khem
def arm_tune_handler(d):
features = d.getVar('TUNE_FEATURES', True).split()
if 'armv7a' in features or 'armv7ve' in features:
tune = 'armv7athf'
if 'bigendian' in features:
tune += 'b'
if 'vfpv3' in features:
tune += '-vfpv3'
if 'vfpv3d16' in features:
tune += '-vfpv3d16'
if 'neon' in features:
tune += '-neon'
if 'vfpv4' in features:
tune += '-vfpv4'
else:
tune = d.getVar('DEFAULTTUNE', True)
return tune
DEFAULTTUNE_angstrom := "${@arm_tune_handler(d)}"
Dealing with BSPs
Ideally a BSP would consist of multiple layers:
That 3rd layer is where most integration problems will be:
GPU blobs
MALI_USERLAND_LIBARIES ?= "mali450-userland"
# Helper function for overloading the default EGL/GLES implementation.
# The Mali libraries provided by ARM are compatible with the Mesa headers
# and it is safe to use with user space applications linked against Mesa.
def get_mali_handler(d, target):
""" Overloading the default EGL/GLES implementation."""
features = d.getVar('MACHINE_FEATURES', True).split()
mali_libs = d.getVar('MALI_USERLAND_LIBARIES', True);
if(mali_libs):
mali_libs = mali_libs.split()
if 'mali450' in features and mali_libs:
provider = mali_libs[0]
else:
provider = "mesa"
return provider;
PREFERRED_PROVIDER_virtual/egl := "${@get_mali_handler(d, 'egl')}"
PREFERRED_PROVIDER_virtual/libgles1 = "${@get_mali_handler(d, 'libgles1')}"
PREFERRED_PROVIDER_virtual/libgles2 = "${@get_mali_handler(d, 'libgles2')}"
# Disable for non-MALI machines
python __anonymous() {
features = bb.data.getVar("MACHINE_FEATURES", d, 1)
if not features:
return
if "mali450" not in features:
pkgn = bb.data.getVar("PN", d, 1)
pkgv = bb.data.getVar("PV", d, 1)
raise bb.parse.SkipPackage("%s-%s ONLY supports machines with a MALI iGPU" % (pkgn, pkgv))
}
Outside perspective
http://lwn.net/Articles/681651/
There's a set of simple things projects can do the be more friendly (or unfriendly) to distributions... (speaking as someone who builds a distribution).
Good things - http://lwn.net/Articles/681651/
Bad things - http://lwn.net/Articles/681651/