Booting Bare Hardware
Booting a computer is always more complex than one wants to think. On the PC side, it looks as if BIOS finally is retired and replaced by EFI (I wonder which was the last OS to use BIOS for anything that just loading a secondary bootloader). On Mac, EFI has been around for a while. On embedded Linux systems, however, u-boot has been a big player for a long time.
U-boot, or das U-boot, from DENX provides many useful features: networking, basic scripting, FLASH handling and more—all the tools that your average embedded systems engineer relies on to boot, to update and to troubleshoot.
As with all software, it reaches a point where the support for existing platforms grows so large that it motivates a fresh start. Enter Barebox.
Barebox, formerly known as u-boot-v2, is a bootloader with the same goals and ambitions as u-boot, but with a new, more Linuxish, approach. This means having files, a basic shell, file system support and a driver model borrowed from Linux.
Other improvements are that the bootloader can be built as a userspace application for Linux - making it easier to develop and debug. Overall, Barebox moves u-boot away from legacy holding it back, and towards Linux to enable sharing of code and knowledge.
So, how does a Barebox session look? To an end-user, hopefully, it does not show at all. To a developer, the serial port reveals the truth.
Hit any key to stop autoboot: 2
Hitting that key, gives you a prompt:
And an environment:
uboot:/ ls . .. dev env
As in Linux, the dev directory contains the devices of the system. For instance, the mem device represents the memory of the computer.
Back in u-boot, there was a specific md command to show the contents of the memory. It basically looked in the memory and displayed the information. In Barebox, the same utility is implemented using a more POSIX like approach. The /dev/mem device is opened, the address is passed to lseek and the information is read. This not only improves code structure, it means that the same md command can be applied to other devices, for instance flash memories.
If you want to test this boot loader there are a few ways to go about it. First, you can download and build it for the sandbox platform. This creates a Linux userspace application that you can use for testing.
For the braver readers, it is possible to boot Barebox on a number of boards. For my part, I will try it on a BeagleBoard and an old PC.
Johan Thelin is a consultant working with Qt, embedded and free
software. On-line, he is known as e8johan.
|Happy Birthday Linux||Aug 25, 2016|
|ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs||Aug 24, 2016|
|Updates from LinuxCon and ContainerCon, Toronto, August 2016||Aug 23, 2016|
|NVMe over Fabrics Support Coming to the Linux 4.8 Kernel||Aug 22, 2016|
|What I Wish I’d Known When I Was an Embedded Linux Newbie||Aug 18, 2016|
|Pandas||Aug 17, 2016|
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Happy Birthday Linux
- Updates from LinuxCon and ContainerCon, Toronto, August 2016
- ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs
- What I Wish I’d Known When I Was an Embedded Linux Newbie
- New Version of GParted
- Tor 0.2.8.6 Is Released
- NVMe over Fabrics Support Coming to the Linux 4.8 Kernel
- All about printf
- Blender for Visual Effects