From da7493d8f92be7f0eb0ec69252119ec93527fe08 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Fri, 30 Jul 2010 21:19:49 +0000
Subject: [PATCH] mostly revert commit r22396

CFE does not boot images generated with these checksums because of
wrong checksum.

After flashing then with tftp to my Asus wl500-GPv1 the following messages
are show:
Null Rescue Flag.
Boot program checksum is invalid
Hello!! Enter Rescue Mode: (Check error)

SVN-Revision: 22418
---
 target/linux/brcm47xx/image/Makefile | 2 +-
 tools/firmware-utils/src/trx.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/brcm47xx/image/Makefile b/target/linux/brcm47xx/image/Makefile
index f534f5f284..69a31e7554 100644
--- a/target/linux/brcm47xx/image/Makefile
+++ b/target/linux/brcm47xx/image/Makefile
@@ -56,7 +56,7 @@ define trxalign/jffs2-64k
 -a 0x10000 -f $(KDIR)/root.$(1)
 endef
 define trxalign/squashfs
--a 1024 -f $(KDIR)/root.$(1) $(if $(2),-f $(2)) -a 0x10000 -F $(KDIR)/fs_mark
+-a 1024 -f $(KDIR)/root.$(1) $(if $(2),-f $(2)) -a 0x10000 -A $(KDIR)/fs_mark
 endef
 
 define Image/Build/trxV2
diff --git a/tools/firmware-utils/src/trx.c b/tools/firmware-utils/src/trx.c
index 426a6b5834..8e95d98d7a 100644
--- a/tools/firmware-utils/src/trx.c
+++ b/tools/firmware-utils/src/trx.c
@@ -276,7 +276,7 @@ int main(int argc, char **argv)
 						(fsmark)?fsmark:cur_len - offsetof(struct trx_header, flag_version));
 	p->crc32 = STORE32_LE(p->crc32);
 
-	p->len = (fsmark)?fsmark:cur_len - offsetof(struct trx_header, flag_version);
+	p->len = STORE32_LE((fsmark) ? fsmark : cur_len);
 	p->len = STORE32_LE(p->len);
 
 	/* restore TRXv2 bin-header */
-- 
GitLab