Lecture02_LinuxBasedEmbeddedSystemComponentStack
Lecture02_LinuxBasedEmbeddedSystemComponentStack
Introduction
Bootloader
Kernel
Device tree
System programs
Application
Root filesystem
Introduction
Bootloader
Kernel
Device tree
System programs
Application
Root filesystem
Root File
Application
System
Bootloader
System Programs
• Software executed at power-up to set-up the hardware to run
the operating system
System Call Interface
Device tree
Process Virtual File
kernel
Linux
• A tree data structure with nodes that describe the physical Management System
devices in the hardware needed by the Linux kernel to
initialize properly the device drivers Memory Network
Management Management
Linux Kernel
Device Drivers
• The operating system code providing all the services to
manage the hardware resources
Bootloader Device tree
Hardware
5 © 2017 Arm Limited
Linux-based Embedded System Components
Root File
Application
System
System programs
System Programs
• User-friendly utilities to access operating system services
Kernel
Linux
the embedded system user Management System
Root filesystem Memory Network
• Container for the Linux Kernel configuration files, the system
Management Management
programs, and the application
Device Drivers
Hardware
6 © 2017 Arm Limited
Reference Hardware Model
Multiple implementations of the reference hardware model are possible. For example:
• Microcontroller-based implementation: a single device hosts most of the reference model components (e.g. CPU,
RAM memory, boot flash).
• System-on-Chip implementation: most of the reference model components are discrete components, while the CPU
is integrated with some of them (e.g. I/O, boot flash).
Microcontroller (MCU) System on Chip (SoC)
CPU CPU
RAM RAM Mass
Boot
Memory Memory Memory
Flash
Boot Flash
I/O I/O
Flash
Introduction
Bootloader
Kernel
Device tree
System programs
Application
Root filesystem
When powered-up, the processor needs a simple way to get the information it needs.
• Where the software is located
• How to get access to the software location
• Where the stack is located
At power-up, the program counter is set to a default known value, the reset vector.
• The software starting at the reset vector, which will load the bootloader, which takes care of providing the processor
all the needed information.
• The operations performed depend on the system architecture.
Root File
used for data, stack and heap only.
System
Stack System
Heap Programs
Operating
System
Device tree
Bootloader
b 0x0000_0FFF
CPU reset vector 0x0000_0000 0x0000_0000
b 0x0000_0FFF
CPU reset vector 0x0000_0000 0x0000_0000
b 0x0000_0FFF
CPU reset vector 0x0000_0000 0x0000_0000
b 0x0000_0FFF
CPU reset vector 0x0000_0000 0x0000_0000
Introduction
Bootloader
Kernel
Device tree
System programs
Application
Root filesystem
The Linux Kernel is the software responsible for optimally managing the embedded
system’s hardware resources.
It offers services such as: System Call Interface
• Process management Process Virtual File
Kernel
Linux
• Process scheduling Management System
• Inter-process communication Memory Network
• Memory management Management Management
• I/O management (device drivers) Device Drivers
• File system
• Networking
• And more
Space
User
architecture:
System Programs
• The operating system is divided into two layers, one (user space)
built on top of the other (Kernel space).
• User space and Kernel space are different address spaces. System Call Interface
• Basic services are delivered by a single executable, monolithic Process Virtual File
Kernel.
Space
Kernel
Management System
• Services can be extended at run-time through loadable Kernel
modules Memory Network
Management Management
Device Drivers Loadable
Module
Advantage Application
Space
User
• Good separation between application/system programs System Programs
and kernel. Bugs in the user space do not corrupt the
kernel.
Space
Kernel
can crash the whole system. Management System
Memory Network
Management Management
Device Drivers Loadable
Module
Introduction
Bootloader
Kernel
Device tree
System programs
Application
Root filesystem
To manage hardware resources, the Kernel must know which resources are available in
the embedded system (i.e. the hardware description: I/O devices, memory, etc).
There are two ways to provide this information to the Kernel:
• Hardcode it into the Kernel binary code. Each modification to the hardware definition requires recompiling the
source code.
• Provide it to the Kernel when the bootloader uses a binary file, the device tree blob.
A device tree blob (DTB) file is produced from a device tree source (DTS).
• A hardware definition can be changed more easily as only DTS recompilation is needed.
• Kernel recompilation is not needed upon changes to the hardware definition. This is a big time saver.
Introduction
Bootloader
Device tree
Kernel
System programs
Application
Root filesystem
Introduction
Bootloader
Device tree
Kernel
System programs
Application
Root filesystem
The application is the software required to provide the end user service for which the
embedded system was conceived.
Examples can be found in many different products:
• Network Attached Storage (NAS)
• Network router
• In-vehicle infotainment
• Specialized lab equipment
• And more
Introduction
Bootloader
Device tree
Kernel
System programs
Application
Root filesystem
The Linux Kernel needs a file system, called a root filesystem, at startup.
• It contains the configuration file needed to prepare the execution environment for the application (e.g. setting up
the Ethernet address).
• It contains the first user-level process (init).