Booting ARM Linux the standard way
A deeper look in the new Tow-Boot firmware project for ARM devices.
Tow-Boot is a relatively new project for bringing some consistency to the way we boot Linux on ARM. This is both aimed at the Linux single board computers but also the new wave of Linux phones.
On these devices the most common platform firmware is U-Boot. In some cases the U-Boot provided with the device is a nice and clean mainline U-Boot, in other cases it's the U-Boot build provided by the manufacturer of the SoC.
One big difference between x86 computers and the ARM ecosystem is functionality that you'd expect from the bios/uefi in the hardware is actually in most cases part of the operating system that's installed. This means there's no consistency at all.
Getting to a boot menu on a normal computer is already a mess where you have to guess if you have to press Escape F10, F11, F12 or Delete. On ARM this is worse because this might depend on the operating system you have flashed at that moment.
On a lot of these devices there's also no nice way to have boot feedback yet except for an RGB status led. If we look at the PinePhone here for example the meaning of the led colors also depends on the operating system.
If the PinePhone has Manjaro on it pressing the power button will turn on the red LED. Then it will turn yellow if an image with initramfs is booting and purple when an image without initfs is booting. If the phone has postmarketOS instead the red LED will turn on when booting. Then yellow after the kernel and initfs have been sucessfully loaded and then white if the script is done and the kernel is started. If you're on Mobian instead then only the initial green led will be lit up.
It's inconsistencies like this that makes it hard to know what's happening on the phone when booting, and this is just the led colors. On upstream U-Boot on the PinePhone there's no boot selection options at all. The display on the PinePhone doesn't work in U-Boot yet. But at least there's the volume keys as input and the RGB led as output to make some boot interactions possible. But actually letting end-users use this would be a support nightmare since none of the Linux distributions for the PinePhone would implement this the same way.
Enter Tow-Boot
A nice solution for this problem is not making every distribution figure out an U-Boot build for every device on their own. In an ideal world ARM hardware would act like the x86 hardware. The platform firmware just exists on the board and provides a consistent user interface while booting, no matter what, or if, an operating system is installed.
Tow-Boot is an U-Boot distribution, just like postmarketOS, Mobian, ArchLinux ARM and Manjaro are Linux distributions. The Tow-Boot project takes upstream U-Boot and makes builds for the supported hardware that provide consistency between the various devices. This means that if you pick up a PinePhone, a PinePhone Pro or a Librem 5, the meaning of the RGB led would be the same.
Then if distributions use this U-Boot build and if hardware manufacturers have these builds pre-installed if possible. Then there would also be consistency regardless of what Linux distribution is installed at that moment.
Technical difficulties
Sadly things are not as simple as "Just make things consistent". It's also far from easy to have the "Just use Tow-Boot instead of brewing your own config" for distributions.
One of the nice things about Tow-Boot is that it leverages the Nix build system to generate a nice reproducable build of the platform firmware. This should take away some of the doubts of having a prebuild platform firmware instead of every distribution figuring out how to do this from source. Also distributions not doing this from source would mean there's less chance of inconsistencies slipping in.
Another thing is that boot selection on phones is not something that comes naturally to U-Boot. Graphical boot menus is also not something that's very nice in the stock U-Boot configurations. This is why Tow-Boot adds the required patches to have nice graphical boot menus where possible on that hardware, and patches to have volume key input for example on phones.
Another nice feature is the built-in USB mass storage option in Tow-Boot. People using the PinePhone might be familiar with Jumpdrive, this is a tiny Linux image that boots to a splash screen and exposes the internal storage of the phone over USB. Instead of this working by booting an SD card with Jumpdrive to reflash a device it's now possible to trigger UMS mode in the platform firmware boot menu and have this working without starting Linux at all. This is especially nice on the PinePhone Pro that can't just boot from SD if a valid bootloader is on the eMMC and Tow-Boot isn't installed.
A better ecosystem
One project being able to focus purely on making the boot process as nice as possible means that someone is actually spending some time to make this nice instead of it being the thing you'd have to hack together to make the device boot. This hardware.
In this case that person is Samuel Dionne-Riel. The project lead for Tow-Boot. Thanks to his work we're now in a place where we have a chance to have consistent booting and this is one of the reasons why mobile Linux is slowly moving towards being a mature ecosystem. It's pretty hard to use a Linux phone if you can't depend on it working. And it's pretty hard to make a Linux distribution that you can depend on if you can't depend on the platform firmware.
Comments ()