Table of contents
- What is bootloader ?
- Why we need bootloader ?
- Which bootloader ?
- What is versatilepb ?
- Compilation
- Where to go from here ?
- Kudos
What is bootloader ?
It is a program written to bring up more complex code (eg. kernel).
On very simple system it can even not exist. Bootloader should prepare all required hardware that kernel or different operating software will need at its start point. It is hard to create cross platform bootloader because of variety of system requirements.
Why we need bootloader ?
The true is that we don’t :) because we can simply pass kernel and initramfs as
parameters to QEMU, but it is not common practice for real development environment.
Usually bootloader is stripped in production environment where boot time is
crucial. Second thing, bootloader is useful to learn how real development
environment for embedded system works. From other side using bootloader we can
create single binary file that contain bootable embedded system, so we can run
it without giving multiple arguments at QEMU startup. I will try to keep in mind
idea about being as close to real development environment as possible.
Which bootloader ?
There are many approaches to this problem. The most popular today is U-Boot but there are alternatives like The Barebox Bootloader. I will try to get to know them better in future. Right now I will use U-Boot as Virtual Development Board bootloader to make the edit-compile-download-test cycle similar to real world situation. So get the code:
|
|
U-Boot configuration depends on pair cpu-board. So right now we know that our
cpu will be some ARM but what exactly ? It depends on configuration we will use.
In most scenarios presented in Internet the versatilepb
was used. We can also
think about running different boards.
What pros U-Boot gives us in the light of previous question Why we need bootloader ?
:
- simplified process of porting kernel, because low level stuff is handled by U-Boot
- simplified testing environment in easy way you can grab different version of kernel with different version of initrd and test it
What is versatilepb ?
According to this page
versatile is highly modular, feature-rich range of development board. pb
means Platform Baseboard
integrated, standalone development system with fixed
CPU. But this is only corporate babble :)
QEMU shows versatilepb
as Versatile/PB
(ARM926EJ-S).
Compilation
For Emdebian
cross-toolchain:
|
|
Note: If you wonder what is the convention for cross-toolchain prefix:
|
|
Emdebian
striped vendor probably to keep name short, but for example
Corsstool-NG
follow convetion and calls toolchain like
arm-unknown-linux-gnueabi-
.
Where to go from here ?
Next step will be kernel compilation for our virtual versatilepb
board.
Kudos
[1] Introduction to Das U-Boot, the universal open source bootloader [2] U-Boot [3] U-boot for the multi-boot support [4] Booting Linux with U-Boot on QEMU ARM [5] Bootloader
