All Rights Reserved. The contents of this document cannot be reproduced without prior permission of the authors. Building Embedded Systems Chapter 2: Building Operating Systems Andreas Knirsch andreas.knirsch@h-da.de
Building Embedded Systems Chapter 2: Building Operating Systems Motivation What is so special for embedded operating systems?
What makes an OS Abstract logic into tasks (processes / threads) Inter Process Communication (IPC) Scheduler to manage temporal behavior Distinct address spaces Memory management Device driver Interrupt handling (see also [Liedtke, 1995] [Wietzke, 2012, pp.5-6])
What makes an OS "EMBEDDED"? Deterministic behavior Low latency (task switch, interrupt) Resource efficient Fast startup Dependable
Examples for embedded OSs QNX Neutrino VxWorks Linux (with patches/extensions) L4 microkernel based Free RTOS OSEK
Building Embedded Systems Chapter 2: Building Operating Systems Linux builds the foundation for the next practical.
Linux monolithic kernel modular architecture (extendable) POSIX API open-source supports various hardware platforms continuously enhanced
Linux: Embedded real-time enhancements available royalty free source code is available mature ecosystem (applications and tools) experienced developer
Who is Doing the Work The number of different developers who are doing Linux kernel development and the ide sponsoring this work have been increasing over the different kernel versions, as can be Linux: Developer since 2.6.11 (2005) 9784 developer 1064 companies These numbers show a continuation of the steady increase in the number of developers Indeed, the 3.10 kernel saw the most developers ever, while 3.9 included the participatio Since the beginning of the git era (the 2.6.11 release in 2005), a total of 9,784 developers those developers worked for a minimum of 1,064 companies. Kernel Version Developers Companies 3.0 1,131 191 3.1 1,168 189 3.2 1,316 231 3.3 1,247 233 3.4 1,286 245 3.5 1,195 242 3.6 1,224 298 3.7 1,280 228 3.8 1,258 241 3.9 1,388 263 3.10 1,392 243 [Corbet et al., 2013]
percentage of the total is the scripts used to configure and build the kernel, as we Those files, too, are part of the larger work, and thus merit being counted. The information in the following table shows the number of files and lines in each Linux: Extend ~ 17 MLOC ~ 43K files The kernel has grown steadily since its first release in 1991, when there were only million lines, the kernel is almost two million lines larger than it was at the time of t Kernel Version Files Lines 3.0 36,788 14,651,135 3.1 37,095 14,776,002 3.2 37,626 15,004,006 3.3 38,091 15,171,607 3.4 38,573 15,389,393 3.5 39,101 15,601,911 3.6 39,738 15,873,569 3.7 40,912 16,197,233 3.8 41,532 16,422,416 3.9 42,435 16,692,421 3.10 43,029 16,961,031 [Corbet et al., 2013]
Linux: Development GNU C GIT software configuration management make based build system prepared for cross compilation builtin configuration system
Linux: Configuration
Linux: User Space Linux on its own does not provide any use. After kernel init Linux handoff to user space. User space tools/applications have to be available. Tools Applications Kernel Bootloader Hardware
Busybox The swiss knife for embedded Linux. bd _tnz (flickr.com) GNU Tools command wrapper. make based build system builtin configuration system Tools: Busybox Kernel Applications Bootloader Hardware
Lab: Mini Linux configure & compile kernel and tools no hard drive (rootfs within initramfs) console based init script (started by the kernel after handoff) Tools: Busybox user application Kernel Bootloader DE2i 150 FPGA / QEMU
Lab: Mini Linux #/bin/sh export PATH=/bin:/usr/bin/ mount -t proc proc /proc mount -t sysfs sysfs /sys mount -t tmpfs tmpfs /dev/shm mount -t tmpfs tmpfs /tmp mount -t mqueue none /dev/mqueue exec /bin/sh Tools: Busybox user application Kernel Bootloader DE2i 150 FPGA / QEMU
Building Embedded Systems Chapter 2: Building Operating Systems Yocto build a whole embedded linux distribution.
About Yocto The Yocto Project is an open source collaboration project that provides templates, tools and methods to help you create custom Linux-based systems for embedded products regardless of the hardware architecture. yocto: 10-24 [https://www.yoctoproject.org]
References Ångström Distribution Wind River Linux GENIVI Intel Mentor Embedded Linux
Poky: key project of Yocto reference distribution build environment consistent Linux OS: validated collection of software consisting of toolchain, kernel and user space. not necessarily embedded: custom relies on Bitbake and OpenEmbedded separates app and system development, but support both
Alternative: DIY Embedded Linux difficult long-term maintenance upstream changes are difficult to track licensing issues efforts on making and porting build systems leaves less time & money to develop SW features [Hatle and Ashfield, 2012]
Alternative: Commercial Embedded Linux many competing systems incompatible build systems and distributions license issues
Yocto Internals: Layers the system ist composed of layers the layers contain the system s building blocks, realized by use of recipes the systems can be customized using layers: - add or substitute recipes - add or modify configurations functionality is grouped using layers e.g. defining board support packages (BSP), system type
Yocto Internals: Recipes define toolchain component, target application or image type.
Build and Run a System in 5 steps 1. Download latest release from https://www.yoctoproject.org/downloads 2. extract tarball and source init script source./oe-init-build-env 3. adapt configuration (machine type, parallelization) vi conf/local.conf 4. build system image (takes some time) bitbake core-image-minimal 5. run image (using virtualization) runqemu qemux86 core-image-minimal [Quick Start Guide: www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html]
Hob a GUI for managing the build system and visualizing image creation process source./oe-init-build-env../scripts/hob
Practical define a custom layer add a image definition recipe to that layer add a user application recipe to that layer add the user app recipe to the custom image build and run the system
Building Embedded Systems Chapter 2: Building Operating Systems References [Corbet et al., 2013] Corbet, J., Kroah-Hartman, G., McPherson, A.: Linux Kernel Development - How Fast It is Going, Who is Doing It, What They are Doing, and Who is Sponsoring It, The Linux Foundation, September 2013 [Hatle and Ashfield, 2012] Hatle, M., Ashfield, B.: Introduction to the Yocto Project, Embedded Linux Conference Europe, Barcelona, Spain, 08.11.2012 [Liedtke, 1995] Liedtke, J.: On μ-kernel Construction, Proc. 15th ACM symposium on Operating systems principles, ACM, New York, USA, 1995. [Wietzke, 2012] Wietzke, J.: Embedded Technologies. Springer, 2012.
All Rights Reserved. The contents of this document cannot be reproduced without prior permission of the authors. Building Embedded Systems Chapter 2: Building Operating Systems Andreas Knirsch andreas.knirsch@h-da.de