More Related Content


Bootloaders (U-Boot)

  1. Unit IV:Embedded Linux Kernel Topic: Bootloaders School Of Electrical Engineering, MITAcademy Of Engineering Course: RealTime Embedded Systems Instructor: Prof. Amit Nagarale - By Omkar Rane BETA17 0120160172 Block-A B.Tech E&TC
  2. Content 1) What is a Bootloader? 2) What is task of a Bootloader? 3) Desktop PC Vs Embedded System Booting Process 4) Embedded System Booting 5) Types of Bootloader and Booting process 6) U-Boot: Universal Bootloader 7) U-Boot: Directory structure 8) U-Boot: Configuration 9) U-Boot: Building 10)U-Boot: Summary 11)References
  3. What is a Bootloader?  The first section of code to be executed after the embedded system is powered on or reset on any platform .  Program that loads the “first program” (the kernel).  The bootloader is the first code to run after power up or reset, and runs before any other software starts on a processor, including an operating system (OS), if an OS exists. For some embedded processors, bootloaders are part of a Board Support Package (BSP), which is used to start up and run the first silicon chips of an embedded MCU, processor, or System on a Chip (SoC).  A boot loader is a type of program that loads and starts the process of an core processor or any system or application or firmware.  Bootloader enables loading an application within the processor memory when a processor is started or booted up.  A boot loader is also known as boot manager or bootstrap loader.
  4. What is task of a Bootloader?  In an embedded system the role of the boot loader is more complicated since these systems do not have a BIOS(Basic input output System) to perform the initial system configuration.  Bootloader initializes basic hardware of system.(Memory setup & initialization, System peripheral initialization).  Bootloader loads application binary, usually an operating system kernel, from flash storage, from the network, or from another type of non-volatile storage.  Bootloader is used for decompression of the application binary.  Bootloader is used for execution of the application.  Besides these basic functions, most bootloaders provide a shell with various commands implementing different operations.  Loading of data from storage or network, memory inspection, hardware diagnostics and testing, etc.  Multiple kernel boots and multiple way boots.
  5. Power On BIOS GRUB Kernel Get Bootloader Get Kernel Power On X-Loader U-Boot Kernel Get Bootloader Get Kernel Desktop PC/Laptop Embedded System Desktop PCVs Embedded System Booting Process
  6. Embedded System Booting What are different ways of booting embedded system? Reset/Halt command BIOS+Boot loader configuration. Bootloader environment. Load kernel using TFTP/Net boot Load kernel from NAND or NOR Load kernel from SD-CARD.
  7. What are the booting media available in embedded systems?  Hard disk and Solid state devices are common in laptops and desktops. However embedded system rarely have disk drives. They often include -  NAND flash ROM  NOR flash ROM  SD CARD  MMC  USB Drive  Disk less Network booting
  8. Types of Bootloader and Booting process What are different types of boot loaders ? 1) Boot-ROM ( or Pre-Boot Loader) • Small code which loads First stage boot loader (Boot code i.e. available on ROM). 2) First Stage Boot Loader • Small Piece of code that initialize the NAND/MMC & DRAM controller. • Initialize hardware components. • Prepare memory space for loading 2nd stage program and set up stack pointer. • Jump entry to second stage. 3) Second Stage Boot Loader • Primary function of the second-stage boot loader is to Loading the kernel into RAM or jumping directly to the start of the kernel. • Check memory map. • Set parameters and initialize hardware components in this stage. • Boot kernel.
  9. U-Boot: Universal Bootloader  The "Universal Bootloader" ("Das U-Boot") is a monitor program  Free Software: full source code under GPL Can get at: //  Production quality: used as default boot loader by several board vendors.  Portable and easy to port and to debug  Many supported architectures: PPC, ARM, MIPS, x86, m68k, NIOS, Microblaze.  More than 216 boards supported by public source tree Simple user interface: CLI or Hush shell.  Environment variable storing option on different media like EEPROM, Flash etc. Advanced command supports.  Easy to port to new architectures, new processors, and new boards  Easy to debug: serial console output as soon as possible Features and commands configurable  As small as possible .As reliable as possible
  10. U-Boot: Directory structure  Api-Machine/arch independentAPI for external applications.  Arch-All architecture dependent functions and CPU specific information.  Board-Platform, board level files. Eg, atmel, icecube, oxc etc., Contains all board specific initialization.  Common-All architecture independent functions and all commands.  Configs-Default configuration files for boards.  Disks-Partition and device information for disks.  Doc- you can find all readme files.  driver-Various device drivers files.  dts- Contains Makefile for building internal U-Boot fdt(file device tree).  examples-Example code for standalone application  Fs-File system directories and codes  Include-Various header files.  lib-Processor specific libraries  Net-network related files.  Post-power on self test.  Scripts-contain sources for various helper programs.  Tools-tool directories and files.  Makefile-Top level make for uboot build and configuration.
  11. U-Boot: Configuration The include/configs/ directory contains one configuration file for each supported board.  It defines the CPU type, the peripherals and their configuration, the memory mapping, the Uboot features that should be compiled in, etc.  It is a simple .h file that sets preprocessor constants. See the README file for the documentation of these constants.  Assuming that your board is already supported by Uboot, there should be a config corresponding to your board, for example include/configs/at91rm9200ek.h
  12.  We need to configure U-Boot for the required board which is generally done as: make <board_name>_config  The board_name can be found in include/configs/ directory  The newer version supports kernel like configuration options like make menuconfig  Compile Uboot, by specifying the cross compiler prefix. make CROSS_COMPILE=<cross_compile_path>.  cross_compile_path could be the command itself if already exported in PATH variable, else you can specify the installation path of command: For example for arm platform it would look like make CROSS_COMPILE=arm-linux-  The result would be u-boot.bin which has to be stored in flash memory (in most of the cases).The invocation of the stored image depends on the target architecture. The memory used to store would play the role here. U-Boot: Building
  13. U-Boot: Summary
  14. Menu based configuration for Uboot Uboot shell
  15. U-Boot: Shell Commands
  16. Name of the bootloader Description Bootmgr boot program for Microsoft systems since Windows Vista and Windows Server 2008 NT loader (NTLDR) boot program for Microsoft systems until Windows XP and Windows Server 2003 Barebox bootloader for embedded systems in printers, cameras, cars, airplanes, and more boot.efi EFI bootloader that has been used in Mac devices since 2006 BootX former bootloader for Mac operating systems Grand Unified Bootloader (GRUB) free boot program for Unix-like operating systems such as Linux ARM Core Bootloader bootloader for microcontrollers (used in iPhones among others) OpenBIOS free, portable boot manager under a GNU-GPL license
  17. References [1] Embedded Boot loader training by Team EMERTXE,PPT ref material. [2] Universal Bootloader by Wave digitech,PPT ref material. [3] Das U-Boot by analog devices ref PPT material. [4] [5] Embedded Linux | Introduction To U-Boot | Beginners, [6] _of_a_bootloader_in_the_context_of_intelligent_vehicle_systems [7] [8]

