Dear Devs, this series changes how configuration environments are located. By that, accidential collisions with environments from other media (e.g. USB drives) can be avoided. For the recovery use-case, we provide an option to override this. In addition, this is a first step towards integrating with the systemd boot loader interface.
The core idea is to forward the boot device information from the bootloader to the userspace libraries by using EFI variables. This is required, as properly locating the block device of the config partitions is tricky, just based on the device the rootfs is on. Consider the following situations: - rootfs on different disk - rootfs on device mapper or mdadm As we want to stick to the systemd boot loader interface, we do not forward the UUIDs of the config envs, but just of the partition the loader was started from (this information is provided by EFI). Usually this is the UUID of the ESP. In userspace, we then resolve the backing / parent device of the ESP. This is trivial, as both partitions need to reside on the same device. Once we have that information, we can limit the probing to that device. Changes since v3: - dropped explicit memset(ebgenv) from API docs (as not required) - only add deprecation attrib to declaration (but not to definition) Changes since v2: - add tests for all devs vs. current dev logic - set deprecated attrib on ebg_beverbose instead of log message Changes since v1: - change option infrastructure to use single global instead of modifying the bgenv out parameter. - port verbose option over to new option infrastructure - adapt testcases to new interface and add test cases - integrate updates of tools into library patches - style fixes Best regards, Felix Moessbauer Siemens AG Felix Moessbauer (3): efi: implement systemd boot loader interface libebgenv: only probe config on root dev (opt-out) port verbose option over to ebg_set_opt Makefile.am | 2 + docs/API.md | 3 + env/env_api.c | 41 +++++++++- env/env_api_fat.c | 6 +- env/env_config_partitions.c | 90 +++++++++++++++++++++- include/ebgenv.h | 27 ++++++- include/ebgpart.h | 2 +- include/env_api.h | 7 +- include/env_config_partitions.h | 2 +- include/loader_interface.h | 25 ++++++ kernel-stub/main.c | 11 +++ loader_interface.c | 69 +++++++++++++++++ main.c | 12 +++ tools/bg_envtools.c | 4 + tools/bg_envtools.h | 4 + tools/bg_printenv.c | 6 ++ tools/bg_setenv.c | 7 ++ tools/ebgpart.c | 27 ++++--- tools/tests/test_bgenv_init_retval.c | 32 +++++++- tools/tests/test_ebgenv_api.c | 19 +++++ tools/tests/test_probe_config_file.c | 2 +- tools/tests/test_probe_config_partitions.c | 2 +- 22 files changed, 367 insertions(+), 33 deletions(-) create mode 100644 include/loader_interface.h create mode 100644 loader_interface.c -- 2.39.2 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/20231018065617.227867-1-felix.moessbauer%40siemens.com.
