summaryrefslogtreecommitdiffstats
path: root/common/imd.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/imd.c')
-rw-r--r--common/imd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/common/imd.c b/common/imd.c
index e1d5733c6b..1100e6878a 100644
--- a/common/imd.c
+++ b/common/imd.c
@@ -21,6 +21,12 @@ static inline void read_file_2_free(void *buf)
{
free(buf);
}
+
+static int imd_read_file(const char *filename, size_t *size, void **outbuf,
+ bool allow_mmap)
+{
+ return read_file_2(filename, size, outbuf, 0x100000);
+}
#endif
/*
@@ -317,7 +323,7 @@ static int imd_calculate_crc32(void *input, const struct imd_header *imd_start,
length = ALIGN(length, 4);
length += sizeof(struct imd_header);
- if (imd_read_type(imd) == IMD_TYPE_CRC32) {
+ if (imd_is_crc32(imd_read_type(imd))) {
*imd_crc = (struct imd_header *)imd;
debug("Found crc token at %d\n", end_ofs);
break;
@@ -434,6 +440,7 @@ int imd_command(int argc, char *argv[])
char *str;
uint32_t checksum = 0;
uint32_t verify = 0;
+ bool allow_mmap = true;
imd_command_verbose = 0;
@@ -457,6 +464,7 @@ int imd_command(int argc, char *argv[])
break;
case 'c':
checksum = 1;
+ allow_mmap = false;
break;
case 'V':
verify = 1;
@@ -473,7 +481,7 @@ int imd_command(int argc, char *argv[])
filename = argv[optind];
- ret = read_file_2(filename, &size, &buf, 0x100000);
+ ret = imd_read_file(filename, &size, &buf, allow_mmap);
if (ret && ret != -EFBIG)
return -errno;