[PATCH] add bg_env tool support for md devices

15 views
Skip to first unread message

Erdem Kahraman

unread,
Dec 10, 2024, 6:18:52 AM12/10/24
to EFI Boot Guard
The efibootguard bg_xx tools are not sufficient for md configured RAID systems.

The disk is probes as 

lrwxrwxrwx 1 0 0    8 md127
lrwxrwxrwx 1 0 0   10 md127p1
lrwxrwxrwx 1 0 0   10 md127p2
lrwxrwxrwx 1 0 0   10 md127p3
lrwxrwxrwx 1 0 0   10 md127p4
lrwxrwxrwx 1 0 0   10 md127p5
lrwxrwxrwx 1 0 0   10 md127p6

But bg_printenv and bg_setenv tools are 
Searching them without "p"

Partition /dev/md1271 is not mounted.
Error mounting to temporary mount point.
Partition /dev/md1272 is not mounted.
Error mounting to temporary mount point.
Partition /dev/md1273 is not mounted.

Thats why this fix is required for using bg tools on md devices.

Patched to master --->

Signed-off-by: Erdem Kahraman <erdem.k...@siemens.com>
---
 env/env_config_partitions.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/env/env_config_partitions.c b/env/env_config_partitions.c
index eae7be1..1f775a9 100644
--- a/env/env_config_partitions.c
+++ b/env/env_config_partitions.c
@@ -129,7 +129,8 @@ bool probe_config_partitions(CONFIG_PART *cfgpart, bool search_all_devices)
  }
  if (strncmp("/dev/mmcblk", dev->path, 11) == 0 ||
      strncmp("/dev/loop", dev->path, 9) == 0 ||
-     strncmp("/dev/nvme", dev->path, 9) == 0) {
+     strncmp("/dev/nvme", dev->path, 9) == 0) ||
+     strncmp("/dev/md", dev->path, 7) == 0) {
  (void)snprintf(devpath, 4096, "%sp%u",
         dev->path, part->num);
  } else {
-- 


Jan Kiszka

unread,
Dec 10, 2024, 6:52:19 AM12/10/24
to Erdem Kahraman, EFI Boot Guard
Hi Erdem,

thanks for your patch! Some remarks below.

On 10.12.24 12:18, Erdem Kahraman wrote:
> The efibootguard bg_xx tools are not sufficient for md configured RAID
> systems.

I would write that they "lack support for...".

>
> The disk is probes as 

...is probed as

>
> lrwxrwxrwx 1 0 0    8 md127
> lrwxrwxrwx 1 0 0   10 md127p1
> lrwxrwxrwx 1 0 0   10 md127p2
> lrwxrwxrwx 1 0 0   10 md127p3
> lrwxrwxrwx 1 0 0   10 md127p4
> lrwxrwxrwx 1 0 0   10 md127p5
> lrwxrwxrwx 1 0 0   10 md127p6
>
> But bg_printenv and bg_setenv tools are 
> Searching them without "p"

searching for them

>
> Partition /dev/md1271 is not mounted.
> Error mounting to temporary mount point.
> Partition /dev/md1272 is not mounted.
> Error mounting to temporary mount point.
> Partition /dev/md1273 is not mounted.
>
> Thats why this fix is required for using bg tools on md devices.

Strictly spoken, it's a feature, not a fix.

>
> Patched to master --->

Please drop this line. And please base on next (though this one will
apply to both right now).

>
> Signed-off-by: Erdem Kahraman <erdem.k...@siemens.com>

My tooling can fix this up but you should not rely on it: When you
sending from you private address, you should add a

From: Erdem Kahraman <erdem.k...@siemens.com>

to the first line of the commit message so that git will pick that up as
author address. Check how my patches look like, even when using
siemens.com as sender.

[Side note: we do have infrastructure at out company to send patches via
corporate addresses, just reach out to me directly.]

> ---
>  env/env_config_partitions.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/env/env_config_partitions.c b/env/env_config_partitions.c
> index eae7be1..1f775a9 100644
> --- a/env/env_config_partitions.c
> +++ b/env/env_config_partitions.c
> @@ -129,7 +129,8 @@ bool probe_config_partitions(CONFIG_PART *cfgpart,
> bool search_all_devices)
>  }
>  if (strncmp("/dev/mmcblk", dev->path, 11) == 0 ||
>      strncmp("/dev/loop", dev->path, 9) == 0 ||
> -    strncmp("/dev/nvme", dev->path, 9) == 0) {
> +    strncmp("/dev/nvme", dev->path, 9) == 0) ||
> +    strncmp("/dev/md", dev->path, 7) == 0) {
>  (void)snprintf(devpath, 4096, "%sp%u",

Patch is white-space mangled. Please do not use Outlook or some
web-mailer for sending patches. There are many native email clients
supporting plain-text, and there is also git send-email.

>         dev->path, part->num);
>  } else {
> -- 

Jan

--
Siemens AG, Foundational Technologies
Linux Expert Center
Reply all
Reply to author
Forward
0 new messages