@@ -1 +1,2 @@
gen_reloc_table
+sloffs
@@ -231,17 +231,20 @@ update_modification_time(struct stH *header)
struct tm *tm;
time_t caltime;
char dastr[16] = { 0, };
+ uint64_t date;
/* update modification date
* copied from create_crc.c */
caltime = time(NULL);
tm = localtime(&caltime);
strftime(dastr, 15, "0x%Y%m%d%H%M", tm);
+ date = cpu_to_be64(strtoll(dastr, NULL, 16));
/* this does not match the definition from
* struct stH, but we immitate the bug from
- * flash image creation in create_crc.c */
- *(uint64_t *)(header->mdate) = cpu_to_be64(strtoll(dastr, NULL, 16));
+ * flash image creation in create_crc.c.
+ * The date is in mdate and time in padding2. */
+ memcpy(&(header->mdate), &date, 8);
}
static void
@@ -449,11 +452,11 @@ sloffs_dump(const int fd)
printf("N/A");
}
printf("\n");
- printf(" Image Length: %lld", be64_to_cpu(header->flashlen));
- printf(" (0x%llx) bytes\n", be64_to_cpu(header->flashlen));
+ printf(" Image Length: %ld", be64_to_cpu(header->flashlen));
+ printf(" (0x%lx) 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 CRC check: ", crc);
+ printf(" Header CRC : 0x%016lx CRC check: ", crc);
/* to test the CRC of the header we need to know the actual
* size of the file and not just the size of the data
* which could be easily obtained with sizeof(struct stH);
@@ -478,7 +481,7 @@ sloffs_dump(const int fd)
/* read it */
read(fd, &crc, 8);
crc = be64_to_cpu(crc);
- printf(" Image CRC : 0x%016llx CRC check: ", crc);
+ printf(" Image CRC : 0x%016lx CRC check: ", crc);
crc = check_image_crc(fd, be64_to_cpu(header->flashlen));
if (!crc)
printf("[OK]");
@@ -555,15 +558,15 @@ sloffs_list(const int fd)
return;
for (;;) {
- printf(" 0x%08llx", offset);
+ printf(" 0x%08lx", offset);
offset += be64_to_cpu(file.next);
printf(" %s", file.name);
for (i = 0; i < max - strlen(file.name); i++)
printf(" ");
- printf("%07lld ", be64_to_cpu(file.len));
- printf("(0x%06llx)", be64_to_cpu(file.len));
- printf(" 0x%08llx\n", be64_to_cpu(file.flags));
+ printf("%07ld ", be64_to_cpu(file.len));
+ printf("(0x%06lx)", be64_to_cpu(file.len));
+ printf(" 0x%08lx\n", be64_to_cpu(file.flags));
if (be64_to_cpu(file.next) == 0)
break;
The sloffs.c code is from 2008 and 8 years later compilers seem to have become more sensitive. This silences the compiler warnings and was used at the same time to test sloffs. Following options have been tested: '--list', '--dump' and '--append'. Signed-off-by: Adrian Reber <adrian@lisas.de> --- tools/.gitignore | 1 + tools/sloffs.c | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-)