Skip to contentSkip to conversation

tools/env: minor fixes plus resend

PATCH New Andreas Fenkart 2 participants 7 messages Aug 17, 2016 – Aug 21, 2016

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
2.8.1
#1 lore raw

PATCH 1/2 tools/env: return with error if redundant environments have unequal size

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.

---
 tools/env/fw_env.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
tools/env/fw_env.c +2 -3
index d2b167d..7cc7488 100644
@@ -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;
 		}
 	}
 
Signature · 1 line
2.8.1
#2 lore raw

PATCH 1/2 tools/env: return with error if redundant environments have unequal size

Quoted 7 lines · Andreas Fenkart

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160819/1d0194e8/attachment.sig>
#3 lore raw

PATCH 1/2 tools/env: return with error if redundant environments have unequal size

In reply to Andreas Fenkart
Quoted 8 lines · Andreas Fenkart

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160821/3a773b1a/attachment.sig>
#4 lore raw

PATCH 2/2 tools/env: soften warning about erase block alignment

In reply to Andreas Fenkart

addon 183923d3e
MMC/SATA have no erase blocks, only blocks. Hence the warning about erase block alignment might be confusing in such environment.

---
 tools/env/fw_env.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/env/fw_env.c +1 -1
index 7cc7488..d27f57e 100644
@@ -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;
 	}
Signature · 1 line
2.8.1
#5 lore raw

PATCH 2/2 tools/env: soften warning about erase block alignment

Quoted 5 lines · Andreas Fenkart

addon 183923d3e
MMC/SATA have no erase blocks, only blocks. Hence the warning about erase block alignment might be confusing in such environment.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160819/90a70d0c/attachment.sig>
#6 lore raw

PATCH 2/2 tools/env: soften warning about erase block alignment

In reply to Andreas Fenkart
Quoted 6 lines · Andreas Fenkart

addon 183923d3e
MMC/SATA have no erase blocks, only blocks. Hence the warning about erase block alignment might be confusing in such environment.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160821/b2e33612/attachment.sig>