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:

uboot:/

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.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

"On the PC side, it looks as

Jeremy Harton's picture

"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)."

What on earth is that supposed to mean? BIOS isn't something you can retire, it stands for Basic-Input-Output-System. A BIOS of some kind is needed to supply at least the minimal input/output required to get the computer going. By definition anything that performs at least that function is a BIOS.

While the idea of an interface between the hardware and the OS might be nice, I'd frankly feel better if it was read-only. I don't like the idea that I could accidentally overwrite the bios with something else. I also very much like the idea that the BIOS does it's job and is not messed with by the OS or the user and that it doesn't/shouldn't have any reason to be anything suspicious. Although, it does make me a little concerned that if the bios gets corrupted someday or the ROM breaks, that it will be almost irreplaceable and if there's a bug in at the moment, it's just too bad.

*HP Laptops seems to be able to update the BIOS from the OS, as opposed to booting from a floppy. Is that new, and is it really any different from older ones in that respect?

I do know what BIOS stand

Johan Thelin's picture

I do know what BIOS stand for, and I completely agree that it is something that always will be there. However, the BIOS that we know since the birth of the IBM PC back in 1983 is being replaced by EFI.

Johan Thelin is a consultant working with Qt, embedded and free
software. On-line, he is known as e8johan.

Dumb User

Phred's picture

As a dumb old user I don't really care how it gets done, as long as I have a few options to help with problems. Something that my new Inspiron 15R seems to be lacking.

Booting Bare Hardware

Harald Arnesen's picture

Uh-uh. In 2021, maybe.

Love Coreboot, Hope ZaReason starts using it as planned.

CB's picture

I agree that the boot-up process, especially the BIOS part is much more difficult by design than it should be. Also makes it harder to create USB boot devices specific to Linux, not DOS or Windows, than it should be. Thankfully there are many options today in creating these devices very easily with Linux alone...its a brave new world!

I too love Coreboot and was fortunate enough to meet the creator at SCaLE7x (Southern California Linux Expo number 7) two years ago. To say it boots fast is an understatement as I am not aware of anything faster than Coreboot for a BIOS dependent computing device. Proprietary hardware has been a thorn in the side of Gnu/Linux for years...not any more.

Since ZaReason (@zareason on twitter) only uses hardware that just works out of the box with all distros of Linux it has been my sole source for hardware for years now. And no I do not work for or get paid by the company. Every time I read about any user having a hardware problem it is because of proprietary hardware, proprietary device drivers or a proprietary BIOS that usually caters ONLY to Microsoft Windows operating system. That is so 1980s.

At SCaLE9x the owners for ZaReason said that they were hoping to include the Coreboot BIOS on some of their future computer lines. At that point we will have hardware that is 100% Linux compatible and a BIOS that supports Linux! Woot Woot!

I love that there is yet another boot loader catering to Linux, if Barebox is as fast as Coreboot than it will be worth checking out.

I was unaware of BIOS being retired for EFI by Microsoft, guess I will have to look at it to make sure there are no Embrace, Extend and Extinguish FUD going on with EFI as I have no experience with it specifically. There is such a negative distrustful history that Microsoft has earned over the years, that anything they use is now suspect by default.

Burn me once, shame on you, burn me twice shame on me.... why give them a third opportunity to mess with you.

Thankfully by purchasing my PC, laptop, netbook, multi-media and server hardware from "Linux ONLY" vendors (i.e. ZaReason) I never get burned by the childish games proprietary manufacturers like to play with consumers...helps one to sleep better at night. I can currently run Windows if I wanted to and guarantee that the hardware purchased today will run Linux tomorrow when the proprietary company discontinues the operating system software for that hardware....as they always do eventually. Why fill the dump with viable hardware, why not re-purpose the hardware for something else.

Thanks for the heads up on EFI and the reminder about U-boot, a good article.

Linux Boot on olfd hardware,,,

Jerry McBride's picture

Yes!

I've been a big fan of doing away with the BIOS for a while now. Your first experiece with LINUXBios or now named COREBoot... will surprise the hell out of you, with just how fast it is.

I'm waiting... anxiously... longing... for the day I can do a simple BIOS update and over write the old BIOS with "coreboot". As it is, I have a number of motherboards that don't have removing the prom and flashing it as an option.

For the motherboards that are support, what a difference it makes!

---- Jerry McBride

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState