On 05.10.21 12:17, Jan Kiszka wrote: > On 05.10.21 09:37, Michael Adler wrote: >> Previously, the command >> >> bg_setenv -f files/BGENV.DAT --args "root=/dev/sdb" >> >> would correctly update the kernelargs, but all other key/value pairs are >> lost (actually, memset to zero). In particular, BGENV.DAT no longer >> stores a reference to the kernel file and thus, the device is unable to >> boot from the updated BGENV. >> >> The new behavior is as follows: >> >> * if BGENV.DAT already exists, load it before applying the k/v updates >> * otherwise fall back to the previous behavior, i.e. create a new >> BGENV.DAT and apply the k/v updates to it >> >> Signed-off-by: Michael Adler <[email protected]> >> --- >> tools/bg_setenv.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c >> index d26eeed..522fd83 100644 >> --- a/tools/bg_setenv.c >> +++ b/tools/bg_setenv.c >> @@ -601,13 +601,18 @@ static int printenv_from_file(char *envfilepath) { >> static int dumpenv_to_file(char *envfilepath) { >> /* execute journal and write to file */ >> int result = 0; >> + int success = 0; >> BGENV env; >> BG_ENVDATA data; >> >> memset(&env, 0, sizeof(BGENV)); >> - memset(&data, 0, sizeof(BG_ENVDATA)); >> env.data = &data; >> >> + success = get_env(envfilepath, &data); >> + if (!success) { >> + memset(&data, 0, sizeof(BG_ENVDATA)); >> + } >> + >> update_environment(&env); >> if (verbosity) { >> dump_env(env.data); >> > > As this changes the existing behaviour of the bg_setenv command in a > possibly breaking way, how about requesting this explicitly via an > update mode (-u|--update)? >
...except that --update already exists and has a different semantic. Better name needed, the key is the concept. Jan -- Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux -- 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/1395d221-36aa-ed65-3ba2-c409abb4f4d3%40siemens.com.
