Booting - User device selection in U-Boot?
#1
One of the issues that comes up is that we can't easily select what device to boot during startup.
U-Boot does not have that option for us, yet. During testing, I've had to remove and insert the
MicroSD card far too many times. It would be nice if I could leave it installed and force booting
something else.


So, how about something like this?

U-Boot selectable device target:
        - Pause & blink LED, (which one?), for a short time, (5 seconds?)
        - During this time, accept keyboard input
        - Select boot device of:
                - eMMC, (number 1?)
                - MicroSD card, (number 2?)
        - Timeout default using current scheme, MicroSD if installed, eMMC otherwise.

The exact keys for which devices are not really important. And if NVMe or USB booting works fine
then those could be added as well. Plus, allow changing the default boot order at install time, (so
people with NVMes could be a priority over eMMC).

Plus, perhaps having the ESC and Enter keys immediately jump to the default action. So a way to
skip the pause.

As time goes one, perhaps we can add a primitive text menu on the screen.


At present, this idea does not care where U-Boot is installed, (SPI, eMMC, MicroSD card). For
testing, it probably easiest to have it on a eMMC or MicroSD card. This idea is to address which
device we use for "/boot".

So, what does anyone else think?

Perhaps someone has a better idea?

Does using Grub as a target allow boot chaining?
(Meaning a grub menu entry can say go to another device.)
--
Arwen Evenstar
Princess of Rivendale
#2
I think the petitboot bootloader (also used on some POWER systems) would be a good fit here: https://github.com/open-power/petitboot.

It's a small linux program that scans all connected drives for grub, syslinux, etc. boot configurations and presents them in an ncurses TUI. It uses the kernel's kexec facility to boot the selected OS, so it should work OOTB on arm64.
#3
(05-16-2020, 01:44 PM)Arwen Wrote: U-Boot selectable device target:
        - Pause & blink LED, (which one?), for a short time, (5 seconds?)
        - During this time, accept keyboard input
        - Select boot device of:
                - eMMC, (number 1?)
                - MicroSD card, (number 2?)
        - Timeout default using current scheme, MicroSD if installed, eMMC otherwise.

This reminds me of how Qi used to work on OpenMoko phones. While not quite convenient it was functional and would certainly be an improvement on the current u-boot situation on the pinebook pro.
#4
using the uboot priority mapped to numbers would be great. usb, sd, nvme, emmc = 1 2 3 4 etc.

selectable ala grub would be useful for multiple installed kernels on a single device. most usable for testing.

either would be a huge improvement.
#5
Yes, either Grub with menu, or the simple U-Boot device selection would work.
People doing testing could then select which OS to boot. If it fails, no problem,
just reboot and select the working OS and make a change to the one under
test. Then try again.

At present, I don't see Grub getting both text menu, (on the LCD), and keyboard
support, (also the PBP keyboard, not serial console), any time soon. Grub seems
to support such for x86/x64, but that is likely through BIOS calls that don't exist
for any ARM computer.

Thinking about it, I've added ESC & Return keys to the original post, to do the
obvious thing.
--
Arwen Evenstar
Princess of Rivendale
#6
(06-08-2020, 09:55 AM)Arwen Wrote: Yes, either Grub with menu, or the simple U-Boot device selection would work.
People doing testing could then select which OS to boot. If it fails, no problem,
just reboot and select the working OS and make a change to the one under
test. Then try again.

At present, I don't see Grub getting both text menu, (on the LCD), and keyboard
support, (also the PBP keyboard, not serial console), any time soon. Grub seems
to support such for x86/x64, but that is likely through BIOS calls that don't exist
for any ARM computer.

Thinking about it, I've added ESC & Return keys to the original post, to do the
obvious thing.

I got the PBP keyboard to work with u-boot and grub (using the arm64-efi target). It's as simple as adding a few flags when compiling u-boot to instruct it to enable the necessary USB support, and having "usb start" as part of the boot script (note this does slow down the boot by a second or two). Unfortunately the menu only displays over a serial console since u-boot doesn't know how to initialize LCD.

If anyone has any pointers on how to port the LCD/eDP drivers that linux uses to u-boot I'd love to hear it. The code for both are sooo similar, and unfortunately I wasn't smart enough to figure out the right combination of edits to the u-boot code to make it work (can only make the screen briefly flicker).
#7
All these things you propose can and have be done with u-boot.  For some reason the pinebook pro has an barely functional u-boot with no features.

U-boot has a console, where it's possible to boot specific kernels with custom command lines, mount file systems, copy files between devices, do basic networking like DHCP, ping, tftp load files and mount network drives with NFS.

It can use USB device mode to make the eMMC appear as a flash drive to a host computer connected to the USB port.  Really handy way to repair an eMMC that won't boot, compared to needing to open the pbp up and remove the eMMC module!

You can create scripts to do certain things, e.g. "boot-emmc", "boot-sd", "boot-sdkernel-emmcroot".

There is a menu system that can list boot options and allows selecting one.

It's possible to create an automatic fallback system.  If a kernel fails to boot a certain number of times in a row, then an alternate kernel will be used.  Something run in Linux marks a boot as good when it's reached some point considered good enough, like systemd has finished entering multi-user.target.  Every embedded Linux product I've designed has had something like this.

But the u-boot on the PBP doesn't even have keyboard or fb support, so one can't even seen an error message if it doesn't boot, much less any of the above.
#8
https://forum.pine64.org/showthread.php?tid=10694
#9
I am going to mark this as solved,. Not that all, (or most), distro use U-Boot with the enhancements of display, keyboard and NVMe support. But, it's in progress in the thread that @ALBNC1974 referenced.
--
Arwen Evenstar
Princess of Rivendale
#10
Doesn't seem like much has been done yet to improve the u-boot boot scripts. Being able to use the u-boot console without a serial adapter is a good start. Still lacking stuff like the ability to automatically recover after installing a kernel that doesn't boot or select from usb, sd, emmc, nvme for the OS to boot.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Cant boot into an OS trashtendenz 3 670 10-23-2024, 03:49 AM
Last Post: chaylengordon
  3 days in, slow/stuck or no boot. lgmpbp2 30 3,728 09-05-2024, 08:49 AM
Last Post: lgmpbp2
  Unable to boot? YossiS 4 385 09-04-2024, 10:35 AM
Last Post: wdt
  Converting the Pinebook Pro into a CrowView Note like device 8jef 0 273 08-18-2024, 05:42 PM
Last Post: 8jef
  upgrading u-boot--what version? where to get it? bsammon 11 2,614 05-22-2024, 09:33 AM
Last Post: wdt
  uboot wont boot to SD card after upgrade jbradley419 7 2,283 01-19-2024, 02:29 PM
Last Post: wdt
  Video Flashing/adjusting on boot and reboot jbradley419 0 630 01-16-2024, 09:17 AM
Last Post: jbradley419
  Brand new Pinebook Pro doesn't boot after Manjaro update johnboiles 8 3,724 12-15-2023, 02:11 PM
Last Post: wdt
  PBP won't boot after trying to reinstall Manjaro ARM soupgirl 3 1,470 12-13-2023, 08:17 PM
Last Post: trillobite
  Various freezes during boot & while running several Linux distros - hardware error? donuts 1 1,046 11-22-2023, 11:47 AM
Last Post: fxc

Forum Jump:


Users browsing this thread: 1 Guest(s)