@@ -13,16 +13,20 @@
include ../make.rules
TARGETS = gen_reloc_table sloffs
+HOSTCFLAGS += -I../romfs/tools
all: $(TARGETS)
+crclib.o: ../romfs/tools/crclib.c
+ $(HOSTCC) -W $(HOSTCFLAGS) -c $^ -o $@
+
%.o: %.c
$(HOSTCC) -W $(HOSTCFLAGS) -c $^
gen_reloc_table: gen_reloc_table.o
$(HOSTCC) $(HOSTCFLAGS) -o $@ $^
-sloffs: sloffs.o
+sloffs: sloffs.o crclib.o
$(HOSTCC) $(HOSTCFLAGS) -o $@ $^
clean_here:
@@ -23,6 +23,7 @@
#include <getopt.h>
#include <calculatecrc.h>
+#include <crclib.h>
#define VERSION 1
@@ -136,11 +137,24 @@ sloffs_dump(const void *data)
printf(" (0x%llx) bytes\n", be64_to_cpu(header->flashlen));
printf(" Revision : %s\n", header->platform_revision);
crc = be64_to_cpu(header->ui64CRC);
- printf(" Header CRC : 0x%016llx\n", crc);
+ printf(" Header CRC : 0x%016llx CRC check: ", crc);
+ crc = calCRCword((unsigned char *)data, be64_to_cpu(sloffs->len), 0);
+ if (!crc)
+ printf("[OK]");
+ else
+ printf("[FAILED]");
+ printf("\n");
+
crc = be64_to_cpu(header->flashlen);
crc = *(uint64_t *)(unsigned char *)(data + crc - 8);
crc = be64_to_cpu(crc);
- printf(" Image CRC : 0x%016llx\n", crc);
+ printf(" Image CRC : 0x%016llx CRC check: ", crc);
+ crc = calCRCword((unsigned char *)data, be64_to_cpu(header->flashlen), 0);
+ if (!crc)
+ printf("[OK]");
+ else
+ printf("[FAILED]");
+ printf("\n");
/* count number of files */
sloffs = (struct sloffs *)data;
Added CRC check of the header and complete image when dumping the header. (cherry picked from commit 645bc2cbd550829d43b460663b998b9d4685a2d2) Cherry picked from https://lisas.de/~adrian/slof/slof.git/ Signed-off-by: Adrian Reber <adrian@lisas.de> --- tools/Makefile | 6 +++++- tools/sloffs.c | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-)