Re: Fix for grub-switch-to-blscfg

2023-05-24 Thread John Paul Adrian Glaubitz
Hello Konstantin! On Wed, 2023-05-24 at 23:54 +0300, Konstantin Vlasov via Grub-devel wrote: > We've discovered that there are some inconsistencies in the > grub-switch-to-blscfg tool, that lead to generating invalid BLS configs, when > /boot is not a separate partition. > > The attached patch

Fix for grub-switch-to-blscfg

2023-05-24 Thread Konstantin Vlasov via Grub-devel
Hi, We've discovered that there are some inconsistencies in the grub-switch-to-blscfg tool, that lead to generating invalid BLS configs, when /boot is not a separate partition. The attached patch fixes it. P. S. There is also a secondary issue, which this patch also fixes: the broken "option

Re: [PATCH v2] efi: Handle NULL return value when getting loaded image protocol

2023-05-24 Thread Daniel Kiper
On Wed, May 24, 2023 at 07:29:09PM +0200, Ard Biesheuvel wrote: > The EFI spec mandates that the handle produced by the LoadImage boot > service has a LoadedImage protocol instance installed on it, but for > robustness, we should still deal with a NULL return value from the > helper routine that ob

Re: [PATCH v4 0/5] efi: Implement generic EFI boot for x86

2023-05-24 Thread Daniel Kiper
On Tue, May 23, 2023 at 05:31:40PM +0200, Ard Biesheuvel wrote: > Switch the i386-efi and x86_64-efi builds to the generic EFI loader, > which enters the Linux kernel via the EFI stub and provides the initrd > via the LoadFile2 protocol. This unifies x86 with other EFI > architectures, and removes

[PATCH v2] efi: Handle NULL return value when getting loaded image protocol

2023-05-24 Thread Ard Biesheuvel
The EFI spec mandates that the handle produced by the LoadImage boot service has a LoadedImage protocol instance installed on it, but for robustness, we should still deal with a NULL return value from the helper routine that obtains this protocol pointer. If this happens, don't try to start the im

Re: [PATCH] efi: Handle NULL return value when getting loaded image protocol

2023-05-24 Thread Ard Biesheuvel
On Wed, 24 May 2023 at 19:15, Ard Biesheuvel wrote: > > The EFI spec mandates that the handle produced by the LoadImage boot > service has a LoadedImage protocol instance installed on it, but for > robustness, we should still deal with a NULL return value from the > helper routine that obtains thi

[PATCH] efi: Handle NULL return value when getting loaded image protocol

2023-05-24 Thread Ard Biesheuvel
The EFI spec mandates that the handle produced by the LoadImage boot service has a LoadedImage protocol instance installed on it, but for robustness, we should still deal with a NULL return value from the helper routine that obtains this protocol pointer. If this happens, don't try to start the im

[PATCH v8 02/10] Unify GUID types

2023-05-24 Thread Oliver Steffen
There are 3 implementations of a GUID in Grub. Replace them with a common one, placed in types.h. It uses the "packed" flavor of the GUID structs, the alignment attribute is dropped, since it is not required. Signed-off-by: Oliver Steffen Reviewed-by: Daniel Kiper --- grub-core/commands/acpi.c

[PATCH v8 01/10] efi: Add grub_efi_set_variable_with_attributes()

2023-05-24 Thread Oliver Steffen
Add a function to the EFI module that allows setting EFI variables with specific attributes. This is useful for marking variables as volatile, for example. Signed-off-by: Oliver Steffen Reviewed-by: Daniel Kiper --- grub-core/kern/efi/efi.c | 19 +-- include/grub/efi/efi.h |

[PATCH v8 05/10] types.h: Add GRUB_SSIZE_MAX

2023-05-24 Thread Oliver Steffen
In the same way as GRUB_SIZE_MAX, add GRUB_SSIZE_MAX. Signed-off-by: Oliver Steffen Reviewed-by: Daniel Kiper --- include/grub/types.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/grub/types.h b/include/grub/types.h index c56ce9820..9f43a5580 100644 --- a/include/grub/types.h +

[PATCH v8 08/10] docs: Reword section headings

2023-05-24 Thread Oliver Steffen
Reword some section headings, remove "The List of" from titles. While grammatically correct, this phrase can be omitted to increase readability, especially in the table of contents. Signed-off-by: Oliver Steffen --- docs/grub.texi | 20 ++-- 1 file changed, 10 insertions(+), 10

[PATCH v8 09/10] Add a module for the Boot Loader Interface

2023-05-24 Thread Oliver Steffen
Add a new module named bli. It implements a small but quite useful part of the Boot Loader Interface [0]. This interface uses EFI variables for communication between the boot loader and the operating system. When loaded, this module sets two EFI variables under the vendor GUID 4a67b082-0a4c-41cf

[PATCH v8 07/10] efi: Add grub_efi_set_variable_to_string()

2023-05-24 Thread Oliver Steffen
Add a function that sets an EFI variable to a string value. The string is converted from UTF-8 to UTF-16. Signed-off-by: Oliver Steffen --- grub-core/kern/efi/efi.c | 22 ++ include/grub/efi/efi.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/grub-core/kern/efi/

[PATCH v8 10/10] util/grub.d: Activate bli module on EFI

2023-05-24 Thread Oliver Steffen
Add a new configuration drop-in file that loads the bli module and runs the command if booting on the EFI platform. Signed-off-by: Oliver Steffen --- Makefile.util.def | 6 ++ util/grub.d/25_bli.in | 24 2 files changed, 30 insertions(+) create mode 100644 util

[PATCH v8 00/10] Add basic Boot Loader Interface support

2023-05-24 Thread Oliver Steffen
This is a step towards supporting unified kernel images (UKI) in Grub. Add a new module named bli. It implements a small but quite useful part of the Boot Loader Interface [0]. This interface uses EFI variables for communication between the boot loader and the operating system. This module sets

[PATCH v8 03/10] kern/misc: Add a format specifier GUIDs

2023-05-24 Thread Oliver Steffen
Extend the printf format specifier for pointers (%p) to accept a suffix specifier G to print GUIDs: %pG can be used to print grub_guid structs. This does not interfere with the -Wformat checking of gcc. Note that the data type is not checked though (%p accepts void*). Signed-off-by: Oliver Steffe

[PATCH v8 06/10] kern/misc, kern/efi: Extract UTF-8 to UTF-16 code

2023-05-24 Thread Oliver Steffen
Create a new function for UTF-8 to UTF-16 conversion called grub_utf8_to_utf16_alloc() in the grub-code/kern/misc.c and replace charset conversion code used in some places in the EFI code. It is modeled after the grub_utf8_to_ucs4_alloc() like functions in charset.h. It can't live in charset.h, bec

[PATCH v8 04/10] grub-core: Make use of guid printf format specifier

2023-05-24 Thread Oliver Steffen
Use the new printf format specifier %pG. Fixes the text representation of GUIDs in the output of the lsefisystab command (missing 4th dash). Signed-off-by: Oliver Steffen --- grub-core/commands/efi/lsefi.c | 13 + grub-core/commands/efi/lsefisystab.c | 6 +- grub-core/com

Re: [PATCH v7 00/10] Add basic Boot Loader Interface support

2023-05-24 Thread Oliver Steffen
Quoting Daniel Kiper (2023-05-19 16:19:28) > On Wed, May 03, 2023 at 03:50:09PM +0200, Oliver Steffen wrote: > > This is a step towards supporting unified kernel images (UKI) in Grub. [...] > Sadly there are still some problems with this patch set... :-( Sorry about that... > First of all please