03 Dec, 2019
1 commit
-
These don't need to be in common.h so move them out into a new header.
Also add some missing comments.Signed-off-by: Simon Glass
Reviewed-by: Tom Rini
12 Aug, 2019
3 commits
-
Avoid using a typedef here which is unnecessary. Add an 'env_' prefix to
both the enum and its members to make it clear that these are related to
the environment.Add an ENV prefix to these two flags so that it is clear what they relate
to. Also move them to env.h since they are part of the public API. Use an
enum rather than a #define to tie them together.Signed-off-by: Simon Glass
-
This typedef does not need to be defined in the search.h header since it
is only used in one file (hashtable.c). Remove it from the header and
change it to a struct.Signed-off-by: Simon Glass
-
U-Boot is not supposed to use typedef for structs anymore. Also this name
is the same as the ENTRY() macro used in assembler files, and 'entry'
itself is widely used in U-Boot (>8k matches).Drop the typedef and rename the struct to env_entry to reduce confusion.
Signed-off-by: Simon Glass
Acked-by: Joe Hershberger
09 Feb, 2019
1 commit
-
Only first previously deleted entry was recognized, leading hsearch_r
to think that there was no previously deleted entry. It then conluded
that a free entry was found, even if there were no free entries and it
overwrote a random entry.This patch makes sure all deleted or free entries are always found and
also introduces constants for the 0 and -1 numbers. Unit tests to excersise a
simple hash table usage and catch the corruption were added.To trash your environment, simply run this loop:
setenv i 0
while true; do
setenv v_$i $i
setenv v_$i
setexpr i $i + 1
doneSigned-off-by: Roman Kapl
26 Jan, 2019
1 commit
-
slre_match() checks if caps == NULL. In this case it does not try to
update it. So there is no need to create a buffer caps which we do not
evaluate.Signed-off-by: Heinrich Schuchardt
16 Dec, 2018
1 commit
-
The commit below incorrectly fixed hexport_r();
> size = totlen + 1;
One extra byte is necessary to NULL-terminate a whole buffer, "resp."Fixes: f1b20acb4a03 ("hashtable: Fix length calculation in hexport_r")
Signed-off-by: AKASHI Takahiro
24 Jul, 2018
1 commit
-
The length returned by hexport_r has a few redundant characters.
This appears as NULL characters at the end so seems harmless.Remove the surplus counts in two places
totlen += strlen(ep->key) + 2;
I'm guessing the +2 here is for = and sep char. But there is another
totlen += 2; line that does that.size = totletn + 1;
Doesn't make sense and isn't justified with any comment.Signed-off-by: Zubair Lutfullah Kakakhel
21 Jul, 2018
1 commit
-
When vars are passed to the himport_r function with H_NOCLEAR flag,
those vars will be overridden in the current environment and if one of
those vars is not in the imported environment, it'll be deleted in the
current environment whatever the flag passed to himport_r.The H_NOCLEAR flag is used to clear the whole environment whether vars
are passed to the function or not.This leads to incoherent behaviour. If one passes vars to himport_r
with the H_NOCLEAR flag, if a var in vars is not in the imported env,
that var will be removed from the current env.If one passes vars to himport_r without the H_NOCLEAR flag, the whole
environment will be removed and vars will be imported from the
environment in RAM.It makes more sense to keep the variable that is in the current
environment but not in the imported environment if the H_NOCLEAR flag is
set and remove only that variable if the H_NOCLEAR flag is not set.Let's clear the whole environment only if H_NOCLEAR and vars are not
passed to himport_r.Let's remove variables that are in the current environment but not in
the imported env only if the H_NOCLEAR flag is not passed.Suggested-by: Wolfgang Denk
Signed-off-by: Quentin Schulz
07 May, 2018
1 commit
-
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.Signed-off-by: Tom Rini
08 Oct, 2016
1 commit
-
By default saveenv option is not supported for SPL. This patch
enable the support for save environment variable for SPL build.Enable save environment support in SPL after setenv. By default
the saveenv option is not provided in SPL, but some boards need
this support in 'Falcon' boot, where SPL need to boot from
different images based on environment variable set by OS. For
example OS may set "reboot_image" environment variable to
"recovery" inorder to boot recovery image by SPL. The SPL read
"reboot_image" and act accordingly and change the reboot_image
to default mode using setenv and save the environemnt.Signed-off-by: Ravi Babu
Reviewed-by: Simon Glasschange in v1:
- dropped SUPPORT, use CONFIG_SPL_SAVEENV
- updates the comments in mmc_private.h
07 Oct, 2016
1 commit
-
Fix various misspellings of:
* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architectureSigned-off-by: Robert P. J. Day
Reviewed-by: Jagan Teki
Reviewed-by: Stefan Roese
26 Jul, 2016
1 commit
-
This fixes a mismatch between the %zu format and the type used on sandbox.
Signed-off-by: Simon Glass
Reviewed-by: Tom Rini
16 Jul, 2016
1 commit
-
Fix a number of typos, including:
* "compatble" -> "compatible"
* "eanbeld" -> "enabled"
* "envrionment" -> "environment"
* "FTD" -> "FDT" (for "flattened device tree")
* "ommitted" -> "omitted"
* "overriden" -> "overridden"
* "partiton" -> "partition"
* "propogate" -> "propagate"
* "resourse" -> "resource"
* "rest in piece" -> "rest in peace"
* "suport" -> "support"
* "varible" -> "variable"Signed-off-by: Robert P. J. Day
16 Sep, 2015
2 commits
-
ithout this patch memory is not released on early exit.
Signed-off-by: Lukasz Majewski
-
Lets consider following scenario:
- One uses echo -n "key=value" to define environment variable in a file (single variable)
- The file content is "key=value" without any terminating byte (e.g. 0x0a or
0x0d).
- The file is loaded to u-boot non zero'ed RAM buffer (with load command).
- Then "env import -t -r $loadaddr $filesize" is executed.
- Due to lack of proper termination byte we have classical example of buffer
overrun.This patch prevents from this by allocating one extra byte than size and
explicitly null terminate it.There should be no change for normal env import operation after applying
this patch.Signed-off-by: Lukasz Majewski
22 Jul, 2014
1 commit
-
When this option is enabled, CRLF is treated like LF when importing environments
from text files, which means CRs ('\r') in front of LFs ('\n') are just ignored.Drawback of enabling this option is that (maybe exported) variables which have
a trailing CR in their content will get imported without that CR. But this
drawback is very unlikely and the big advantage of letting Windows user create
a *working* uEnv.txt too is likely more welcome.Signed-off-by: Alexander Holler
09 Nov, 2013
1 commit
-
The env export command doesn't export the first variable of the list
since commit 5a31ea04c9ee5544fbb70ad7597ea4b294840eab
"env grep" - reimplement command using hexport_r()Signed-off-by: Pierre Aubert
20 Sep, 2013
1 commit
-
Fix various misspellings of things like "environment", "kernel",
"default" and "volatile", and throw in a couple grammar fixes.Signed-off-by: Robert P. J. Day
24 Jul, 2013
1 commit
-
Signed-off-by: Wolfgang Denk
10 May, 2013
1 commit
-
If the environment contains an entry like "=value" "\0" we should throw
an error when parsing the environment. Otherwise, U-Boot will enter in
an infinite loop.Signed-off-by: Lucian Cojocar
02 May, 2013
3 commits
-
When CONFIG_REGEX is enabled, the new option "-e" becomes available
which causes regular expression matches to be used. This allows for
example things like these:- print all MAC addresses:
=> env grep -e eth.*addr
eth1addr=00:10:ec:80:c5:15
ethaddr=00:10:ec:00:c5:15- print all variables that have at least 2 colons in their value:
=> env grep -v -e :.*:
addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off
panic=1
eth1addr=00:10:ec:80:c5:15
ethaddr=00:10:ec:00:c5:15
ver=U-Boot 2013.04-rc1-00289-g497746b-dirty (Mar 22 2013 - 12:50:25)etc.
Signed-off-by: Wolfgang Denk
-
Also drop hstrstr_r() which is not needed any more.
The new code is way more flexible.Signed-off-by: Wolfgang Denk
-
The output of "env grep" is unsorted, and printing is done by a
private implementation to parse the hash table. We have all the
needed code in place in hexport_r() alsready, so let's use this
instead. Here we prepare the code for this, without any functional
changes yet.Signed-off-by: Wolfgang Denk
14 Dec, 2012
6 commits
-
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
-
Add support for per-variable callbacks to the "hashtable" functions.
Signed-off-by: Joe Hershberger
!!!fix comment in callback
-
When printing all variables with env print, don't print variables that
begin with '.'. If env print is called with a '-a' switch, then
include variables that begin with '.' (just like the ls command).Variables printed explicitly will be printed even without the -a.
Signed-off-by: Joe Hershberger
-
Move the read of the old value to inside the check function. In some
cases it can be avoided all together and at the least the code is only
called from one place.Also name the function and the callback to more clearly describe what
it does.Pass the ENTRY instead of just the name for direct access to the whole
data structure.Pass an enum to the callback that specifies the operation being approved.
Signed-off-by: Joe Hershberger
-
The same chunk of code was replicated in two places and the following
changes will make that chunk grow a bit, so combine into a static func.Signed-off-by: Joe Hershberger
-
Use a flag in hsearch_r for insert mode passed from import to allow the
behavior be different based on use.Now that "do_check" is called for all imports, ensure console init is
complete before updating the console on relocation importSigned-off-by: Joe Hershberger
02 Oct, 2012
1 commit
-
This patch adds support for networking in SPL. Some devices are
capable of loading SPL via network so it makes sense to load the
main U-Boot binary via network too. This patch tries to use
existing network code as much as possible. Unfortunately, it depends
on environment which in turn depends on other code so SPL size
is increased significantly. No effort was done to decouple network
code and environment so far.Signed-off-by: Ilya Yanok
Acked-by: Joe Hershberger
Signed-off-by: Tom Rini
19 Sep, 2012
4 commits
-
When variables explicitly specified on the command line are not present
in the imported env, delete them from the running env.
If the variable is also missing from the running env, issue a warning.Signed-off-by: Gerlando Falauto
Reviewed-by: Marek Vasut -
Signed-off-by: Gerlando Falauto
Reviewed-by: Marek Vasut -
Change hashtable so that a callback function will decide whether a
variable can be overwritten, and possibly apply the changes.So add a new field to struct hsearch_data:
o "apply" callback function to check whether a variable can be
overwritten, and possibly immediately apply the changes;
when NULL, no check is performed.And a new argument to himport_r():
o "do_apply": whether to call the apply callback functionNOTE: This patch does not change the current behavior.
Signed-off-by: Gerlando Falauto
Reviewed-by: Marek Vasut -
Add 2 new arguments to himport_r():
o "nvars", "vars": number and list of variables to take into account
(0 means ALL)NOTE: This patch does not change the current behaviour.
Signed-off-by: Gerlando Falauto
Reviewed-by: Marek Vasut
22 Nov, 2011
1 commit
-
This fixes a few printf() strings for size_t which are missing the 'z'
modifier.Signed-off-by: Simon Glass
Acked-by: Mike Frysinger
08 Nov, 2011
1 commit
-
New syntax:
env export [-t | -b | -c] [-s size] addr [var ...]With this change it is possible to provide a list of variables names
that shall be exported. Whenno arguments are given, the whole
environment gets exported.NOTE: The new handling of the "size" argument means a change to the
user API.Signed-off-by: Wolfgang Denk
18 Oct, 2011
1 commit
-
These are various places I found that checked for conditions equivalent
to isblank.Signed-off-by: Jason Hobbs
30 Jul, 2011
1 commit
-
This is needed to get rid of build warnings like
main.c:311: warning: passing argument 2 of 'setenv' discards qualifiers from pointer target type
which result from commit 09c2e90 "unify version_string".
Signed-off-by: Wolfgang Denk
Cc: Andreas Bießmann
28 Apr, 2011
1 commit
-
u-boot environments, esp. when boards are shared across multiple
users, can get pretty large and time consuming to visually parse.
The grepenv command this patch adds can be used in lieu of printenv
to facilitate searching. grepenv works like printenv but limits
its output only to environment strings (variable name and value
pairs) that match the user specified substring.the following examples are on a board with a 5313 byte environment
that spans multiple screen pages:Example 1: summarize ethernet configuration:
=> grepenv eth TSEC
etact=FM1@DTSEC2
eth=FM1@DTSEC4
ethact=FM1@DTSEC2
eth1addr=00:E0:0C:00:8b:01
eth2addr=00:E0:0C:00:8b:02
eth3addr=00:E0:0C:00:8b:03
eth4addr=00:E0:0C:00:8b:04
eth5addr=00:E0:0C:00:8b:05
eth6addr=00:E0:0C:00:8b:06
eth7addr=00:E0:0C:00:8b:07
eth8addr=00:E0:0C:00:8b:08
eth9addr=00:E0:0C:00:8b:09
ethaddr=00:E0:0C:00:8b:00
netdev=eth0
uprcw=setenv ethact $eth;setenv filename p4080ds/R_PPSXX_0xe/rcw_0xe_2sgmii_rev2_high.bin;setenv start 0xe8000000;protect off all;run upimage;protect on all
upuboot=setenv ethact $eth;setenv filename u-boot.bin;setenv start eff80000;protect off all;run upimage;protect on all
upucode=setenv ethact $eth;setenv filename fsl_fman_ucode_P4080_101_6.bin;setenv start 0xef000000;protect off all;run upimage;protect on all
usdboot=setenv ethact $eth;tftp 1000000 $dir/$bootfile;tftp 2000000 $dir/initramfs.cpio.gz.uboot;tftp c00000 $dir/p4080ds-usdpaa.dtb;setenv bootargs root=/dev/ram rw console=ttyS0,115200 $othbootargs;bootm 1000000 2000000 c00000;
=>Example 2: detect unused env vars:
=> grepenv etact
etact=FM1@DTSEC2
=>Example 3: reveal hardcoded variables; e.g., for fdtaddr:
=> grepenv fdtaddr
fdtaddr=c00000
nfsboot=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off console=$consoledev,$baudrate $othbootargs;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr - $fdtaddr
ramboot=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate $othbootargs;tftp $ramdiskaddr $ramdiskfile;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr $ramdiskaddr $fdtaddr
=> grep $fdtaddr
fdtaddr=c00000
my_boot=bootm 0x40000000 0x41000000 0x00c00000
my_dtb=tftp 0x00c00000 $prefix/p4080ds.dtb
nohvboot=tftp 1000000 $dir/$bootfile;tftp 2000000 $dir/$ramdiskfile;tftp c00000 $dir/$fdtfile;setenv bootargs root=/dev/ram rw ramdisk_size=0x10000000 console=ttyS0,115200;bootm 1000000 2000000 c00000;
=>This patch also enables the grepenv command by default on
corenet_ds based boards (and repositions the DHCP command
entry to keep the list sorted).Signed-off-by: Kim Phillips
Cc: Kumar Gala
Cc: Andy Fleming