[PATCH 2/2] efi: payload: refactor to use the external barebox state driver.
anis chali
chalianis1 at gmail.com
Mon Nov 3 06:10:32 PST 2025
>> This breaks state for x86-efi, the original user of efi_late_init().
Was not sure to add it to the efi_defconfig
Le lun. 3 nov. 2025 à 01:40, Ahmad Fatoum <a.fatoum at pengutronix.de> a écrit :
>
> Hi,
>
> On 03.11.25 05:38, chalianis1 at gmail.com wrote:
> > From: Chali Anis <chalianis1 at gmail.com>
> >
> > use the external state config to pass the barebox state.
> >
> > Signed-off-by: Chali Anis <chalianis1 at gmail.com>
> > ---
> > arch/arm/configs/efi_v8_defconfig | 2 ++
> > efi/payload/init.c | 50 -------------------------------
>
> This breaks state for x86-efi, the original user of efi_late_init().
>
> > 2 files changed, 2 insertions(+), 50 deletions(-)
> >
> > diff --git a/arch/arm/configs/efi_v8_defconfig b/arch/arm/configs/efi_v8_defconfig
> > index 5f946dd51d4a..26682aab304a 100644
> > --- a/arch/arm/configs/efi_v8_defconfig
> > +++ b/arch/arm/configs/efi_v8_defconfig
> > @@ -21,6 +21,8 @@ CONFIG_CONSOLE_RATP=y
> > CONFIG_PARTITION_DISK_EFI=y
> > CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
> > CONFIG_STATE=y
> > +CONFIG_EXTERNAL_STATE=y
> > +CONFIG_EXTERNAL_STATE_DTB_PATH="/boot/EFI/barebox/state.dtb"
> > CONFIG_BOOTCHOOSER=y
> > CONFIG_RESET_SOURCE=y
> > CONFIG_MACHINE_ID=y
> > diff --git a/efi/payload/init.c b/efi/payload/init.c
> > index 5b827c57ed1f..63d62395cf3f 100644
> > --- a/efi/payload/init.c
> > +++ b/efi/payload/init.c
> > @@ -376,56 +376,6 @@ static int efi_postcore_init(void)
> > }
> > postcore_efi_initcall(efi_postcore_init);
> >
> > -static int efi_late_init(void)
> > -{
> > - const char *state_desc = "/boot/EFI/barebox/state.dtb";
> > - struct device_node *state_root = NULL;
> > - size_t size;
> > - void *fdt;
> > - int ret;
> > -
> > - if (!IS_ENABLED(CONFIG_STATE))
> > - return 0;
> > -
> > - if (!get_mounted_path("/boot")) {
> > - pr_warn("boot device couldn't be determined%s\n",
> > - IS_ENABLED(CONFIG_FS_EFI) ? "" : " without CONFIG_FS_EFI");
> > - return 0;
> > - }
> > -
> > - fdt = read_file(state_desc, &size);
> > - if (!fdt) {
> > - pr_info("unable to read %s: %m\n", state_desc);
> > - return 0;
> > - }
> > -
> > - state_root = of_unflatten_dtb(fdt, size);
> > - if (!IS_ERR(state_root)) {
> > - struct device_node *np = NULL;
> > - struct state *state;
> > -
> > - ret = barebox_register_of(state_root);
> > - if (ret)
> > - pr_warn("Failed to register device-tree: %pe\n", ERR_PTR(ret));
> > -
> > - np = of_find_node_by_alias(state_root, "state");
> > -
> > - state = state_new_from_node(np, false);
> > - if (IS_ERR(state))
> > - return PTR_ERR(state);
> > -
> > - ret = state_load(state);
> > - if (ret != -ENOMEDIUM)
> > - pr_warn("Failed to load persistent state, continuing with defaults, %d\n",
> > - ret);
> > -
> > - return 0;
> > - }
> > -
> > - return 0;
> > -}
> > -late_efi_initcall(efi_late_init);
> > -
> > static int do_efiexit(int argc, char *argv[])
> > {
> > if (!BS)
>
>
> --
> Pengutronix e.K. | |
> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list