summaryrefslogtreecommitdiff
path: root/util/cbfstool/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/cbfstool/util.c')
-rw-r--r--util/cbfstool/util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/util/cbfstool/util.c b/util/cbfstool/util.c
index b36e9187a0..f0c0b293cf 100644
--- a/util/cbfstool/util.c
+++ b/util/cbfstool/util.c
@@ -25,6 +25,13 @@
#include <sys/mman.h>
#include "cbfstool.h"
+int uninitialized_flash_value = 0xff;
+
+void flashinit(void *ptr, size_t len)
+{
+ memset(ptr, uninitialized_flash_value, len);
+}
+
int get_size(const char *size)
{
char *next;
@@ -203,6 +210,9 @@ int create_rom(struct rom *rom, const unsigned char *filename,
return -1;
}
+ /* mmap'ed pages are by default zero-filled. Fix that. */
+ flashinit(rom->ptr, romsize);
+
/* This is a pointer to the header for easy access */
rom->header = (struct cbfs_header *)
ROM_PTR(rom, rom->size - 16 - bootblocksize - sizeof(struct cbfs_header));