Move U-Boot private data into a separate file. This
lets export fw_env.h to be used by external programs
that want to change the environment using the library
built in tools/env.
Signed-off-by: Stefano Babic <sbabic@denx.de>
$ make tools-all
...
In file included from tools/env/env_flags.c:1:0:
tools/env/../../common/env_flags.c: In function
‘env_flags_parse_varaccess_from_binflags’:
tools/env/../../common/env_flags.c:156:18: warning: implicit declaration
of function ‘ARRAY_SIZE’ [-Wimplicit-function-declaration]
for (i = 0; i < ARRAY_SIZE(env_flags_varaccess_mask); i++)
^
Seems like the other utilities just add a copy of ARRAY_SIZE since
there's nowhere to include it from (tools/imagetool.h,
tools/mxsimage.h). Let's do the same here.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
We should use ARRAY_SIZE, but not sizeof. The size of
env_flags_varaccess_mask is 16bytes, but we only need 4 loops.
If using 16 as the end condition, we may access memory that
not belong to array env_flags_varaccess_mask.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: York Sun <yorksun@freescale.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Before calling hsearch_r, initialize callback entry to NULL.
Coverity log:
"
Uninitialized scalar variable (UNINIT)
uninit_use_in_call: Using uninitialized value e.
Field e.callback is uninitialized when calling hsearch_r.
"
Reported-by: Coverity
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
The code that checks if a string has the format of a MAC address has been
moved to a separate function called eth_validate_ethaddr_str().
This has been done to allow other components (such as vsc9953 driver)
to validate a MAC address.
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: York Sun <yorksun@freescale.com>
In some cases it can be helpful to have context in the callback about
the calling situation. This is needed for following patches.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
when creating the hashtable, for each environmentvariable
getenv(ENV_CALLBACK_VAR) and getenv(ENV_FLAGS_VAR) is called,
which costs at this point a lot of time. So call this two
getenv() calls only once.
Boottime on the ids8313 board without this patch:
2013-12-19 13:38:22,894: NAND: 128 MiB
2013-12-19 13:38:27,659: In: serial
(~4.8 sec)
Bootime with this patch on the ids8313 board:
2013-12-19 13:40:25,332: NAND: 128 MiB
2013-12-19 13:40:25,546: In: serial
(~0.2 sec)
Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Wolfgang Denk <wd@denx.de>
Use the variable access flags to implement the protection for ethaddr
and serial# instead of hard-coding them.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Similar to the env callback command, this will show details about the
options available, the static list, and the currently active variables.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address. Call
env_acl_validate_setenv_params() from setenv() in fw_env.c.
If the entry is not found in the env .flags, then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.
Need to build in _ctype for isdigit for Linux.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address.
If the entry is not found in the env ".flags", then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>