8

I've read numerous times that the raspberry pi doesn't support grub. I've not been able to find any specifics about the incompatibility. I've only found rather blunt statements of the form "it's not supported".

I would like to understand exactly what the issue is and what would need to be re-written to make it work.

What I have found so far is that the stage 3 bootloader reads start.elf which in turn reads the kernel image. To my mind, if grub were to work it would replace (entirely) start.elf. I've looked at the format of UEFI bootloaders and discovered that they use a PE format executable. So my first hypothesis is that the incompatibility is (only) that grub is compiled as a PE and stage 3 only reads ELF.

Have I missed some other major incompatibility? Have I missed some other major task of start.elf which would be lost if it were replaced by grub?

  • I'm not 100% on this, but I think the issue is the ARM processor. AFAIK, grub only works for Intel architectures. – Seamus Jun 11 at 14:42
  • @Seamus Thanks for the thought. The existence of Debian package grub-efi-arm suggests that grub can be used on ARM. – Philip Couling Jun 11 at 14:45
  • See raspberrypi.org/documentation/configuration/boot_folder.md re functionality of start.elf. – Dirk Jun 11 at 14:46
  • Did not know that - thanks! Have you tried the ARM version of GRUB? – Seamus Jun 11 at 16:36
  • 2
    I'd like to get a comment from people who voted to close this question as "not specific to Raspberry Pi". How is a problem of something being not compatible with a Raspberry Pi not specific to it? – Dmitry Grigoryev Jun 13 at 11:51
4

Actually, if you want to install Ubuntu with a generic kernel on your Raspberry Pi, you have to use grub2, as described here.

The only compatibility quirk is that grub2 may set the EFI flag on the boot partition, and the RPi bootloader will refuse to boot off a partition with an EFI flag set. The flag can be manually cleared by any partition editor, making both RPi bootloader and grub2 recognize the partition correctly.

  • That's a shiny link I had not found. I wonder if the EFI check can be turned off. – Philip Couling Jun 13 at 12:07
  • @PhilipCouling I don't think so, in my understanding the check is done in the closed-source part of the bootloader chain. – Dmitry Grigoryev Jun 13 at 12:48
1

The Raspberry Pi is special that the primary (on-chip ROM) , secondary (bootcode.bin) and third bootloader (start.elf) are executed on its GPU, one chainloading the other. The instruction set is not properly documented and start.elf itself top-secret.

What can be done (as SuSE and Microsoft have demonstrated) is to replace kernel.img at will - even with a custom version of TianoCore (an open-source UEFI implementation) or U-Boot. This can then be used to start an UEFI-compatible GRUB2 or BOOTMGR binary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.