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.
|My Humble Little Game Collection||May 28, 2015|
|New Linux Based OS Brings Internet of Things Closer to Reality||May 27, 2015|
|Non-Linux FOSS: All the Bitcoin, None of the Bloat||May 26, 2015|
|Dr Hjkl on the Command Line||May 21, 2015|
|Initializing and Managing Services in Linux: Past, Present and Future||May 20, 2015|
|Goodbye, Pi. Hello, C.H.I.P.||May 18, 2015|
- New Linux Based OS Brings Internet of Things Closer to Reality
- My Humble Little Game Collection
- Initializing and Managing Services in Linux: Past, Present and Future
- Dr Hjkl on the Command Line
- Using Hiera with Puppet
- Non-Linux FOSS: All the Bitcoin, None of the Bloat
- Gartner Dubs DivvyCloud Cool Cloud Management Vendor
- Infinite BusyBox with systemd
- It's Easier to Ask Forgiveness...
- Goodbye, Pi. Hello, C.H.I.P.