8. Using and configuring the bootloader
The Stamp9G20 and PortuxG20 come U-Boot preinstalled. This is
an open-source bootloader for embedded systems developed and
maintained by Denx Software Engineering. As it is already well
documented, it is not described here. See the original
documenation for further information: http://www.denx.de/wiki/view/DULG/UBoot.
The Stamp9G45 on the other hand comes with a Linux-based
bootloader named Boots. It uses a standard Linux kernel for
hardware support, busybox for scripting and kexec to load the
real kernel to be used. There are also some helper scripts. To
permanantly store settings and boot scripts it uses the U-Boot
environment variable tools.
This chapter will describe this bootloader.
The Boots bootloader itself is just a couple of small programs and shell
scripts. Combined with the Linux kernel, a small initramfs containing
kexec and busybox and U-Boot style environment variables this results in
a flexible boot mechanism.
Linux kernel.
The Linux kernel is the center of the bootloader and responsible
for hardware access. Using it instead of dedicated bootloader
drivers gives you the same maturity and stability as the real
system.
kexec.
Without kexec, this software would not be able to function as a bootloader.
Kexec is a mechanism provided by the Linux kernel, to start another kernel
without rebooting.
Busybox.
Busybox contains a lot of small userspace tools and a shell to allow
flexible scripting for the boot process.
U-Boot style environment variables.
U-Boot uses a very simple but reliable way to store boot variables and
scripts. This method is also used here.
Figure 8.1, “Boots flow-chart” shows the general boot procedure.
As you can see, at first, the script code in the variable
preboot is executed. After that, the boot is delayed
for bootdelay tenths of a second. Depending on wether
this delay was aborted or not, either bootcmd or
abortcmd is executed. Normally,
bootcmd does not finish, as it is used to boot into
the real system, but if it does or abortcmd finishes,
either a shell will be launched for you to interact with the system, or
loopcmd will be executed if it exists. Both will be
restarted a second after they finish.