Embedded Linux Primer

Typical Embedded System consists of:

  • bootloader – is a system configuration software that has knowledge about the low-level details of the hardware system and runs once power is applied to board. Primary responsibility is to initialize the hardware, especially the memory subsystem, and load the OS image.  Most embedded systems are architected in such a way that when the Linux OS takes control, the bootloader ceases to exist.
  • kernel – the Linux OS image.
  • root file system – contains the application programs, system libraries, and utilities that make up a linux system. What is a file system? a file system consists of a predefined set of system directoeries and files in a specific layout on a hard drive or other medium that the Linux kernel mounts as its root file system.

Typical Flash memory layout

Bootloader:

  • Initializes critical hardware components, such as the SDRAM controller, I/O controllers, and graphics controllers.
  • Initializes system memory in preparation for passing control to the operating system.
  • Allocates system resources such as memory and interrupt circuits to peripheral controllers, as necessary.
  • Provides a mechanism for locating and loading your operating system image.
  • Loads and passes control to the operating system, passing any required startup information. This can include total memory size, clock rates, serial port speeds, and other low-level hardware-specific configuration data.

Bootloader vs Bootstrap

The bootloader controls the board upon power-up and does
not rely on the Linux kernel in any way. In contrast, the bootstrap loader’s primary
purpose is to act as the glue between a bare metal bootloader and the Linux kernel. It
is the bootstrap loader’s responsibility to provide a proper context for the kernel to run
in, as well as perform the necessary steps to decompress and relocate the kernel binary
image.

Kernel:

Kernel vs User space/context

  • Kernel context – kernel owns all system memory and operates with full authority over all system resources. kernel has access to all physical memory and to all I/O subsystems. It executes code in kernel virtual address space using a stack created and owned by the kernel itself.
  • User space – user space process has restriced access to the system and must use the kernel system calls to request kenel services such as device and file I/O. User space processes or programs operate in a virtual memory space picked and managed by the kernel. The kernel is cooperation with specialized memory management hardware in the processor, performs virtual to physical address translation for the user space process.
  • What is the purpose? Single biggest benefit of this architecture is that an error in one process can’t trash the memory space of another.

First User Space Process: init

Root File System (RFS):

contains the user space applications and libraries, services daemons, and initialization scripts/programs that your embedded Linux system will need [2]

Example of Bootup Sequence:

The following is the sequence of events on an IA-32 embedded boot flow.
1. The processor comes out of reset, and the reset code within the firmware executes. This firmware initializes the memory and boot devices. The boot device loads the starting code for the second stage boot loader (for example, elilo/grub2), copies it into memory, and jumps to it.
2. The second stage boot loader finds the compressed kernel image file (bzImage) from mass storage, copies that into memory, and jumps to it.
3. The start of the kernel image contains uncompressed code. This code decompresses the compressed kernel image within the bzImage file into the system RAM. It then transfers control to the uncompressed kernel in memory. The kernel’s main starting point is start_kernel() in kernel/init/main.c.
4. The kernel then performs all internal initialization, along with device initialization for drivers that are integrated into the kernel. The kernel then schedules the kernel_init() as the first thread (PID 0).
5. The kernel_init() function starts the user space application init found on the root file system (that could be the RAM disk or mass storage device depending on how the system is configured). [2]

BusyBox:

provides shell commands for embedded systems. It’s almost standard for embedded systems these day because of it’s small size. [2]

 

To set DNS
In /etc/resolve.conf
nameserver

 

Sources:

1

2 – Modern Embedded Computing

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s