sbabic / libubootenv

Generic library and tools to access and modify U-Boot environment from User Space
72 stars 39 forks source link

lock option missing from cmdline api #14

Closed dellgreen closed 3 years ago

dellgreen commented 3 years ago

At various points during boot, /var/lock is not always available/mounted yet so its important to be able to specify an alternative for the lockfile.

Currently its hard-coded into the code, however in u-boot-fw-utils is was a configurable option.

We are currently in process of replacing u-boot-fw-utils with libubootenv and as we are using the lock option its breaking our scripts.

https://developer.toradex.com/knowledge-base/u-boot-fw-utils

-l, --lock lock node, default:/var/lock

https://github.com/sbabic/libubootenv/blob/master/src/uboot_env.c#L58

sbabic commented 3 years ago

Please see contributin page - github issues are not used on this project. The lock file is introduced here just for compatibility wilt old u-boot-fw-utils, in case a mix is used (SWUpdate+libubootenv and old u-boot-fw-utils). Dropping old u-boot-fw-utils let change the locking mechanism, going away from a file locking mechanism. Of course, then mixing old and new tools is not allowed anymore.

dellgreen commented 3 years ago

Currently calling fw_printenv will fail because it calls libuboot_open which in turn calls libuboot_lock with opens file /var/lock/fw_printenv.lock which the directory doesn't exist in some cases. Unless i misread the code

sbabic commented 3 years ago

Behavior is clear, see my comment above.