LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-07-2018, 05:01 AM   #16
laprjns
Member
 
Registered: Oct 2005
Location: Connecticut USA
Distribution: SalixOS
Posts: 183

Rep: Reputation: 90

Code:
rich[Downloads]$ sudo sh EFI3M.txt 

*** EFI multiboot menu maker ***
	
	Choices:
	1 Build and install the multiboot menu on your computer
	2 Make a rescue USB stick providing the boot menu
	Or just press Enter to quit.
	
Your choice: 1
cp: target '/EFI/efibootmenu/BOOTx64.EFI' is not a directory
cp: omitting directory '/boot/efi'
md5sum: BOOTx64.EFI: No such file or directory
md5sum: grub.cfg: No such file or directory
EFI3M.txt: line 429: [: /boot/efi: binary operator expected
EFI3M.txt: line 431: [: /boot/efi: binary operator expected

Do you want to include a boot entry for the boot menu in the firmware's
boot menu? [y/N]
Code:
Current menu (custom labels on the second line):

1  (sda1)/EFI/Slint/elilo.efi
2  (sda1)/EFI/refind/drivers_x64/hfs_x64.efi
3  (sda1)/EFI/refind/drivers_x64/btrfs_x64.efi
4  (sda1)/EFI/refind/drivers_x64/ext4_x64.efi
5  (sda1)/EFI/refind/drivers_x64/iso9660_x64.efi
6  (sda1)/EFI/refind/drivers_x64/ext2_x64.efi
7  (sda1)/EFI/refind/drivers_x64/reiserfs_x64.efi
8  (sda1)/EFI/refind/drivers_x64/ntfs_x64.efi
9  (sda1)/EFI/refind/refind_x64.efi
10 (sda1)/EFI/refind/tools_x64/gptsync_x64.efi
11 (sda1)/EFI/Microsoft/Boot/bootmgr.efi
12 (sda1)/EFI/Microsoft/Boot/memtest.efi
13 (sda1)/EFI/Microsoft/Boot/bootmgfw.efi
14 (sda1)/EFI/Microsoft/Boot/bootx64.efi
15 (sda1)/EFI/Boot/Shell.efi
16 (sda1)/EFI/Boot/bootx64.efi
17 (sda1)/EFI/Boot/bootx64-trueos.efi
18 (sda1)/EFI/Salix-Xfce-14.2/grubx64.efi
19 (sda1)/EFI/Salix-Xfce-14.2/elilo.efi
20 (sda1)/EFI/tools/Shellx64.efi
21 (sda1)/EFI/tools/gdisk.efi
22 (sda1)/EFI/tools/ipxe.efi
23 (sda1)/EFI/tools/ipxe_discovery.efi
24 (sda1)/EFI/tools/memtest/BOOTX64.efi
25 (sda1)/EFI/Slackware/elilo.efi
26 (sda1)/EFI/ubuntu/fwupx64.efi
27 (sda1)/EFI/ubuntu/grubx64.efi
28 (sda1)/EFI/trueOS/bootx64-trueos.efi

Type:
a line number to select a boot entry and change its label,
or O to change the boot Order,
or V to Validate your changes.
or Q to Quit discarding your changes,
then press Enter:
It made a menu but doesn't seem like it installed a EFI/efimenu directory,
 
1 members found this post helpful.
Old 06-07-2018, 04:53 PM   #17
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1 on Lenovo Thinkpad W520
Posts: 8,491

Original Poster
Rep: Reputation: Disabled
I have found and fixed the bug, which occurred if the target ESP was not mounted when running the script, case that unfortunately I didn't have tested until today, my mistake.

I will do more testing and hopefully will provide the fixed version within one day.

Meanwhile you can still edit the menu (this feature is available as soon as the menu has been written in /var/efibootmenu) then make a rescue USB stick (the smallest that you have is big enough) and check that it displays the edited menu.

This should work even if the EFI image was not installed in an internal ESP, provided that you run the script from the same system as the first time (otherwise it won't find /var/efibootmenu)

Thanks!

PS I am puzzled that the drivers be included in the menu, as they shouldn't. Maybe it's a side effect of the bug? We'll see if running the fixed script changes that.
 
Old 06-09-2018, 04:31 PM   #18
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1 on Lenovo Thinkpad W520
Posts: 8,491

Original Poster
Rep: Reputation: Disabled
EFI3M is now ready with all features included

Well, I am one day late (as usual), but hopefully it was worth waiting.

@ All who downloaded a previous version (before reading this post) : please discard it, it's buggy.

What's new:
  • All known bugs are fixed. This include the one on which laprjns came across (post #16) and another one that leaded to include all .efi files in the menu instead of just the ones looked for (including for instance the refind drivers for Rich).
  • I have checked that the script works whether the target ESP be or not in the same device as /, and that it doesn't matter that the ESP be mounted or not (this is true for the target partition as for those where we look for boot loaders)
  • Tested on Slackware 14.2, Slint 14.2.1.1, Salix Xfce 14.2, Ubuntu 18.04, openSUSE Leap 15.0.
  • The user is informed where (partition and path) the stuff is installed.
  • The user is proposed to display the boot menu after having installed it in an internal ESP as on an USB stick.
  • The boot menu can be (written and) edited, before installation.
  • The user can display an "About EFI3M" page of information (shown below).
Comments, tests and proposed enhancements are still welcome.

If you tested a previous version, please remove /var/efibootmenu, /var/efibootmenuinstall and the whole /EFI/efibootmenu before trying the new one. Also remove the content of /EFI/BOOT, but *only* if it contains our stuff, like this:

root[/boot/efi]# tree EFI/BOOT
EFI/BOOT
├── BOOTx64.EFI
├── efibootgrub.md5
├── efibootmenu.md5
└── grub.cfg

EDIT: you can check that BOOTx64.EFI and grub.cfg were written by EFI3M:
cd to EFI/BOOT then:
md5sum -c efibootgrub.md5
md5sum -c efibootmenu.md5
If both commands output "OK" you can safely remove this stuff.

I won't attach the updated script here, please find it there:
http://slint.fr/testing/EFI3M

Have fun!

Code:
The EFI Multi Boot Menu Maker (EFI3M) allows booting any installed
system for which an EFI boot loader is found on the computer. It comes
handy if you can't boot otherwise some installed system.

EFI3M allows to:
1) Build a boot menu and install it in an EFI system partition of your
   computer, in a specific location and, if not already busy, optionally
   in a fall back location where the firmware should look at priority.
2) Install the boot menu on an USB stick. Then you can boot off the USB
   stick, which in turn will present you with the boot menu allowing to
   boot any of the installed systems. This helps in case for some reason
   the internal boot menu be not displayed.
2) Edit the boot menu, hiding a menu entry, editing its displayed label,
   modifying the order in which the entries are displayed.
   All modifications will be automatically applied to the internal boot
   menu; to apply them to the USB stick you will need to write again the
   menu on it.

Caveat: the menu built by EFI3M can include entries for EFI files that
are not boot loaders, or not working ones. Just hide them editing it.

Didier Spaier <didier~at~slint~dot~fr>

Last edited by Didier Spaier; 06-10-2018 at 06:16 AM.
 
Old 06-10-2018, 07:30 AM   #19
laprjns
Member
 
Registered: Oct 2005
Location: Connecticut USA
Distribution: SalixOS
Posts: 183

Rep: Reputation: 90
Something is wrong with the efibootmgr command in the script. Checkout the path that was added to the firmware's boot menu.
Code:
The boot menu has been installed in /dev/sda1 as /EFI/efibootmenu/BOOTx64.EFI.

Do you want to add an entry for the boot menu in the firmware? [y/N] y

This entry has been added to the firmware's boot menu:
Boot000A* EFI Boot menu	HD(1,800,96000,dccc0346-6342-49cc-a509-c22a6ff7ae0d)File(\EFI\efimenu\menu.efi)
Press Enter to continue. 

You can display the menu now, then if need be edit it to modify, hide
or reorder the labels.
Do you want to display the menu now? [y/N]: n
Also, I not sure that *.EFI will work; all the other efi binaries on my system use *.efi.
 
1 members found this post helpful.
Old 06-10-2018, 10:17 AM   #20
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1 on Lenovo Thinkpad W520
Posts: 8,491

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by laprjns View Post
Something is wrong with the efibootmgr command in the script. Checkout the path that was added to the firmware's boot menu.
Code:
This entry has been added to the firmware's boot menu:
Boot000A* EFI Boot menu    HD(1,800,96000,dccc0346-6342-49cc-a509-c22a6ff7ae0d)File(\EFI\efimenu\menu.efi)
I changed the name of the EFI image from menu.efi to BOOTx64.EFI but forgot to propagate this change to the efibootmgr command, that's why.

Line #533 should be:
Code:
    REPORT=$(efibootmgr -v -c -d $ESP_DEVICE -p $PARTNUM -l "\\EFI\\efibootmenu\\BOOTx64.EFI" -L "EFI Boot menu")
I have tested on my laptop, it now works, and updated http://slint.fr/testing/EFI3M, thanks.
Quote:
Also, I not sure that *.EFI will work; all the other efi binaries on my system use *.efi.
Yes it works. The current UEFI specification states:
Quote:
13.3.1.2 File Names
FAT stores file names in two formats. The original FAT format limited file names to eight characters
with three extension characters. This type of file name is called an 8.3, pronounced eight dot three,
file name. FAT was extended to include support for long file names (LFN).

FAT 8.3 file names are always stored as uppercase ASCII characters. LFN can either be stored as
ASCII or UCS-2 characters and are stored case sensitive. The string that was used to open or create
the file is stored directly into LFN. FAT defines that all files in a directory must have a unique name,
and unique is defined as a case insensitive match. The following are examples of names that are
considered to be the same and cannot exist in a single directory:
Note:
• “ThisIsAnExampleDirectory.Dir”
• “thisisanexamppledirectory.dir”
• THISISANEXAMPLEDIRECTORY.DIR
• ThisIsAnExampleDirectory.DIR
Also I used the name BOOTx64.EFI because it's the mandatory file name in case of removable media (like an USB stick) for x64 and it's simpler to use the same file name in all cases.

Last edited by Didier Spaier; 06-10-2018 at 10:26 AM.
 
Old 06-10-2018, 05:35 PM   #21
laprjns
Member
 
Registered: Oct 2005
Location: Connecticut USA
Distribution: SalixOS
Posts: 183

Rep: Reputation: 90
All seems to be working now.
Code:
rich[~]$ cat /boot/efi/EFI/efibootmenu/grub.cfg 
# Configuration file written by EFI3M, the EFI Multi Boot Manager.
set timeout=30
play 480 440 1
set menu_color_normal=white/black
set menu_color_highlight=white/blue
menuentry "(sda1)/EFI/Salix-Xfce-14.2/elilo.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/Salix-Xfce-14.2/elilo.efi
}
menuentry "(sda1)/EFI/Slint/elilo.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/Slint/elilo.efi
}
menuentry "(sda1)/EFI/Microsoft/Boot/bootmgfw.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
menuentry "(sda1)/EFI/Microsoft/Boot/bootx64.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/Microsoft/Boot/bootx64.efi
}
menuentry "(sda1)/EFI/Boot/Shell.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/Boot/Shell.efi
}
menuentry "(sda1)/EFI/Boot/bootx64.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/Boot/bootx64.efi
}
menuentry "(sda1)/EFI/Boot/bootx64-trueos.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/Boot/bootx64-trueos.efi
}
menuentry "(sda1)/EFI/Salix-Xfce-14.2/grubx64.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/Salix-Xfce-14.2/grubx64.efi
}
menuentry "(sda1)/EFI/tools/Shellx64.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/tools/Shellx64.efi
}
menuentry "(sda1)/EFI/tools/gdisk.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/tools/gdisk.efi
}
menuentry "(sda1)/EFI/tools/ipxe.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/tools/ipxe.efi
}
menuentry "(sda1)/EFI/tools/ipxe_discovery.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/tools/ipxe_discovery.efi
}
menuentry "(sda1)/EFI/tools/memtest/BOOTX64.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/tools/memtest/BOOTX64.efi
}
menuentry "(sda1)/EFI/Slackware/elilo.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/Slackware/elilo.efi
}
menuentry "(sda1)/EFI/ubuntu/fwupx64.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/ubuntu/fwupx64.efi
}
menuentry "(sda1)/EFI/ubuntu/grubx64.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/ubuntu/grubx64.efi
}
menuentry "(sda1)/EFI/trueOS/bootx64-trueos.efi" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/trueOS/bootx64-trueos.efi
}
menuentry "(sda1)/EFI/efibootmenu/BOOTx64.EFI" {
    insmod part_gpt
    insmod part_msdos
    insmod fat
    search --fs-uuid --set=root 9037-2232
    chainloader /EFI/efibootmenu/BOOTx64.EFI
}
menuentry "Shut down computer" {
    halt
}
menuentry "Reboot computer" {
    reboot
 
1 members found this post helpful.
Old 06-10-2018, 05:48 PM   #22
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1 on Lenovo Thinkpad W520
Posts: 8,491

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by laprjns View Post
All seems to be working now.
Thanks for having taken the time to test, Rich, much appreciated.
 
Old 06-11-2018, 05:37 PM   #23
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1 on Lenovo Thinkpad W520
Posts: 8,491

Original Poster
Rep: Reputation: Disabled
Next task (but not soon: I will be busy with Slint in the coming days) will be to provide stuff to be written on an USB stick so that it can be plugged in a computer, load a kernel + an initramfs (much like a Slackware installer does at first) including a script adapted from EFI3M and its deps, allowing to write grub.cfg and BOOTx64.EFI in the ESP of the USB stick, making it a multiboot rescue stick.

Incidentally and just for fun I upgraded gnu-efi to build refind-0.11.2. from source against it. I was surprised to see that it's very simple and fast to build all the EFI files provided by rEFInd, just issuing "make all_gnuefi" in the main directory. Result:
Code:
didier[~/Slint/repo/x86_64/slint-14.2.1/next/source/refind/refind-0.11.2]$ find -name "*.efi"
./filesystems/hfs_x64.efi
./filesystems/ext4_x64.efi
./filesystems/iso9660_x64.efi
./filesystems/ntfs_x64.efi
./filesystems/reiserfs_x64.efi
./filesystems/ext2_x64.efi
./filesystems/btrfs_x64.efi
./gptsync/gptsync_x64.efi
./refind/refind_x64.efi
./drivers_x64/hfs_x64.efi
./drivers_x64/ext4_x64.efi
./drivers_x64/iso9660_x64.efi
./drivers_x64/ntfs_x64.efi
./drivers_x64/reiserfs_x64.efi
./drivers_x64/ext2_x64.efi
./drivers_x64/btrfs_x64.efi
didier[~/Slint/repo/x86_64/slint-14.2.1/next/source/refind/refind-0.11.2
Out of laziness I didn't make a package, just copied the files in the ESP, then ran EFI3M and got refind_x64.efi and gptsync_x64.efi added to the menu . Now I can start rEFInd from EFI3M, then start EFI3M from rEFInd, then...

I mark this thread as [SOLVED].

Last edited by Didier Spaier; 06-11-2018 at 05:47 PM.
 
Old 06-15-2018, 05:49 PM   #24
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1 on Lenovo Thinkpad W520
Posts: 8,491

Original Poster
Rep: Reputation: Disabled
EFI3B is now blind friendly.

I just uploaded an enhanced version: http://slint.fr/testing/EFI3M

Let me quote the script:
Quote:
# Last updated on Friday 16 June 2018 00:28 Paris time.

# Changes since Sunday 10 June 2018:
# In install_on_system_ESP and install_on_USB_stick, run
# build_boot_loader unconditionally
# Optionally play a sound at startup, a tune of n sounds when starting
# the boot entry number n, and specific tunes for reboot and halt.
# Allow the user to set the boot delay in a range 5-60 seconds and store
# these settings in /etc.
# if grub-mkimage is not found, look for grub2-mkimage
I attach a grub.cfg output of the new version.

Example of menu displayed to customize the menu (this is on bare metal, where I have less systems than in a VM:
Code:
Current menu (custom labels on the second line):

1  (sdb1)/EFI/Slint/elilo.efi
   Label: Ligne 1 elilo.efi dans Slint
2  (sdb1)/EFI/Slint/grubx64.efi
3  (sdb1)/EFI/efibootmenu/BOOTx64.EFI
4  (sdb1)/EFI/BOOT/BOOTx64.EFI
5  (sdb1)/EFI/refind/gptsync/gptsync_x64.efi
6  (sdb1)/EFI/refind/refind_x64.efi

Type:
a number between 1 and 6 to select a boot entry then set
  the label used to display it in the boot menu,
D to set the Delay before auto boot,
M for a Mute menu, S for a menu with Sound,
O to modify the boot Order,
V to Validate your modifications.

Just press Enter to undo all modifications and return to the main menu.

Your choice:
It is OK in openSUSE, I will (re)try to run it in Fedora, Debian, Ubuntu and Arch before proposing it to a broader audience.

PS Before someone ask: the tunes for the last boot entries are missing the last octave. It's either my hardware or grub that is buggy, I checked the attached grub.cfg, the frequencies in Herz seem correct.
Attached Files
File Type: txt grub.cfg.txt (5.5 KB, 3 views)

Last edited by Didier Spaier; 06-15-2018 at 05:57 PM.
 
1 members found this post helpful.
Old 06-17-2018, 05:55 PM   #25
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1 on Lenovo Thinkpad W520
Posts: 8,491

Original Poster
Rep: Reputation: Disabled
Now on GitHub

https://github.com/DidierSpaier/EFI3M
 
Old 06-20-2018, 08:47 AM   #26
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1 on Lenovo Thinkpad W520
Posts: 8,491

Original Poster
Rep: Reputation: Disabled
grub-2.02 is necessary for chainloading to elilo.efi

Just a note: EFI3M runs grub-mkimage and it appears that chainloading to elilo.efi (used by Slackware and derivatives) works only with the binary shipped in grub-2.02. Don't ask me why, I don't know.

So, if you want to try EFI3M on Slackware 14.2 that ships grub-2.0, you will need to upgrade grub. Just use the package shipped in Slackware64-current. As far as I know it is safe to use in Slackware64-14.2.

@Pat: maybe you could consider upgrading grub for Slackware version 14.2? Although you be reluctant to upgrade packages in stable releases, as we know and understand.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove from grub2/grub.cfg entries of old non-existing kernels? kaza Fedora 2 03-05-2018 02:46 PM
[SOLVED] Need help managing efi entries jozmak Linux - Newbie 22 07-17-2017 12:12 PM
[SOLVED] Novice script questions: osdetect.cfg, EFI boot EYo Slackware 3 11-22-2014 02:08 AM
3.4 Kernel in testing and EFI stub arubin Slackware 0 11-21-2012 01:44 PM
[SOLVED] Grub can't find grub.cfg when booting - error: no such device Breagha Linux - Software 8 03-14-2010 12:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration