Dual-booting with U-Boot and GRUB (BeagleBone Black)

Hi,

I’m trying to enable dual-boot on the BeagleBone black. My goal is to boot from the SD card if present, and eMMC if not.

To get Mender on the eMMC, I wrote a live installer that can be used when booted from SD. I got this to work on both Warrior and Zeus.

I then succeeded in accomplishing dual-boot with U-Boot. I modified the Mender patch to do A/B partitioning on the disk that U-Boot was booted from. So… now I get to maintain a U-Boot patch of a U-Boot patch. Um, no thanks.

So I switched to GRUB and UEFI booting. After some fighting, I can install and boot the UEFI system from eMMC.

However, at the GRUB step, when the binary reads grub.cfg, it needs to know from which device it was booted from, in order to properly set the root kernel parameter. The arm binary can either get this from U-Boot, or figure it out on its own. So two questions:

  • How can I pass a parameter from U-Boot (which knows the boot device) to the GRUB arm binary?
  • Or, how can the GRUB arm binary know which device it booted from and use this in grub.cfg?

For background, see the comment I posted on GitHub: https://github.com/mendersoftware/meta-mender/pull/1010#issuecomment-645690061