[PATCH v2 1/1] efi_loader: discover if no efi_system_partition is set
Ilias Apalodimas
ilias.apalodimas at linaro.org
Mon Oct 24 11:01:48 CEST 2022
On Sun, 23 Oct 2022 at 11:02, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> Variable efi_system_partition holds the efi_system_partition. Currently it
> is initialized as:
>
> {
> .uclass_id = 0 = UCLASS_ROOT,
> .denum = 0,
> .part = 0,
> }
>
> This indicates that host 0:0 is the efi_system_partition and we see output
> like:
>
> => bootefi hello
> ** Bad device specification host 0 **
> Couldn't find partition host 0:0
>
> To identify that no EFI system partition has been set use UCLASS_INVALID.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
> v2:
> Adjust the check in efi_disk_add_dev()
> ---
> lib/efi_loader/efi_disk.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index cef4e45124..cd2d51fd71 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -19,7 +19,9 @@
> #include <part.h>
> #include <malloc.h>
>
> -struct efi_system_partition efi_system_partition;
> +struct efi_system_partition efi_system_partition = {
> + .uclass_id = UCLASS_INVALID,
> +};
>
> const efi_guid_t efi_block_io_guid = EFI_BLOCK_IO_PROTOCOL_GUID;
> const efi_guid_t efi_system_partition_guid = PARTITION_SYSTEM_GUID;
> @@ -509,7 +511,7 @@ static efi_status_t efi_disk_add_dev(
> diskobj->media.last_block);
>
> /* Store first EFI system partition */
> - if (part && !efi_system_partition.uclass_id) {
> + if (part && efi_system_partition.uclass_id == UCLASS_INVALID) {
> if (part_info->bootable & PART_EFI_SYSTEM_PARTITION) {
> efi_system_partition.uclass_id = desc->uclass_id;
> efi_system_partition.devnum = desc->devnum;
> --
> 2.37.2
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
More information about the U-Boot
mailing list