Patchwork [U-Boot,PATCHv3,8/8] mkenvimage: Really set the redundant byte when applicable

login
register
mail settings
Submitter David Wagner
Date Jan. 5, 2012, 6:44 p.m.
Message ID <1325789099-9260-8-git-send-email-david.wagner@free-electrons.com>
Download mbox | patch
Permalink /patch/134532/
State Superseded
Headers show

Comments

David Wagner - Jan. 5, 2012, 6:44 p.m.
Signed-off-by: David Wagner <david.wagner@free-electrons.com>
---
 tools/mkenvimage.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c
index a3d4e27..c1e6cad 100644
--- a/tools/mkenvimage.c
+++ b/tools/mkenvimage.c
@@ -276,7 +276,9 @@  int main(int argc, char **argv)
 	crc = crc32(0, envptr, envsize);
 	targetendian_crc = bigendian ? cpu_to_be32(crc) : cpu_to_le32(crc);
 
-	memcpy(dataptr, &targetendian_crc, sizeof(uint32_t));
+	memcpy(dataptr, &targetendian_crc, sizeof(targetendian_crc));
+	if (redundant)
+		dataptr[sizeof(targetendian_crc)] = 1;
 
 	if (!bin_filename || strcmp(bin_filename, "-") == 0) {
 		bin_fd = STDOUT_FILENO;