[U-Boot] U-Boot: Environment flags broken for U-Boot

Heiko Schocher hs at denx.de
Mon Sep 2 14:03:00 UTC 2019


Hello Patrick,

I am just testing U-Boot Environment flags and they do not work anymore with
current mainline U-Boot ... I should have made some tbot test for it,
but did not found yet time for it ...

Here log with current mainline:


=> printenv heiko
heiko=changed
=> env flags
Available variable type flags (position 0):
         Flag    Variable Type Name
         ----    ------------------
         s   -   string
         d   -   decimal
         x   -   hexadecimal
         b   -   boolean
         i   -   IP address
         m   -   MAC address

Available variable access flags (position 1):
         Flag    Variable Access Name
         ----    --------------------
         a   -   any
         r   -   read-only
         o   -   write-once
         c   -   change-default

Static flags:
         Variable Name        Variable Type        Variable Access
         -------------        -------------        ---------------
         eth\d*addr           MAC address          any
         ipaddr               IP address           any
         gatewayip            IP address           any
         netmask              IP address           any
         serverip             IP address           any
         nvlan                decimal              any
         vlan                 decimal              any
         dnsip                IP address           any
         heiko                string               write-once

Active flags:
         Variable Name        Variable Type        Variable Access
         -------------        -------------        ---------------
         .flags               string               write-once
         netmask              IP address           any
         serverip             IP address           any
         heiko                string               write-once
         ipaddr               IP address           any
=> setenv heiko foo
=> print heiko
heiko=foo
=> setenv heiko bar
=> print heiko
heiko=bar

I can change Environment variable "heiko" but flag is write-once !

Ok, digging around and I found, that in env/common.c changed_ok is NULL
which results in not checking U-Boot flags:

  26 struct hsearch_data env_htab = {
  27 #if CONFIG_IS_ENABLED(ENV_SUPPORT)
  28         /* defined in flags.c, only compile with ENV_SUPPORT */
  29         .change_ok = env_flags_validate,
  30 #endif
  31 };

reason is your commit:

commit 7d4776545b0f8a8827e5d061206faf61c9ba6ea9
Author: Patrick Delaunay <patrick.delaunay at st.com>
Date:   Thu Apr 18 17:32:49 2019 +0200

     env: solve compilation error in SPL

     Solve compilation issue when cli_simple.o is used in SPL
     and CONFIG_SPL_ENV_SUPPORT is not defined.

     env/built-in.o:(.data.env_htab+0xc): undefined reference to `env_flags_validate'
     u-boot/scripts/Makefile.spl:384: recipe for target 'spl/u-boot-spl' failed
     make[2]: *** [spl/u-boot-spl] Error 1
     u-boot/Makefile:1649: recipe for target 'spl/u-boot-spl' failed
     make[1]: *** [spl/u-boot-spl] Error 2

     Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>


ENV_SUPPORT is only defined for SPL and TPL not for U-Boot, which
leads in change_ok always NULL in U-Boot ...

:-(

reverting this commit and it works again as expected ...

Urgs ... since april 2019 nobody tested this feature

:-(

Nevertheless, reverting commit and I see:

=> print heiko
heiko=test
=> setenv heiko foo
## Error inserting "heiko" variable, errno=1
=>

So we should find a solution for this.

Any ideas?

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list