[U-Boot] [PATCH 0/2] tools/env: minor fixes plus resend

The redundant environment patch was already submitted once, but not applied due to a merge conflict. The second patch is an addon to 183923d3e as suggested by Stefan Agner
Andreas Fenkart (2): tools/env: return with error if redundant environments have unequal size tools/env: soften warning about erase block alignment
tools/env/fw_env.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)

For double buffering to work, the target buffer must always be big enough to hold all data. This can only be ensured if buffers are of equal size, otherwise one must be smaller and we risk data loss when copying from the bigger to the smaller buffer.
Reviewed-by: Simon Glass sjg@chromium.org Signed-off-by: Andreas Fenkart andreas.fenkart@digitalstrom.com --- tools/env/fw_env.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index d2b167d..7cc7488 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1423,10 +1423,9 @@ static int parse_config(struct env_opts *opts) return rc;
if (ENVSIZE(0) != ENVSIZE(1)) { - ENVSIZE(0) = ENVSIZE(1) = min(ENVSIZE(0), ENVSIZE(1)); fprintf(stderr, - "Redundant environments have inequal size, set to 0x%08lx\n", - ENVSIZE(1)); + "Redundant environments have unequal size"); + return -1; } }

On Wed, Aug 17, 2016 at 11:41:53PM +0200, Andreas Fenkart wrote:
For double buffering to work, the target buffer must always be big enough to hold all data. This can only be ensured if buffers are of equal size, otherwise one must be smaller and we risk data loss when copying from the bigger to the smaller buffer.
Reviewed-by: Simon Glass sjg@chromium.org Signed-off-by: Andreas Fenkart andreas.fenkart@digitalstrom.com
Reviewed-by: Tom Rini trini@konsulko.com

On Wed, Aug 17, 2016 at 11:41:53PM +0200, Andreas Fenkart wrote:
For double buffering to work, the target buffer must always be big enough to hold all data. This can only be ensured if buffers are of equal size, otherwise one must be smaller and we risk data loss when copying from the bigger to the smaller buffer.
Reviewed-by: Simon Glass sjg@chromium.org Signed-off-by: Andreas Fenkart andreas.fenkart@digitalstrom.com Reviewed-by: Tom Rini trini@konsulko.com
Applied to u-boot/master, thanks!

addon 183923d3e MMC/SATA have no erase blocks, only blocks. Hence the warning about erase block alignment might be confusing in such environment.
Signed-off-by: Andreas Fenkart andreas.fenkart@digitalstrom.com --- tools/env/fw_env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 7cc7488..d27f57e 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1295,7 +1295,7 @@ static int check_device_config(int dev) int fd, rc = 0;
if (DEVOFFSET(dev) % DEVESIZE(dev) != 0) { - fprintf(stderr, "Environment does not start on erase block boundary\n"); + fprintf(stderr, "Environment does not start on (erase) block boundary\n"); errno = EINVAL; return -1; }

On Wed, Aug 17, 2016 at 11:41:54PM +0200, Andreas Fenkart wrote:
addon 183923d3e MMC/SATA have no erase blocks, only blocks. Hence the warning about erase block alignment might be confusing in such environment.
Signed-off-by: Andreas Fenkart andreas.fenkart@digitalstrom.com
Reviewed-by: Tom Rini trini@konsulko.com

On Wed, Aug 17, 2016 at 11:41:54PM +0200, Andreas Fenkart wrote:
addon 183923d3e MMC/SATA have no erase blocks, only blocks. Hence the warning about erase block alignment might be confusing in such environment.
Signed-off-by: Andreas Fenkart andreas.fenkart@digitalstrom.com Reviewed-by: Tom Rini trini@konsulko.com
Applied to u-boot/master, thanks!
participants (2)
-
Andreas Fenkart
-
Tom Rini