You are not logged in.
Am I right that:
Most UEFI boot managers don't suggest distinct menu entries (almost) out of the box for poweroff and reboot, even though these are usable entries.
Two distinct source code, one that can add a poweroff, the other that can add a reboot, menu entries to most, possibly any, UEFI boot managers will be surprisingly short.
Neither the AUR, nor the binary archives, have packages that offer that functionality.
?
powerofforreboot.efi (AUR): Utilities to be used from within a UEFI boot manager or shell.
Offline
1) What do you mean by "UEFI boot manager"? Do you mean a bootloader?
2) I don't understand the sentence at all.
3) Why should one package such a useless feature?
If the system is not bootet, You can power it off directly py pressing the power button.
And you can reboot it by pressing
[Ctrl]+[Alt]+[Del]
If you want an EFI loader entry, which I consider useless, you can add a boot entry with
systemd.unit=reboot.target
or
systemd.unit=poweroff.target
respectively.
Last edited by schard (2019-04-03 14:21:04)
macro_rules! yolo { { $($tokens:tt)* } => { unsafe { $($tokens)* } }; }
Offline
schard: systemd-boot, refind, the firmware's menu, etc are all boot managers, NOT bootloaders.
Online
Suppose I want the boot menu to look like
archlinux
archlinux fallback
UEFI shell
reboot
poweroff
As far as I remember, the reboot and poweroff is quite customary. Syslinux has a poweroff module. Persumably because the machine might be under the desk, so pressing the power button might not be convenient.
A reboot entry might help users that are not familiar with ctrl+alt+del, or are not sure when ctrl+alt+del is safe, or must have something that supposedly looks more professional.
systemd targets are not shown in the boot menu, do they?
1) What do you mean by "UEFI boot manager"? Do you mean a bootloader?
Stroked text by schard. I assume it was answered.
2) I don't understand the sentence at all.
I was trying to say that just like the archlinux and archlinux-fallback menu entries, I think there are two main issues.
How to get that entry into the menu?
What exactly the boot loader manager should do with poweroff/reboot entries, once they are there?
The answer to putting the entries in the menu is that it is boot loader manager specific, and similar to any other entry the menu has.
The answer to what the boot loader manager would do with the poweroff/reboot entries is surprisingly short programs. Or that is what I think. These programs can be built from source with a new PKGBUILD. No need to modify the source code of the boot loader manager. No need to modify the boot loader manager PKGBUILD. Any user that doesn't want these entries can simply not install that poweroff/reboot PKGBUILD. And even if he built the package, he can not install it or not add the poweroff/reboot entries to his UEFI menu.
3) Why should one package such a useless feature?
If the system is not bootet, You can power it off directly py pressing the power button.
And you can reboot it by pressing[Ctrl]+[Alt]+[Del]
If you want an EFI loader entry, which I consider useless, you can add a boot entry with
systemd.unit=reboot.target
or
systemd.unit=poweroff.target
respectively.
I tried to answer a few line above, at the beginning of this message.
Last edited by regid (2019-04-03 17:23:58)
powerofforreboot.efi (AUR): Utilities to be used from within a UEFI boot manager or shell.
Offline
Do you plan on using the EFI runtime services API for poweroff / reboot?
Offline
Why not just use a boot manager? I use rEFInd and I have the options to boot to Arch, to a UEFI Shell, to the system BIOS, to do a MemTest, shutdown and reboot all on my rEFInd greeter.
Offline
Do you plan on using the EFI runtime services API for poweroff / reboot?
Yes. I plan to use EFI runtime services. More specifically, ResetSystem().
powerofforreboot.efi (AUR): Utilities to be used from within a UEFI boot manager or shell.
Offline
Why not just use a boot manager? I use rEFInd and I have the options to boot to Arch, to a UEFI Shell, to the system BIOS, to do a MemTest, shutdown and reboot all on my rEFInd greeter.
I am using systemd-boot. It doesn't have builtin shutdown and reboot. I didn't know that these are on rEFInd greeter. systemd-boot isn't graphical either. I think rEFInd is graphical.
powerofforreboot.efi (AUR): Utilities to be used from within a UEFI boot manager or shell.
Offline
Yes indeed rEFInd is graphical but that's what I personally like about it because the graphics is flexible enough to customise and so it is as how I want it to look. The options are not all there but can be added accordingly. You can also customise rEFInd to just print text if that's all you want.
Offline
The following works for me with systemd-boot. Hopefully it will work in many efi firmawres, and with other boot managers:
poweroff.c
#include <efi.h>
#include <efilib.h>
EFI_STATUS
EFIAPI
efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
InitializeLib(ImageHandle, SystemTable);
return uefi_call_wrapper(SystemTable->RuntimeServices->ResetSystem, 4,
EfiResetShutdown, EFI_SUCCESS, sizeof(NULL), NULL);
}
reboot.c
#include <efi.h>
#include <efilib.h>
EFI_STATUS
EFIAPI
efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
InitializeLib(ImageHandle, SystemTable);
return uefi_call_wrapper(SystemTable->RuntimeServices->ResetSystem, 4,
EfiResetCold, EFI_SUCCESS, sizeof(NULL), NULL);
}
Makefile
ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
EFIINC = /usr/include/efi
EFIINCS = -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol
LIB = /usr/lib
EFILIB = /usr/lib
EFI_CRT_OBJS = $(EFILIB)/crt0-efi-$(ARCH).o
EFI_LDS = $(EFILIB)/elf_$(ARCH)_efi.lds
CFLAGS = $(EFIINCS) -fno-stack-protector -fpic \
-fshort-wchar -mno-red-zone -Wall
ifeq ($(ARCH),x86_64)
CFLAGS += -DEFI_FUNCTION_WRAPPER
endif
LDFLAGS = -nostdlib -znocombreloc -T $(EFI_LDS) -shared \
-Bsymbolic -L $(EFILIB) -L $(LIB) $(EFI_CRT_OBJS)
all: poweroff.efi reboot.efi
%.so: %.o
ld $(LDFLAGS) $^ -o $@ -lefi -lgnuefi
%.efi: %.so
objcopy -j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc \
--target=efi-app-$(ARCH) $^ $@
When All 3 files are in the same directory
% make
Should build poweroff.efi and reboot.efi.
The dependencies, other then base-devel, is gnu-efi-libs.
poweroff.efi and reboot.efi should be copied to the ESP, and the boot manager should be configured to call them. They should also work from a UEFI shell.
If someone cares to upload it to the AUR, just drop a notice here. I don't have AUR upload privileges. I think these utilities should be there.
Last edited by regid (2019-04-09 00:57:00)
powerofforreboot.efi (AUR): Utilities to be used from within a UEFI boot manager or shell.
Offline
AUR is for hosting PKGBUILDS not the projects themselves.
AUR registration is open once registered you should be able to upload the PKGBUILD yourself.
Offline