These tools can also be provided by the u-boot-tools package.

This variant promises to be board independent, and comes with a library,
and has more features.

Can be used as drop-in replacement for fw_printenv and fw_setenv.
Helpful for writing env to mmcblockXbootX which is ro by default, and
u-boot-tools does not handle that.

Signed-off-by: Alexander Dahl <[email protected]>
---

Notes:
    v2:
    - reworded commit message
    
    v1:
    - Link: 
https://lore.ptxdist.org/ptxdist/[email protected]/

 rules/libubootenv.in   | 18 ++++++++++++++++--
 rules/libubootenv.make |  7 +++++++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/rules/libubootenv.in b/rules/libubootenv.in
index 70f6d9863..317a440fc 100644
--- a/rules/libubootenv.in
+++ b/rules/libubootenv.in
@@ -1,15 +1,29 @@
 ## SECTION=system_libraries
 
-config LIBUBOOTENV
+menuconfig LIBUBOOTENV
        tristate
        select HOST_CMAKE
        select LIBYAML
        select ZLIB
-       prompt "libubootenv"
+       prompt "libubootenv                   "
        help
          Generic library and tools to access and modify U-Boot
          environment from User Space.
 
          https://github.com/sbabic/libubootenv
 
+if LIBUBOOTENV
+
+config LIBUBOOTENV_TOOLS
+       bool
+       prompt "fw_printenv / fw_setenv"
+       depends on !U_BOOT_TOOLS || ALLYES
+       help
+         Install fw_printenv and fw_setenv to target.
+
+comment "u-boot-tools is selected!"
+       depends on U_BOOT_TOOLS
+
+endif
+
 # vim: ft=kconfig noet tw=72 ts=8 sw=8
diff --git a/rules/libubootenv.make b/rules/libubootenv.make
index d4e678152..769961dfa 100644
--- a/rules/libubootenv.make
+++ b/rules/libubootenv.make
@@ -51,6 +51,13 @@ $(STATEDIR)/libubootenv.targetinstall:
 
        @$(call install_lib, libubootenv, 0, 0, 0644, libubootenv)
 
+ifdef PTXCONF_LIBUBOOTENV_TOOLS
+#      # same path as the equivalents from u-boot-tools package
+       @$(call install_copy, libubootenv, 0, 0, 0755, \
+               $(LIBUBOOTENV_PKGDIR)/usr/bin/fw_printenv, 
/usr/sbin/fw_printenv)
+       @$(call install_link, libubootenv, fw_printenv, /usr/sbin/fw_setenv)
+endif
+
        @$(call install_finish, libubootenv)
 
        @$(call touch)
-- 
2.39.5


Reply via email to