Bootloaders: Thomas Petazzoni Michael Opdenacker
Bootloaders: Thomas Petazzoni Michael Opdenacker
Bootloaders
Thomas Petazzoni
Michael Opdenacker
Free Electrons
© Copyright 20042010, Free Electrons.
Creative Commons BYSA 3.0 license
Latest update: Feb 23, 2010,
Document sources, updates and translations:
http://freeelectrons.com/docs/bootloaders
Corrections, suggestions, contributions and translations are welcome!
1
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Bootloaders
The bootloader is a piece of code responsible for
Basic hardware initialization
Loading of an application binary, usually an operating system
kernel, from flash storage, from the network, or from another type of
nonvolatile storage.
Possibly uncompression of the application binary
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.
2
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Bootloaders on x86 (1)
The x86 processors are typically bundled on a board with a non
volatile memory containing a program, the BIOS.
This program gets executed by the CPU after reset, and is
responsible for basic hardware initialization and loading of a
small piece of code from a nonvolatile storage.
This piece of code is usually the first 512 bytes of an hard disk
This piece of code is usually a 1st stage bootloader, which will
load the full bootloader itself.
The bootloader can then offer all its features. It typically
understands filesystem formats so that the kernel file can be
loaded directly from a normal filesystem.
3
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Bootloaders on x86 (2)
GRUB, Grand Unified Bootloader, the most powerful one.
http://www.gnu.org/software/grub/
Can read many filesystem formats to load the kernel image
and the configuration, provides a powerful shell with various
commands, can load kernel images over the network, etc.
See our dedicated presentation for details:
http://freeelectrons.com/docs/grub/
LILO, the original Linux Loader
http://freshmeat.net/projects/lilo/
Syslinux, for network and removable media booting
http://syslinux.zytor.com
4
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Bootloaders on embedded architectures (1)
On embedded architectures, the lowlevel booting process is very CPU and
board dependent
Some boards have a NOR flash from which the CPU starts executing
instructions after reset. In that case, the bootloader must directly be flashed
inside the NOR at the proper location
Some CPUs have an integrated bootcode in ROM that automatically loads a
small portion of a DataFlash or NAND flash, usually to a static RAM. In that
case, a minimal first stage bootloader is required, that will load the main
bootloader (BootROM on AT91SAM CPUs, Steppingstone on S3C24xx
CPUs, etc.).
The bootloader on embedded architectures starts right after CPU reset, so it
must initialize all the devices, including the memory controller in order to access
the DRAM.
As the boot process is very CPU and board dependent,
refer to the vendor documentation.
5
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Bootloaders on embedded architectures (2)
We will focus on the generic part, the main bootloader, offering the
most important features.
There are several opensource generic bootloaders.
Here are the most popular ones:
UBoot, the universal bootloader by Denx
The most used on ARM, also used on PPC, MIPS, x86, m68k,
NIOS, etc. Clearly the most widely used community solution.
http://www.denx.de/wiki/UBoot
RedBoot, based on RedHat eCos
http://sources.redhat.com/redboot/
There are also a lot of other opensource or proprietary
bootloaders, often architecturespecific
6
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Embedded Linux system development
Accessing a serial console
7
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Minicom (1)
Definition: serial communication program
Available in all GNU / Linux distributions
Capabilities (all through a serial link):
Serial console to a remote Unix system
File transfer
Modem control and dialup
Serial port configuration
8
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Minicom (2)
Start by running
minicom s to setup
Minicom
A bit austere at first glance,
but quickly gets friendly
(see the labs for details)
9
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Other terminal emulators
GTKTerm: http://www.jlsinfo.com/julien/linux/
Graphical. Less powerful than Minicom, but with a simpler and
more attractive interface. Available in recent distros.
CuteCom: http://cutecom.sourceforge.net/
Another graphical and userfriendly terminal emulator.
Available in recent distros.
picocom: http://freshmeat.net/projects/picocom/
Tiny terminal emulator (20K), can be used in embedded systems.
GNU Screen: can also be used on a serial console:
screen <device> <baudrate>
Example:
screen /dev/ttyS0 115200
10
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Related documents
All our technical presentations
on http://freeelectrons.com/docs
Linux kernel
Device drivers
Architecture specifics
Embedded Linux system development
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
How to help
You can help us to improve and maintain this document...
By sending corrections, suggestions, contributions and
translations
By asking your organization to order development, consulting
and training services performed by the authors of these
documents (see http://freeelectrons.com/).
By sharing this document with your friends, colleagues
and with the local Free Software community.
By adding links on your website to our online materials,
to increase their visibility in search engine results.
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Linux kernel
Linux device drivers
Free Electrons
Board support code Our services
Mainstreaming kernel code
Kernel debugging
Custom Development
System integration
Embedded Linux Training
Embedded Linux demos and prototypes
All materials released with a free license! System optimization
Unix and GNU/Linux basics Application and interface development
Linux kernel and drivers development
Realtime Linux, uClinux Consulting and technical support
Development and profiling tools Help in decision making
Lightweight tools for embedded systems System architecture
Root filesystem creation System design and performance review
Audio and multimedia Development tool and application support
System optimization Investigating issues and fixing tool bugs