Commit Graph

8 Commits

Author SHA1 Message Date
Marcin Niestroj c1f51e0f3e common: env_ubi: Clear environment buffer before reading
In case we have restarted u-boot there is a chance that environment
buffer contains old environment (from the previous boot). If UBI volume
is zero size, ubi_volume_read() doesn't modify the buffer and exits
successfully.

We need to clear buffer manually before reading it from UBI, so the
invalid CRC will cause setting default environment in case that the UBI
volume is zero size.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2016-06-13 06:41:20 +02:00
Kevin Smith a7c06cd3a6 env_ubi.c: Correct pointer error in env load
The variable "buf" in this function is a char array, and the
function ubi_volume_read is expecting a char *.  In the call, the
address of the pointer is being taken, incorrectly passing a
char **.  The compiler warning was being silenced by the cast.
Remove the address operator and the cast.

Signed-off-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
2015-11-19 07:32:49 +01:00
Simon Glass cf92e05c01 Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header
Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-09-11 17:15:20 -04:00
Marek Vasut 7ce1526ed2 env: Add env_export() wrapper
Implement env_export() wrapper, so that all implementers of saveenv() don't
have to call hexport_r(), crc32() etc. sequence . This trims down a bit of
code duplication.

Signed-off-by: Marek Vasut <marex@denx.de>
2014-03-21 16:43:59 -04:00
Wolfgang Denk 3765b3e7bd Coding Style cleanup: remove trailing white space
Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-10-14 16:06:53 -04:00
Wolfgang Denk 1a4596601f Add GPL-2.0+ SPDX-License-Identifier to source files
Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24 09:44:38 -04:00
Joe Hershberger 785881f775 env: Add redundant env support to UBI env
Allow the user to specify two UBI volumes to use for the environment

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2013-04-11 15:52:55 -04:00
Joe Hershberger 2b74433f36 env: Add support for UBI environment
UBI is a better place for the environment on NAND devices because it
handles wear-leveling and bad blocks.

Gluebi is needed in Linux to access the env as an MTD partition.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2013-04-11 15:52:55 -04:00