[PATCH 5/5] efi_selftest: Enhance MBR test for PARTITION_INFO_PROTOCOL
Heinrich Schuchardt
xypron.glpk at gmx.de
Tue Jan 20 15:56:16 CET 2026
On 1/20/26 14:36, Javier Martinez Canillas wrote:
> The EFI_PARTITION_INFO_PROTOCOL test was added before the protocol fully
> supported MBR partitions. As a result, it lacked specific checks for the
> content of the raw MBR partition record.
>
> Now that MBR support has been implemented, enhance the selftest to provide
> coverage for the MBR entries too.
>
> This verifies that the protocol correctly reads and exposes MBR partition
> records and prevents this functionality to regress due future changes.
>
> Signed-off-by: Javier Martinez Canillas <javierm at redhat.com>
> ---
>
> lib/efi_selftest/efi_selftest_block_device.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/lib/efi_selftest/efi_selftest_block_device.c b/lib/efi_selftest/efi_selftest_block_device.c
> index f145e58a267a..50d1fb29e1ef 100644
> --- a/lib/efi_selftest/efi_selftest_block_device.c
> +++ b/lib/efi_selftest/efi_selftest_block_device.c
> @@ -404,6 +404,18 @@ static int execute(void)
> part_info->system);
> return EFI_ST_FAILURE;
> }
> + /* The first partition starts at LBA 1 on the test image */
> + if (part_info->info.mbr.start_sect != 1) {
> + efi_st_error("MBR start sector %d, expected 1\n",
> + part_info->info.mbr.start_sect);
> + return EFI_ST_FAILURE;
> + }
> + /* The partition type is FAT12 (0x01) in the test image */
> + if (part_info->info.mbr.sys_ind != 0x01) {
> + efi_st_error("MBR system indicator %d, expected 1\n",
> + part_info->info.mbr.sys_ind);
> + return EFI_ST_FAILURE;
> + }
How about defining a static variable with all fields and using memcmp()
to check them all?
Best regards
Heinrich
>
> /* Open the simple file system protocol */
> ret = boottime->open_protocol(handle_partition,
More information about the U-Boot
mailing list