Editor's Notes

  1. Desktop: 1)Initialization task are done by BIOS. 2) Bootloader is just to boot the kernel. The GRUB (Grand Unified Bootloader) is a bootloader available from the GNU project. A bootloader is very important as it is impossible to start an operating system without it. On embedded System: All needs to be done by the bootloader But in optimized way. What is x-loader? X-loader is a first stage boot-loader that implements a subset of the features of u-boot. It's small enough to fit in on-chip memory but still provides the ability to configure the pin muxing, clocks, serial console and DDR access to load the fully featured u-boot into the second stage boot loader. In IGEP a copy of the x-loader is part of the NAND Not limited to 512bytes Desktop Working: PCs first execute a part of the software known as BIOS (Basic Input/Output System). Its main task is to boot the hardware, carry out the POST (Power On Self Test), which basically checks the hardware is in perfect condition, and load the bootstrap (boot manager) to upload the operating system into the memory.  BIOS can also serve as a layer between the operating system and the hardware. Embedded System: This software boots the processor (and surrounding devices) and loads the operating system in the memory. The latter is normally found compressed, together with the boot load, in flash. Aside from this, typical PC features (such as Power On Self Tests) are also added. The main advantage of embedded bootloaders is they occupy little space and boot far more quickly than the average BIOS (PC).
  2. 1) Trivial File Transfer Protocol (TFTP) is a simple protocol used for transferring files. TFTP uses the User Datagram Protocol (UDP) to transport data from one end to another. 
  3. History: The project's origin is a 8xx PowerPC bootloader called 8xxROM written by Magnus Damm.[7] In October 1999 Wolfgang Denk moved the project to and renamed it to PPCBoot, because did not allow project names starting with digits.[7] Version 0.4.1 of PPCBoot was first publicly released July 19, 2000. In 2002 a previous version of the source code was briefly forked into a product called ARMBoot, but was merged back into the PPCBoot project shortly thereafter. On October 31, 2002 PPCBoot−2.0.0 was released. This marked the last release under the PPCBoot name, as it was renamed to reflect its ability to work on other architectures besides the PPC ISA.[8][9] PPCBoot−2.0.0 became U−Boot−0.1.0 in November 2002, expanded to work on the x86 processor architecture. Additional architecture capabilities were added in the following months: MIPS32 in March 2003, MIPS64 in April, Nios II in October, ColdFire in December, and MicroBlaze in April 2004. The May 2004 release of U-Boot-1.1.2 worked on the products of 216 board manufacturers across the various architectures.[9] The current name Das U-Boot adds a German definite article, to create a bilingual pun on the classic 1981 German submarine film Das Boot, which takes place on a World War II German U-boat. It is free software released under the terms of the GNU General Public License. It can be built on an x86 PC for any of its intended architectures using a cross development GNU toolchain, for example crosstool, the Embedded Linux Development Kit (ELDK) or OSELAS.Toolchain. The importance of U-Boot in embedded Linux systems is quite succinctly stated in the book Building Embedded Linux Systems, by Karim Yaghmour, whose text about U-Boot begins, "Though there are quite a few other bootloaders, 'Das U-Boot', the universal bootloader, is arguably the richest, most flexible, and most actively developed open source bootloader available."[10]
  4. Makefiles are a simple way to organize code compilation. Compiling the source code files can be tiring, especially when you have to include several source files and type the compiling command every time you need to compile. Makefiles are the solution to simplify this task.
  5. Ref: (ARM Linux)