Agenda Introduction to Embedded Linux BIOS Vs Bootloader
Agenda • • Introduction to Embedded Linux BIOS Vs Bootloader Anatomy of an Embedded System Storage Considerations Embedded Linux Distributions Embedded Development Environment Development Tools Practical demo 12/29/2021 2
Course Distribution Name of the topic Reference Topic no. No. of hours T 2 Ch. 1. 1 - 1. 3 1 T 2 T 2 Ch. 2. 1 Ch. 2. 2, Ch. 2. 3, 2. 4 1 1 1 Embedded Development Environment, Cross. Development Environment, Host System Requirements, Hosting Target Boards. T 2 Ch. 12, 12. 112. 3 1 Development Tools, GNU Debugger, Tracing and Profiling Tools, Binary Utilities. T 2 Ch. 13 1 Need of Linux, Embedded Linux Today, Open Source and the GPL BIOS Versus Boot loader Anatomy of an Embedded System Storage Considerations, Distributions. Embedded 12/29/2021 Linux 13. 1, 13. 4, 13. 5
References T 2 : Christopher Hallinan, “Embedded Linux Primer -A Practical, Real-World Approach ” 2 nd edition, Prentice Hall. . . BNS_DOCS_2013 -14ES&RTOS-201314ES&RTOS_B. E_Elective-I_2012 -13ES&RTOS-B. E-Elect-I 2012ES&RTOS-Lect. Notes-2012E-Books-ES&RTOS 2012Embedded. LinuxLinux. Pocket. Guide. 2 nd. Edition. pdf 12/29/2021
Introduction to Embedded Linux • Linux has been adopted for embedded products in the worldwide public switched telephone network, global data networks, and wireless cellular handsets, as well as radio node controllers and backhaul infrastructure that operates these networks. • Linux has enjoyed success in automobile applications, consumer products such as games and PDAs, printers, enterprise switches and routers, and many other products. 12/29/2021
Why Linux? ? 12/29/2021
Growth of Embedded Linux • Linux supports a vast variety of hardware architectures, platforms, and devices. • Linux supports a huge variety of applications and networking protocols. • Linux is scalable • Linux can be deployed without the royalties required by traditional proprietary embedded operating systems. • An increasing number of hardware and software vendors now support Linux. 12/29/2021
Embedded Linux Today • cellular phones, • DVD players, • video games, • digital cameras, • network switches • wireless networking gear. 12/29/2021
Embedded Linux … Linux is already in your home or automobile. Linux has been commonly selected as the embedded operating system in devices including • set-top boxes, • high-definition televisions, • Blu-ray DVD players, • automobile infotainment centers, etc. 12/29/2021
Open Source & GPL • Linux is open source • The Linux kernel is licensed under the terms of the GNU GPL (General Public License) • You can download Linux without charge, but development and deployment with any OS on an embedded platform costs. • The GPL is remarkably short and easy to read 12/29/2021 10
Features of GPL • The license is self-perpetuating. • It grants the user freedom to run the program. • It grants the user the right to study and modify the source code. • It grants the user permission to distribute the original code and his modifications. • The license is viral. In other words, it grants these same rights to anyone to whom you distribute GPL software. 12/29/2021
BIOS Versus Boot loader • When power is first applied to the desktop computer, a software program called the BIOS immediately takes control of the processor. • The BIOS is a complex set of system-configuration software routines that have knowledge of the lowlevel details of the hardware architecture. • The BIOS first gains control of the processor when power is applied. • Its primary responsibility is to initialize the hardware, especially the memory subsystem, and • Load an operating system from the PC’s hard drive 12/29/2021
Boot loader On power-up, the boot loader : • 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. 12/29/2021
Boot loader … • 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. 12/29/2021
Anatomy of Embedded System • The system is architected around a 32 -bit RISC processor. • Flash memory is used for nonvolatile program and data storage. • Main memory is synchronous dynamic randomaccess memory (SDRAM). • A real-time clock module keeps the time of day (calendar/wall clock, including date). • This example includes an Ethernet and USB interface, as well as a serial port for console access via RS-232. • The 802. 11 chipset or module implements the wireless modem function. 12/29/2021
An Embedded system 12/29/2021
Characteristics of an embedded system • Contains a processing engine, such as a generalpurpose microprocessor. • Typically designed for a specific application or purpose. • Includes a simple (or no) user interface • Often is resource-limited. For example, it might have a small memory footprint and no hard drive. • Might have power limitations, such as a requirement to operate from batteries. 12/29/2021
Characteristics of an embedded system … • Not typically used as a general-purpose computing platform. • Generally has application software built in, not user-selected. • Ships with all intended application hardware and software pre integrated. • Often is intended for applications without human intervention. 12/29/2021
Embedded Linux Setup • It shows a host development system, running desktop Linux distribution, such as Red Hat, SUSE, or Ubuntu Linux. • The embedded Linux target board is connected to the development host via an RS-232 serial cable/Ethernet. • The development host contains your development tools and utilities along with target files, which normally are obtained from an embedded Linux distribution. 12/29/2021
Embedded Linux Setup 12/29/2021 20
Starting the Target board • When power is first applied, a boot loader supplied with your target board takes immediate control of the processor. • It performs some very low-level hardware initialization, including processor and memory setup, initialization of the UART controlling the serial port, and initialization of the Ethernet controller. • When the initial hardware configuration is complete, UBoot configures any hardware subsystems as directed by its static configuration. For e. g. I 2 C, DRAM, FLASH, L 2 cache, PCI, and network subsystems. • Finally, U-Boot waits for input from the console over the serial port, as indicated by the => prompt. 12/29/2021
Booting the Kernel • U-Boot has initialized the hardware, serial port, and Ethernet network interfaces. • It loads and boots the Linux kernel. • All boot loaders have a command to load and execute an operating system image - bootm • Shortly before issuing a login prompt on the serial terminal, Linux mounts a root file system. 12/29/2021
Root file system • Linux requires a file system. • A file system consists of a predefined set of system directories and files in a specific layout on a hard drive or other medium that the Linux kernel mounts as its root file system. • The root file system contains the application programs, system libraries, and utilities that make up a Linux system. 12/29/2021
Storage Considerations • The hard drive is replaced by smaller and less expensive nonvolatile storage devices. • Hard drives are bulky, have rotating parts, are sensitive to physical shock, and • They require multiple power supply voltages, which makes them unsuitable for many embedded systems. 12/29/2021
Flash Memory • These modules, based on Flash memory technology, are solid-state hard drives, capable of storing many megabytes—and even gigabytes—of data in a tiny footprint. • They contain no moving parts, are relatively rugged, and operate on a single common power supply voltage. • Several manufacturers of Flash memory exist. 12/29/2021
Flash Memory … • More typical storage requirements for embedded Linux systems range from 16 MB to 256 MB or more (gigabyte range). • Flash memory can be written to and erased under software control. • Flash memory is divided into relatively large erasable units, referred to as erase blocks. • One of the defining characteristics of Flash memory is how data in Flash is written and erased. 12/29/2021
NAND Flash Memory • NAND Flash devices improve on some of the limitations of traditional (NOR) Flash by offering smaller block sizes, resulting in faster and more efficient writes and generally more efficient use of the Flash array. • NAND Flash is a relatively new Flash technology. • NAND Flash is more suitable for bulk storage in file system format than raw binary executable code and data storage. 12/29/2021
Flash Memory Layout • The boot loader is often placed in the top or bottom of the Flash memory array. • Following the boot loader, space is allocated for the Linux kernel image and the ramdisk which holds the root file system. • Typically, the Linux kernel and ramdisk file system images are compressed, and the boot loader handles the decompression task during the boot cycle. 12/29/2021
Flash Memory Layout. . 12/29/2021
Flash File System • One of the more popular Flash file systems in use today is JFFS 2, or Journaling Flash File System 2. • It has several important features aimed at improving overall performance, increasing Flash lifetime, and reducing the risk of data loss in the case of power failure. • The more significant improvements in the latest JFFS 2 file system include improved wear leveling, compression and decompression to squeeze more data into a given Flash size, and support for Linux hard links. 12/29/2021 30
Embedded Linux Distributions • Most Linux application programs depend on one or more system libraries. • Other programs require configuration and log files, and so on. • A small embedded Linux system needs many dozens of files populated in an appropriate directory structure on a root file system. 12/29/2021
Embedded Linux Distributions … • A package can consist of many files. A complete Linux distribution can contain hundreds or even thousands of packages. • These are some examples of packages you might find on an embedded Linux distribution, and their purpose: - initscripts contains basic system startup and shutdown scripts. - apache implements the popular Apache web server. - telnet-server contains files necessary to implement telnet server functionality, which allows you to establish telnet sessions to your embedded target. - glibc implements the Standard C library. - busybox contains compact versions of dozens of popular command-line utilities commonly found on UNIX/Linux systems 12/29/2021
Embedded Linux Distributions … • The executable target binaries from an embedded distribution will not run on your PC, but are targeted to the architecture and processor of your embedded system • A desktop Linux distribution tends to have many GUI tools but an embedded Linux distribution typically omits these components in favor of specialized tools aimed at developers, such as memory analysis tools, remote debug facilities, and many more… • An embedded distribution typically contains cross tools, as opposed to native tools. 12/29/2021
Embedded Development Environment • A properly configured development host is a critical asset for the embedded developer. • Your development host must have target components installed that your tool chain and binary utilities can reference. These components include target header files, libraries, target binaries, and their associated configuration files. 12/29/2021
Cross-Development Environment • Native development denotes the compilation and building of applications on and for your host system. • Cross-development denotes the compilation and building of applications on the host system that will be run on the embedded system. 12/29/2021
Cross-Development Environment … 12/29/2021
Host System The development host requires four separate and distinct capabilities: • Cross tool chain and libraries • Target system packages, including programs, utilities, and libraries • Host tools such as editors, debuggers, and utilities • Servers for hosting your target board – TFTP, NFS, . . 12/29/2021
Hosting Target Boards • While developing your embedded Linux kernel, you will compile and download kernels and root file systems to your embedded board many times. • Having an Ethernet connection available on your target board is worth its cost in silicon! • TFTP is a lightweight protocol for moving files between a TFTP server and TFTP client over Ethernet, similar to FTP. • TFTP is a TCP/IP service that must be enabled on your workstation. 12/29/2021
GNU Debugger gdb: stands for GNU Debugger -powerful command line debugger -closely tied to gcc and g++ -supports various architectures and platforms -with gdb you can: run program, stop program execution, see value of variables and expressions , look at source code as it's executed, Execute one line at a time, change the value of variables, observe sequence of function calls 12/29/2021
GNU Debugger gdb: stands for GNU Debugger -powerful command line debugger -closely tied to gcc and g++ -supports various architectures and platforms -with gdb you can: run program, stop program execution, see value of variables and expressions , look at source code as it's executed, Execute one line at a time, change the value of variables, observe sequence of function calls 12/29/2021 40
Gdb … 12/29/2021
GNU binutils The combination of different tools in a group called binutils. This binutils has many tools / commands / utilities. Some of the important are: • as - assembler is an utility program to translate the assembly language statements into a target machine specific machine code • ld - GNU linker: This runs the linker using which an executable is created from the object file. as and ld are run one after the other to generate an executable 12/29/2021
GNU binutils. . • objdump- display information from object files • objcopy - This GNU utility copies the contents of a binary to other. It can write from one binary format to other binary format • gprof – GNU profiler • gcov – GNU coverage tool, • ar – archive (Static library) and also how to create a dynamic library. 12/29/2021
Practical Demo NANDFlash. Programming. doc 12/29/2021
Links • Linux Standard Base Project http: //www. linuxfoundation. org/collaborate/workgroups/l sb • Linux Foundation http: //www. linuxfoundation. org/ • GCC online documentation http: //gcc. gnu. org/onlinedocs/ • Building and testing gcc/glibc cross toolchains http: //kegel. com/crosstool/ • “The TFTP Protocol, Version 2” RFC 1350 www. ietf. org/rfc 1350. txt? number=1350 12/29/2021
Thank You !! 12/29/2021
- Slides: 45