-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix boot failure on ARM UEFI devices because of missing regexp
module.
#1010
Fix boot failure on ARM UEFI devices because of missing regexp
module.
#1010
Conversation
Changelog: Fix boot failure on ARM UEFI devices because of missing `regexp` module. A typical error log looks like this: ``` Welcome to GRUB! error: no such device: ((hd0,msdos1)/efi/boot)/EFI/BOOT/grub.cfg. lock: OK lock: OK error: can't find command `regexp'. error: disk `,msdos2' not found. Dropping to grub prompt for unknown reason. Should never get here. ``` It happened because the binary `grub-efi-bootarm.efi` file was not updated when the regexp module was added as a requirement. Fixed by grabbing it from the vexpress-qemu UEFI build. Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
Hello 😸 I created a pipeline for you here: Pipeline-156735344 Build Configuration Matrix
|
Confirmed that this fixes the problem:
|
Thanks! |
One of the downsides of an opaque binary is that it's an incredible hill climb to add a feature. Maybe I could seek some direction for this feature? I wrote a live installer for installing to the BeagleBone's eMMC, and with just U-Boot I was able to dual-boot the entire system (SD card when present, eMMC when not). The key was for U-Boot to propagate which device it knows is booting throughout the boot process, all the way to Mender. I modified the Mender U-Boot patch to know which device to do A/B root partitioning on. Now I get to maintain a U-Boot patch of a U-Boot patch. Um... no thanks. So I fought with the GRUB option and UEFI booting. Now, 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, and I think this has to come from U-Boot like before. If there were a simple way to pass a parameter from U-Boot to grub, and condition on this parameter in grub.cfg, then I could achieve dual-boot again. Indeed, U-Boot supports USB devices, so someday maybe triple-boot. What challenge am I looking at? Do I need to find some repo for the binary file, learn the build system, modify the code, compile and deploy myself? Or is there a way to pass data from U-Boot to grub.cfg? Thanks for your input. |
@eigendude I am not sure on passing data from U-boot to grub. I think the DTB is shared so perhaps there is something that can be injected there. I would suggest asking this question in the forums over on Mender hub since it will get a wider audience there. We would also love to see the installer you mention. |
The opaque binary is unfortunately necessary because of toolchain issues in Yocto. I believe it is because Yocto refuses to compile it without hard float support, despite the fact that floats are not used in GRUB, and compiling with them breaks GRUB. So we compile it with a different toolchain. That being said, I am not a huge fan of the current approach with using a stripped down feature set. Especially with UEFI, it makes sense that the GRUB boot loader supports a standard set of commands, so that it is fully customizable. But it would require some research into whether all modules should be included, or whether we should omit some for security/size reasons. Of course, it would increase size regardless, but I think we can live with that if it's not too big. In the zeus branch, the method for building the binary has been cleaned up considerably, so you may find it easier to experiment with building a new one. Check out this repository and script. Still not optimal, but better than warrior.
I'm a little bit confused, doesn't the |
Thanks, I'll ask on Mender hub. It sounds like digging is required. Here are the two commits for the eMMC installer so far:
|
Here is the regexp command:
It looks like it modifies the
How is
Where does
I need to dynamically select between Linux does this by reading the |
So I did exactly that... and almost even in that order 🙂 I found the EFI API between u-boot and grub. U-boot passes a handle to the disk that grub was loaded from, but the context identifying the disk is lost. The disk always becomes So we have two options. The "hacky" way, where the live installer mounts the boot partition after it's dd'ed, and then sed's I'll take the hacky option now, but USB booting is really tempting, and could benefit almost every device beyond those with eMMC. Aclima sends sensors to far-flung reaches of the earth, where connectivity isn't a given, and it would be nice to email the 200MB disk img file that can be burned to a USB stick and booted. If I'm successful with the eMMC installer and dual boot, should I open a draft PR? I'm happy to shed visibility into the work, and if I'm able to, I'm willing to do the extra work it takes to upstream. At the very least, I can maintain the draft PR as long as it stays hacky for anyone who's comfortable with a hacky option. |
Thanks for a great investigation! Given that EFI is a standard, I wonder if it already has a way to pass disk context through its API. I think U-Boot implements only a subset of the standard, and might be missing this part. If so, I reckon both U-Boot and GRUB maintainers would be happy to receive patches to enable it. This is just a guess, I'm no expert on EFI, but might be worth asking on the U-Boot mailing list.
Yes, please do! This sounds like a very worthwhile improvement! |
Changelog: Fix boot failure on ARM UEFI devices because of missing
regexp
module. A typical error log looks like this:It happened because the binary
grub-efi-bootarm.efi
file was notupdated when the regexp module was added as a requirement. Fixed by
grabbing it from the vexpress-qemu UEFI build.
Signed-off-by: Kristian Amlie kristian.amlie@northern.tech