[Call for testing] Script to populate grub.cfg with all EFI entries.
1 Attachment(s)
Hello,
The attached script writes a grub.cfg file including entries for all EFI applications (including EFI loaders) found on block devices attached to the system, mounted or not, including IDE and SATA disks, NVMe, USB connected drives, eMMC drives, whatever. It could be useful for folks running multi-boot systems, including non Linux ones, for instance run after elilo. I didn't test with eMMC drives because I don't have any and there is no virtual drives available for VirtualBox. Please test and report your findings here. The file is written in /tmp, not directly in /boot/grub, so there is no risk running the script, I think. I also paste the code below. Code:
#!/bin/sh |
Gave the script a try on my laptop. First here are all the *.efi files on my ESP
Code:
rich[~]$ tree -f -i /boot/efi/EFI/ | grep .efi$ Code:
rich[Downloads]$ cat /tmp/grub.cfg |
Quote:
I assume that this test: Code:
EFIFILE=$(file $MNT/$EFIPATH|grep 'PE32+ executable (EFI application') Code:
tree -f -i /boot/efi/EFI/ | grep .efi$ | xargs file |
Here you go;
Code:
rich[~]$ tree -f -i /boot/efi/EFI/ | grep .efi$ | xargs file |
Thanks. So, this confirms my assumption.
Now, as the script's purpose is to build a boot menu, do you think that some of the missing .efi files should be included in the output file, and which ones? Maybe /boot/efi/EFI/refind/refind_x64.efi? Others? |
Quote:
Window - Only add entry for bootmgfw.efi. Tools directory (EFI/tools) it would be nice to add all the tools, maybe is a sub menu if possible. That what is nice about refind, it adds smaller launch icons for tools in a separate line from the main OS launch applications. For ubuntu, EFI/ubuntu, (its actually Mint) just add an entry for the grubx64.efi. The other file, fwupx64.efi is for launching a firmware update utility. And finally rEFInd. I not sure that launching a boot manager from another boot manager make much sense, but yeah for the sake of completeness I think it should be added. |
Quote:
boot/efi/EFI/refind/drivers_x64/ do nothing. I assume that they are only used by refind itself internally (like the files in /usr/libexec, as an analogy). /boot/efi/EFI/refind/tools_x64/gptsync_x64.efi works, but it's not our business an hybrid MBR anyway as this feature is provided "only for Apple Macs that dual-boot with Windows or some BIOS-mode OS." So I am tempted to write stanzas in the file only if one of these conditions is met:
It is possible than refind be still first started, in this case you can just refresh it and start grub.efi from it. I would like to know which of the resulting entries are actually enabled from the boot menu after that. Then, I am considering allowing the user to customize each stanza's label. Code:
#!/bin/sh |
Hopefully I'll have some time today to test it. Regarding rEFInd, I forgot to add that you should ignore anything in the refind/driver directory. In fact I would suggest that you only add a stanza for refind/refind.efi
|
Here's the list of menu items that your script produced on my system.
Code:
/EFI/Slint/elilo.efi on /dev/sda1 |
OK, now I have compared what says rEFInd (using default options) with what says this script.
Considering your last post I will select files whose name ends on .efi:
I have a (maybe last) question before beginning the real work: in your last post you didn't mention /boot/efi/EFI/Microsoft/Boot/bootx64.efi as bootig but wrote "The only image in the Microsoft directory that booted was bootmgfw.efi, which boots into Win 10" Isn't this other entry also booting? |
Quote:
Quote:
Quote:
|
Thanks again Rich.
Quote:
Quote:
Quote:
|
Let me quote some lines of the EFI Specification, Version 2.7 Errata A :
Code:
13.3.1.3 Directory Structure |
Update and plan
Update: I checked that an ESP on an NVMe devices be detected, installing the soon to be released openSUSE 15 in a dedicated NVMe virtual disk in EFI mode.
As an aside I tried this distribution because my friend Martin Brückner who maintains WackoWiki just wrote me that he likes it. Well, I am pleased with Plasma 5.12, not so with the installer that proposed to erase my other systems to make room for openSUSE until I give it the room it wanted on its own device ;) Status report:
|
Status report
4 Attachment(s)
The new shell script, named EFI3M for "EFI multi-boot menu maker" allow the user to:
On second thought (and though I tried hard to make it fully POSIX compliant) I won't try to make this script work on non Slackware-based distributions. Instead I plan to provide an hybrid ISO image, intended to be written on an USB stick, loading a an initramfs allowing to run EFI3M. This will allow to boot all OS installed on the computer on any kind of mass storage device, provided that an EFI boot loader be found for them on the computer. The initramfs won't even need to include GRUB, as BOOTx64.EFI (that weighs just 693K) would be already installed in an ESP of the USB stick, so only a few utilities allowing EFI3M to write and then customize grub.cfg would be necessary. I will be grateful for comments about this plan but first for testing reports of EFI3M as it is, attached to this post and also stored in http://slint.fr/testing/ I will internationalize EFI3M but as English is not my native language, please do not hesitate to state any typo or bad wording or phrasing of the dialogs and propose enhancements to make the instructions easier to understand and follow. I attach a few pics, just to give an idea. PS Saturday 9 June 2018: I have removed the (buggy) file EFI3M.txt that was attached to this post. |
All times are GMT -5. The time now is 11:21 PM. |