What do you mean by Bootloader in Embedded System
- A boot loader is a small software or program mostly stored in the ROM memory space of microcontroller.
- It is the first program runs When any computing system is switched on.
- Sometimes it is also known as Firmware Program, because it is stored in the ROM.
- The Bootloader loads the Operating system kernel (main module of the operating system) in the RAM Memory space.
- Or in simple words “The small program needed to start the operating System Execution” is called Boot-loader.”
What do you mean by Booting
Booting is the process or execution of bootloader program mostly stored in the ROM memory locations.
In the process of booting, it is needed to access the non volatile devices such as hard-disk.
What do you mean by Primary and Secondary Memory or Storage
The primary memory is near to the processor (micro-processor or cpu), and it is byte wise accessible. Means each byte of data in the primary memory have a unique address.
The data stored in the secondary storage is in the form of files, like hard-disk, memory card etc.
The processor can execute the program from the primary memory only, because the secondary memory is not randomly accessible.
The secondary memory cost is very less as compared to the primary memory for the same amount of capacity.
In case of power off the data in the secondary memory will not be erased.
Types of Primary Memory
The primary memory can be RAM or ROM.
The data in the ROM is permanent, means when you power off the system the data in the ROM will remain in the memory.
But the RAM memory is volatile in nature, means when you power off the system the data of RAM will be erased.
Note: The Operating system will be resides in the RAM space and erased every time you shut-down your system.
Memory Organization of Embedded System
- The microprocessors are able to executes the program from the primary memory only.
- The most of such systems uses both ROM and RAM as the primary memory.
- The ROM is actually permanently loaded with the program called Bootloader.
- The operating system kernel program are copied temporarily in the RAM for the execution.
- The complete operating system permanently stored in the secondary storage like hard-disk.
The figure below shows the typical memory organization of computing systems.
What is the Main Function of Bootloader Program
It will perform initial system check for proper functioning of all the devices attached.
It will load the operating system kernel program from the secondary storage to the RAM Memory space.
Finally it will start the execution of the operating system, by transferring the control from ROM to the RAM location.
Additional Function of the Boot Loader
Sometimes bootloader also provide some provision to follow different booting sequence or options based on certain conditions.
Like selection of different operating system.
For example P89v51RD2 have two mode of operation, normal execution mode and and programming mode.
Case 1: Bootloader watch the serial port of microcontroller and if it receives programming commands, then the bootloader starts the programming mode of microcontroller.
Case 2: And if not receive programming command, the bootloader starts the execution of stored program in the program memory.
Warning: The Boot loader is dependent on the hardware board, cpu and operating system. And hence it is different for different hardware and software design.
What is the need of Bootloader
Bootloader solve many system design problems.Important Fact
The Operating system will be resides in the RAM space and erased every time you shut-down your system. And when system starts again bootloader restore the operating system from the secondary storage.
Why Operating System Uses RAM not ROM
First and important point is that, if operating system uses ROM, it can not be customized.
Secondly, OS kernel uses different dynamic libraries to perform all the OS functions, frequently unload and load these libraries as and when required.
Because of use of RAM OS becomes more user friendly, and for permanent storage such systems uses secondary storage like hard-disk.
What is Multi-Stage Bootloader
Booting process may be single or multi-stage, depends on the complexity of the system.
In multi stage bootloader first stage boot-loader is a firmware and stored in the ROM memory. The role of first stage bootloader is to load the second stage bootloader from the secondary storage to the RAM memory.
The second stage bootloader is basically a software, and can be installed and customized as other application software.
Most of the modern PC’s uses the concept of multi stage bootloader.
The second stage bootloader provide the choice of operating system to load, and then finally load the selected or default operating system from the secondary storage.